What is Union?
You have two playlists. You want to combine them into one.
That’s union — everything from both sets, no duplicates.
Symbol: — looks like a cup that holds everything.
This reads: “A union B”
Example
Find :
Start with A, then add anything from B that’s not already there:
- Start:
- 3 from B? Already have it
- 4 from B? Add it
- 5 from B? Add it
Duplicates are ignored. The 3 appears once.
More Examples
| Why? | |||
|---|---|---|---|
| No overlap, just combine | |||
| Identical sets | |||
| A inside B, union is B | |||
| Empty set adds nothing |
Properties
Union with itself:
Combining something with itself doesn’t add anything new.
Union with empty set:
Adding nothing changes nothing.
Order doesn’t matter (commutative):
Combining A with B is the same as combining B with A.
Grouping doesn’t matter (associative):
When combining three sets, the grouping doesn’t affect the result.
The Formal Definition
This reads: “The set of all such that is in A or is in B.”
In math, “or” includes “both” — if something is in both sets, it’s included.
Union asks: is it in either set?