Set Operations
Union, intersection, complement, difference, symmetric difference — and the algebra that governs them. De Morgan's laws proved from scratch.
The question operations answer
You have two sets. What can you build from them?
You can combine them — taking everything from both. That is union.
You can isolate what they share. That is intersection.
You can strip one from the other. That is difference.
You can ask what is not in a set (relative to the universe). That is complement.
These four operations are to sets what +, −, ×, ÷ are to numbers — the basic tools for building new sets from existing ones.
Union
The union of sets A and B, written A ∪ B, is the set of all elements that belong to A, or to B, or to both.
In logic, "or" is inclusive — "A or B" means A, or B, or both. This matches the mathematical definition.
Examples:
- A = {1, 2, 3}, B = {2, 3, 4, 5}. A ∪ B = {1, 2, 3, 4, 5}
- A = {a, e, i}, B = {i, o, u}. A ∪ B = {a, e, i, o, u}
- A = {x : x < 3}, B = {x : x > 7}. A ∪ B = (−∞, 3) ∪ (7, ∞)
- A = [1, 5], B = [3, 8]. A ∪ B = [1, 8]
- A ∪ ∅ = A (union with the empty set changes nothing)
- A ∪ U = U (union with the universal set gives U)
- A ∪ A = A (union with itself)
Cardinality of union: n(A ∪ B) = n(A) + n(B) − n(A ∩ B). We will prove this carefully in File 04.
Intersection
The intersection of A and B, written A ∩ B, is the set of elements that belong to both A and B.
Examples:
- A = {1, 2, 3}, B = {2, 3, 4, 5}. A ∩ B = {2, 3}
- A = {a, e, i}, B = {i, o, u}. A ∩ B = {i}
- A = (1, 5), B = (3, 8). A ∩ B = (3, 5)
- A = [1, 4], B = [5, 9]. A ∩ B = ∅ (no overlap)
- A ∩ ∅ = ∅
- A ∩ U = A
- A ∩ A = A
Disjoint sets: A and B are disjoint if A ∩ B = ∅. They share no elements.
Complement
The complement of A, written A' or Aᶜ or Ā, is the set of all elements in the universal set U that are not in A.
This operation requires a specified universal set.
Examples (U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}):
- A = {1, 3, 5, 7, 9}. A' = {2, 4, 6, 8, 10}
- A = {2, 4, 6, 8, 10}. A' = {1, 3, 5, 7, 9}
- ∅' = U (complement of empty is everything)
- U' = ∅ (complement of universe is empty)
- (A')' = A (double complement returns to A)
Examples (U = ℝ):
- A = (3, ∞). A' = (−∞, 3]
- A = [−2, 5]. A' = (−∞, −2) ∪ (5, ∞)
- A = ℚ. A' = set of all irrationals
Difference
The difference A minus B, written A − B or A \ B, is the set of elements in A that are not in B.
Examples:
- A = {1, 2, 3, 4}, B = {3, 4, 5, 6}. A − B = {1, 2}. B − A = {5, 6}.
- A = {1, 2, 3}, B = {1, 2, 3, 4, 5}. A − B = ∅. B − A = {4, 5}.
- A − ∅ = A
- A − A = ∅
- A − U = ∅ (removing the whole universe leaves nothing)
- U − A = A' (removing A from U gives the complement)
Connection to complement: A − B = A ∩ B'
Proof: x ∈ A − B ⟺ (x ∈ A and x ∉ B) ⟺ (x ∈ A and x ∈ B') ⟺ x ∈ A ∩ B'. ✓
Symmetric Difference
The symmetric difference of A and B, written A △ B (also written A ⊕ B), is the set of elements in exactly one of the two sets — in A or in B but not in both.
Examples:
-
A = {1, 2, 3, 4}, B = {3, 4, 5, 6}
- A − B = {1, 2}, B − A = {5, 6}
- A △ B = {1, 2, 5, 6}
- Or: A ∪ B = {1,2,3,4,5,6}, A ∩ B = {3,4}, A △ B = {1,2,5,6} ✓
-
A △ ∅ = A
-
A △ A = ∅
-
A △ B = B △ A (symmetric difference is commutative)
The symmetric difference captures exactly the "exclusive or" of membership: an element is in A △ B precisely when it is in A XOR in B.
Visualizing with Venn Diagrams
Venn diagrams are not proof tools — they are intuition aids. A diagram can suggest an identity; only algebra confirms it.
For two overlapping sets A and B inside universal set U:
Where x = A ∩ B
| Region | Set |
|---|---|
| Inside A or B or both | A ∪ B |
| Inside both circles | A ∩ B |
| Inside A, outside B | A − B |
| Inside B, outside A | B − A |
| Inside exactly one | A △ B |
| Outside both circles | (A ∪ B)' = A' ∩ B' |
| Outside A | A' |
| Outside B | B' |
Algebra of Sets — the Laws
Set operations obey a system of laws exactly parallel to (and in some ways richer than) the algebra of numbers.
Commutative Laws
Union and intersection don't care about order. (But difference does — A − B ≠ B − A.)
Associative Laws
You can write A ∪ B ∪ C without parentheses — it means the same thing either way.
Distributive Laws
The first is analogous to multiplication distributing over addition: a(b+c) = ab+ac. The second has no direct number analogue — in numbers, a + (b×c) ≠ (a+b)×(a+c). But in sets, both forms of distributivity hold.
Proof of first distributive law:
We prove A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) by mutual inclusion.
(⊆) Let x ∈ A ∩ (B ∪ C).
Then x ∈ A and x ∈ B ∪ C.
So x ∈ A, and (x ∈ B or x ∈ C).
Case 1: x ∈ A and x ∈ B → x ∈ A ∩ B → x ∈ (A ∩ B) ∪ (A ∩ C).
Case 2: x ∈ A and x ∈ C → x ∈ A ∩ C → x ∈ (A ∩ B) ∪ (A ∩ C).
In both cases, x ∈ (A ∩ B) ∪ (A ∩ C). ✓
(⊇) Let x ∈ (A ∩ B) ∪ (A ∩ C).
Then x ∈ A ∩ B or x ∈ A ∩ C.
Case 1: x ∈ A ∩ B → x ∈ A and x ∈ B → x ∈ A and x ∈ B ∪ C → x ∈ A ∩ (B ∪ C).
Case 2: x ∈ A ∩ C → x ∈ A and x ∈ C → x ∈ A and x ∈ B ∪ C → x ∈ A ∩ (B ∪ C).
Both cases give x ∈ A ∩ (B ∪ C). ✓
Since both inclusions hold: A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C). □
This proof technique — case analysis on a disjunction, followed by mutual inclusion — is the template for most set theory proofs.
Identity Laws
∅ is the identity for union. U is the identity for intersection.
Idempotent Laws
No "squaring" effect in set algebra.
Null Laws (Domination Laws)
Complement Laws
Absorption Laws
Proof of first: A ∪ (A ∩ B). Since A ∩ B ⊆ A, everything in A ∪ (A ∩ B) is either in A (already) or in A ∩ B (which is inside A anyway). So the union adds nothing to A.
De Morgan's Laws
These are the most important identities for JEE.
De Morgan 1
De Morgan 2
In words:
- "Not in A or B" = "not in A, and not in B"
- "Not in both A and B" = "not in A, or not in B"
Proof of the first De Morgan's law: (A ∪ B)' = A' ∩ B'
(⊆) Let x ∈ (A ∪ B)'. Then x ∉ A ∪ B. So it is not the case that (x ∈ A or x ∈ B). By De Morgan's law of logic: x ∉ A and x ∉ B. So x ∈ A' and x ∈ B'. Therefore x ∈ A' ∩ B'. ✓
(⊇) Let x ∈ A' ∩ B'. Then x ∈ A' and x ∈ B'. So x ∉ A and x ∉ B. Therefore x ∉ A ∪ B. So x ∈ (A ∪ B)'. ✓
Both inclusions hold: (A ∪ B)' = A' ∩ B'. □
The second law follows by replacing A with A' and B with B' in the first, then applying double complement. Prove it yourself — it is a good exercise.
Why De Morgan's matters
It allows you to convert between union and intersection in the complement. This is used constantly in probability theory (P(A ∪ B)ᶜ = P(Aᶜ ∩ Bᶜ)), logic, and JEE problems involving conditions on sets.
De Morgan's for three sets:
More identities for practice
These follow from the above; try proving each by mutual inclusion.
- A − B = A ∩ B'
- A ⊆ B ⟺ A ∩ B' = ∅ ⟺ A' ∪ B = U
- (A − B) ∪ (A ∩ B) = A
- (A − B) ∩ (A ∩ B) = ∅ (the two parts partition A)
- A △ B = (A ∪ B) − (A ∩ B)
- A △ B = (A ∩ B') ∪ (A' ∩ B)
- (A △ B) △ C = A △ (B △ C) — symmetric difference is associative
- n(A △ B) = n(A) + n(B) − 2·n(A ∩ B)
Identity 3 and 4 together say: A − B and A ∩ B are disjoint and their union is A. This is a partition of A — it will matter when we count.
Problems — Set Operations
Class 10–11 level
Problem 1: U = {1, 2, 3, ..., 10}, A = {1, 3, 5, 7, 9}, B = {2, 3, 5, 7}. Find: A ∪ B, A ∩ B, A − B, B − A, A', B', (A ∪ B)', A' ∩ B'.
Solution:
- A ∪ B = {1, 2, 3, 5, 7, 9}
- A ∩ B = {3, 5, 7}
- A − B = {1, 9} (in A, not B)
- B − A = {2} (in B, not A)
- A' = {2, 4, 6, 8, 10}
- B' = {1, 4, 6, 8, 9, 10}
- (A ∪ B)' = {4, 6, 8, 10}
- A' ∩ B' = {2,4,6,8,10} ∩ {1,4,6,8,9,10} = {4, 6, 8, 10} ✓ (De Morgan's confirmed)
Problem 2: If A = {x : x ∈ ℝ, |x − 2| ≤ 3} and B = {x : x ∈ ℝ, x² ≥ 9}, find A ∩ B.
Solution:
|x − 2| ≤ 3 ⟺ −3 ≤ x − 2 ≤ 3 ⟺ −1 ≤ x ≤ 5. So A = [−1, 5].
x² ≥ 9 ⟺ |x| ≥ 3 ⟺ x ≤ −3 or x ≥ 3. So B = (−∞, −3] ∪ [3, ∞).
A ∩ B = [−1, 5] ∩ ((−∞, −3] ∪ [3, ∞))
Intersect [−1, 5] with (−∞, −3]: [−1, 5] ∩ (−∞, −3] = ∅ (since −1 > −3, [−1,5] starts to the right of −3)
Intersect [−1, 5] with [3, ∞): [−1, 5] ∩ [3, ∞) = [3, 5]
A ∩ B = [3, 5]
Problem 3: Verify De Morgan's second law using A = {1,2,3,4} and B = {3,4,5,6} with U = {1,...,10}.
Solution: A ∩ B = {3, 4}. (A ∩ B)' = U − {3,4} = {1,2,5,6,7,8,9,10}.
A' = {5,6,7,8,9,10}, B' = {1,2,7,8,9,10}. A' ∪ B' = {1,2,5,6,7,8,9,10}. ✓ Same as (A ∩ B)'.
JEE Mains level
Problem 4: If A and B are two sets such that n(A) = 70, n(B) = 60, n(A ∪ B) = 110, find n(A ∩ B) and n(A − B) and n(B − A).
Solution: n(A ∩ B) = n(A) + n(B) − n(A ∪ B) = 70 + 60 − 110 = 20
n(A − B): This is A without B, i.e., elements in A but not in A ∩ B. n(A − B) = n(A) − n(A ∩ B) = 70 − 20 = 50
n(B − A) = n(B) − n(A ∩ B) = 60 − 20 = 40
Check: n(A − B) + n(A ∩ B) + n(B − A) = 50 + 20 + 40 = 110 = n(A ∪ B) ✓
Problem 5: In a class of 100 students: 55 passed in Mathematics, 67 passed in Physics, and 45 passed in both. How many passed in exactly one subject? How many passed in neither?
Solution: n(M ∩ P) = 45 n(M ∪ P) = 55 + 67 − 45 = 77
Passed in neither = 100 − 77 = 23
Passed in exactly M only = n(M) − n(M ∩ P) = 55 − 45 = 10 Passed in exactly P only = n(P) − n(M ∩ P) = 67 − 45 = 22 Passed in exactly one = 10 + 22 = 32
Alternatively, exactly one = n(M ∪ P) − n(M ∩ P) = 77 − 45 = 32. ✓
Problem 6: Let A, B, C be three sets. Prove: A − (B ∩ C) = (A − B) ∪ (A − C).
Solution: Using the identity X − Y = X ∩ Y':
LHS = A − (B ∩ C) = A ∩ (B ∩ C)' = A ∩ (B' ∪ C') [De Morgan's] = (A ∩ B') ∪ (A ∩ C') [Distributive] = (A − B) ∪ (A − C) = RHS □
Problem 7: If n(A △ B) = n(A) + n(B) − 2·n(A ∩ B), and n(A) = 20, n(B) = 30, n(A △ B) = 40, find n(A ∩ B).
Solution: 40 = 20 + 30 − 2·n(A ∩ B) 2·n(A ∩ B) = 50 − 40 = 10 n(A ∩ B) = 5
Problem 8 (JEE 2017 type): Let U = {1, 2, 3, ..., 20}. Define A = {x : x is a multiple of 3} and B = {x : x is a multiple of 5}. Find n((A ∪ B)').
Solution: A = {3,6,9,12,15,18} → n(A) = 6 B = {5,10,15,20} → n(B) = 4 A ∩ B = {15} → n(A ∩ B) = 1 n(A ∪ B) = 6 + 4 − 1 = 9 n((A ∪ B)') = n(U) − n(A ∪ B) = 20 − 9 = 11
JEE Advanced level
Problem 9: Let A = {1, 2, 3, ..., n}. How many ordered pairs (X, Y) of subsets of A satisfy X ∩ Y = ∅?
Solution: For each element k ∈ A, there are 3 choices for how k can be distributed among X and Y:
- k ∈ X and k ∉ Y
- k ∉ X and k ∈ Y
- k ∉ X and k ∉ Y
(The fourth option, k ∈ X and k ∈ Y, is ruled out since X ∩ Y = ∅.)
Since choices for each element are independent: total ordered pairs = 3ⁿ.
If we want unordered pairs {X, Y} with X ∩ Y = ∅, the count is (3ⁿ + 1)/2 — but this requires accounting for the symmetric pairs where X = Y = ∅.
Problem 10: Let A = {1, 2, ..., n}. Find the number of ordered pairs (X, Y) with X ⊆ Y ⊆ A.
Solution: For each element k ∈ A, there are 3 positions it can occupy:
- k ∉ Y (so k ∉ X either, since X ⊆ Y)
- k ∈ Y but k ∉ X
- k ∈ X (and therefore in Y, since X ⊆ Y)
Three independent choices per element: total = 3ⁿ.
Interesting: the answer to both Problem 9 and Problem 10 is 3ⁿ. This is not a coincidence — there is a bijection between them. Find it. (Hint: given (X, Y) with X ∩ Y = ∅, consider the pair (X, (A − X − Y)).)
A Note on the Boolean Algebra Structure
The set operations ∪, ∩, ' on subsets of U satisfy:
- Commutativity of both ∪ and ∩
- Associativity of both
- Both distributive laws (each distributes over the other)
- Identity elements (∅ for ∪, U for ∩)
- Complement laws
This structure is called a Boolean algebra. The same axioms govern logical connectives (∨, ∧, ¬) and digital circuits (OR, AND, NOT). Set theory, logic, and circuit design are three manifestations of the same algebra.
This is why De Morgan's laws are called De Morgan's in all three contexts.
Summary of Operations
| Operation | Notation | Definition | Key identities |
|---|---|---|---|
| Union | A ∪ B | x ∈ A or x ∈ B | A ∪ ∅ = A, A ∪ U = U |
| Intersection | A ∩ B | x ∈ A and x ∈ B | A ∩ ∅ = ∅, A ∩ U = A |
| Complement | A' | x ∈ U, x ∉ A | A ∪ A' = U, A ∩ A' = ∅ |
| Difference | A − B | x ∈ A, x ∉ B | A − B = A ∩ B' |
| Sym. diff. | A △ B | In exactly one | (A ∪ B) − (A ∩ B) |
| Law | Statement |
|---|---|
| De Morgan 1 | (A ∪ B)' = A' ∩ B' |
| De Morgan 2 | (A ∩ B)' = A' ∪ B' |
| Distributive | A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) |
| Distributive | A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) |
Next: Counting with Sets — the Inclusion-Exclusion Principle from two sets to n sets, with full JEE-level problem sets.