Theory
Four questions about two teams
Your class has a cricket team A and a football team B. Four messages need sending:
1. Sports day notice: everyone in either team
2. Double-training alert: players in both teams
3. Cricket-only meeting: in A but not B
4. Non-cricketers' slot: everyone outside A
You just used all four set operations. Now we give them symbols and rules.
Theory
Union and intersection
Running example: A = {1, 2, 3}, B = {3, 4, 5}.
- Union A ∪ B: elements in A or B or both → {1, 2, 3, 4, 5}
- Intersection A ∩ B: elements in both → {3}
Note 3 appears once in the union, because sets never repeat. In a Venn diagram, union shades both circles, intersection shades only the overlap.
Theory
Difference and complement
Same A and B:
- Difference A − B: in A but not in B → {1, 2}
- B − A = {4, 5}, a different set! Difference is not commutative.
For complement, first fix a universal set U (everything under discussion). Then A′ is everything in U that is not in A. With U = {1, 2, ..., 8} and A = {1, 2, 3}: A′ = {4, 5, 6, 7, 8}.
Quiz
A = {1, 2, 3} and B = {3, 4, 5}. What is A − B?
- {1, 2}
- {4, 5}
- {3}
- {1, 2, 4, 5}
Show the answer
{1, 2}
Start with A and remove anything that is also in B: only the shared 3 leaves, so {1, 2} remains. {4, 5} is B − A, the classic direction mix-up. {3} is the intersection, and {1, 2, 4, 5} is the symmetric difference, both different questions.
Think first
U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} and E = the even numbers in U.
Say E′ out loud before tapping.
Show the answer
E′ = {1, 3, 5, 7, 9}: everything in U that is not even, in other words the odd numbers of U.
Complement always needs U to be fixed first. Without knowing the universe, "not even" could include letters, people, anything. Exams sometimes hide the trick by not stating U clearly; always write down U first.
Theory
Laws that feel like ordinary algebra
For any sets A, B, C:
- Commutative: A ∪ B = B ∪ A and A ∩ B = B ∩ A
- Associative: (A ∪ B) ∪ C = A ∪ (B ∪ C), same for ∩
- Distributive: A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C), and the mirror with ∪ outside
Rough guide: ∪ behaves like + and ∩ like ×, except distribution works in both directions for sets.
Theory
Laws involving Ø, U and A itself
- Identity: A ∪ Ø = A and A ∩ U = A (adding nothing, or filtering by everything, changes nothing)
- Domination: A ∪ U = U and A ∩ Ø = Ø
- Idempotent: A ∪ A = A and A ∩ A = A
- Complement: A ∪ A′ = U, A ∩ A′ = Ø, and (A′)′ = A
Each one is obvious if you say it in words. Do that once and you never need to memorise them.
Theory
De Morgan's laws, the exam stars
(A ∪ B)′ = A′ ∩ B′ and (A ∩ B)′ = A′ ∪ B′
In words: NOT (cricket or football) means NOT cricket and NOT football. Refuse both, not just one.
Mechanically: when the complement moves inside the bracket, every ∪ becomes ∩ and every ∩ becomes ∪, and each set gets its own complement.
Quiz
Simplify (A ∪ B)′ using De Morgan's law.
- A′ ∪ B′
- A′ ∩ B′
- A ∩ B
- (A ∩ B)′
Show the answer
A′ ∩ B′
The complement distributes onto each set AND flips the operation: (A ∪ B)′ = A′ ∩ B′. Option A keeps the union, the single most common De Morgan mistake. Think of the party version: not (tea or coffee) means no tea and no coffee.
Watch out
Two sanity checks that catch most errors
First: a union can never be smaller than either of its sets, and an intersection can never be bigger. If your answer breaks that, recompute. Second: when applying De Morgan's, if you did not flip ∪ to ∩ (or back), you did it wrong; the flip is the law.
Theory
Where you will meet this again
SQL's OR, AND and NOT follow these exact laws, and query optimisers use De Morgan's to rewrite conditions. Probability's addition rule lives on unions and intersections. And the Boolean Algebra unit coming up is this same law-set with 1 for U and 0 for Ø.
Summary
Key takeaways
- Union collects either set, intersection keeps the shared part, difference subtracts one from another, complement takes everything else inside U.
- A − B is not B − A; complement is meaningless until U is fixed.
- Commutative, associative and distributive laws work like familiar algebra, with idempotent, identity, domination and complement laws on top.
- De Morgan's: complement the parts and flip the operation.
- Memory hook: break the line, change the sign.