See below for a detailed description of each operation.
Union
The union of two sets contains every element that appears in either set.
Think of it as combining both lists and removing duplicates.
For example, suppose Mary and Carlos are buying fruits and vegetables at a farmstand. Mary's basket contains:
- berries,
- lettuce, and
- apples
and Carlos's basket contains:
- lettuce,
- peppers,
- onions, and
- berries
When they get home, together they purchased:
- apples,
- berries,
- lettuce,
- peppers, and
- onions
This is the union of the two sets!
Try it!
Intersection
The intersection of two sets contains only elements that appear in both sets —
the shared overlap in a Venn diagram.
For example, suppose you are a teacher determining which students play multiple sports. The tennis team roster contains:
- Jason,
- James,
- Emily, and
- Robert
while the swim team roster includes:
- Emily,
- Jared,
- Larry, and
- Rachel
The only student on both teams is:
This is the intersection of the two sets!
Try it!
Difference
The difference of two sets contains elements in the first set that do not appear in the second.
Unlike union and intersection, order matters — the second set is subtracted from the first.
For example, suppose a teacher wants students in math courses except those taking geometry. The math roster is:
- Stacy,
- Matthew,
- Jon,
- Caroline
and the geometry roster is:
The remaining students are:
This is the difference of the two sets!
Try it!