Set Operations Venn¶
Run the Set Operations Venn MicroSim Fullscreen
Edit in the p5.js Editor
About This MicroSim¶
Union, intersection, and difference are inherently spatial ideas that the
text output of {...} completely hides. Here students type two sets and the
member chips land in the correct Venn regions automatically. Each operation
button shades exactly the region it selects — A | B lights both circles,
A & B only the lens, A - B the left crescent, A ^ B everything except
the lens — while the Python expression and its result set print below.
Typing a duplicate visibly collapses it, and an empty intersection prints
set(), Python's empty-set notation.
Learning objective: The student will be able to classify which elements belong to A | B, A & B, A − B, and A ^ B for two given sets.
- Bloom's Taxonomy (2001): Understand → Analyze — classify, compare, organize
- Interaction pattern: editable sets plus operation buttons that highlight regions
How to Use¶
- Predict which animals
A & Bselects, then click the intersection button and check the shaded region. - Click all four operations and describe each shaded region in your own words.
- Edit the sets: type your own items, then type one item twice in set A — the duplicate collapses because sets never hold repeats.
- Remove all shared items and click
A & B— the result isset().
Iframe Embed Code¶
You can add this MicroSim to any web page by adding this to your HTML:
1 2 3 4 | |
Lesson Plan¶
Grade Level¶
Upper elementary and middle school (ages 10-14), Chapter 20 (Tuples and Sets)
Duration¶
10-15 minutes
Prerequisites¶
- Creating sets with curly braces (Chapter 20)
Activities¶
- Region tour (4 min): For the default sets, students predict all four operation results on paper, then verify each with a click.
- Build your own (4 min): Students enter their two favorite-food sets and find their intersection with a partner's.
- Edge cases (4 min): Make the intersection empty (what prints?), make B a subset of A (what does A - B leave?), and enter a duplicate.
Assessment¶
- Student matches each operator symbol to its shaded region
- Student predicts the result set for all four operations on new sets
- Student can explain why sets automatically remove duplicates
References¶
- Python Documentation — Set Types — official set operations documentation
- Wikipedia — Venn diagram — background on the visualization
- p5.js — the JavaScript library used to build this MicroSim