Academy
MathsSets Relations FunctionsSet Operations

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.

AB={x:xA{or}xB}A \cup B = \{x : x \in A \text\{ or \} x \in B\}

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.

AB={x:xA{and}xB}A \cap B = \{x : x \in A \text\{ and \} x \in 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.

A={x:xU,xA}A' = \{x : x \in U, x \notin 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.

AB={x:xA,xB}A - B = \{x : x \in A, x \notin B\}

Tip: "A without B" — you start with A and remove anything that also belongs to 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)
Tip: Key asymmetry: A − B ≠ B − A in general. This is unlike union and intersection.

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.

AB=(AB)(BA)=(AB)(AB)A \triangle B = (A - B) \cup (B - A) = (A \cup B) - (A \cap B)

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

RegionSet
Inside A or B or bothA ∪ B
Inside both circlesA ∩ B
Inside A, outside BA − B
Inside B, outside AB − A
Inside exactly oneA △ B
Outside both circles(A ∪ B)' = A' ∩ B'
Outside AA'
Outside BB'

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

AB=BAA \cup B = B \cup A

AB=BAA \cap B = B \cap A

Union and intersection don't care about order. (But difference does — A − B ≠ B − A.)

Associative Laws

A(BC)=(AB)CA \cup (B \cup C) = (A \cup B) \cup C

A(BC)=(AB)CA \cap (B \cap C) = (A \cap B) \cap C

You can write A ∪ B ∪ C without parentheses — it means the same thing either way.

Distributive Laws

A(BC)=(AB)(AC)A \cap (B \cup C) = (A \cap B) \cup (A \cap C)

A(BC)=(AB)(AC)A \cup (B \cap C) = (A \cup B) \cap (A \cup C)

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.

Note: Look at the first one: $$A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$$
> > Read it in plain English: "in A, and in (B or C)." > That means: in A and in B, or in A and in C. > That's exactly (A ∩ B) ∪ (A ∩ C). > The "A" just distributes — exactly like multiplication: a(b + c) = ab + ac. Same move, same reason. > > The second one is the one that feels unnatural: $$A \cup (B \cap C) = (A \cup B) \cap (A \cup C)$$ > > Read it: "in A, or in (both B and C)." > Who satisfies this? Either you're in A — done. Or you're in both B and C simultaneously. > Now check (A ∪ B) ∩ (A ∪ C): "in (A or B), and in (A or C)." > If you're in A, both conditions are satisfied — done. If you're not in A, you need to be in B and in C. Same people.
Tip: The anchor is: $\cap$ distributes over $\cup$, and $\cup$ distributes over $\cap$. Both ways.
> > Unlike numbers where only × distributes over +. > That asymmetry with numbers is exactly why it feels wrong — you're expecting one-way distribution. In sets, both directions work because $\cup$ and $\cap$ are symmetric operations.

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.

Note: (⊆) and (⊇) are shorthand labels for the two halves of a mutual inclusion proof. Recall the standard technique: to prove two sets are equal, you prove each is a subset of the other.
> > (⊆) means: we are proving the left side ⊆ right side. So we pick an arbitrary x from the left side and show it must be in the right side. > > (⊇) means: we are proving the right side ⊆ left side. So we pick an arbitrary x from the right side and show it must be in the left side. > > Together they establish equality. The symbols are just bookmarks — telling you which direction of containment is currently being proved.

Identity Laws

A=AAU=AA \cup \emptyset = A \qquad A \cap U = A

∅ is the identity for union. U is the identity for intersection.

Note: The word identity itself comes from Latin idem — same. The identity element is the one that keeps everything the same.
> > In arithmetic: > > - 0 is the identity for addition: a + 0 = a > - 1 is the identity for multiplication: a × 1 = a > > In sets: > > - ∅ is the identity for ∪: A ∪ ∅ = A (adding nothing changes nothing) > - U is the identity for ∩: A ∩ U = A (intersecting with everything changes nothing) > > The name "Identity Law" just says: here is the element that has no effect. It preserves the identity of whatever you combine it with.

Idempotent Laws

AA=AAA=AA \cup A = A \qquad A \cap A = A

No "squaring" effect in set algebra.

Note: From Latin: _idem_ (same) + _potere_ (power/force).
> > Literally: "same power" — applying the operation multiple times has the same effect as applying it once. > > A ∪ A = A. Do it again: (A ∪ A) ∪ A = A. Forever. The operation doesn't _do_ anything new when you repeat it on the same input. > > In programming you see the same word — an idempotent API call is one where hitting the endpoint 10 times has the same effect as hitting it once. DELETE /resource is idempotent. The resource is gone after the first call; subsequent calls change nothing. > > Same idea, same word, same Latin root.

Null Laws (Domination Laws)

A=AU=UA \cap \emptyset = \emptyset \qquad A \cup U = U

Complement Laws

AA=UA \cup A' = U

AA=A \cap A' = \emptyset

(A)=A(A')' = A

=U\emptyset' = U

U=U' = \emptyset

Absorption Laws

A(AB)=AA \cup (A \cap B) = A

A(AB)=AA \cap (A \cup B) = A

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

(AB)=AB(A \cup B)' = A' \cap B'

De Morgan 2

(AB)=AB(A \cap B)' = A' \cup B'

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: (ABC)=ABC(A \cup B \cup C)' = A' \cap B' \cap C' (ABC)=ABC(A \cap B \cap C)' = A' \cup B' \cup C'


More identities for practice

These follow from the above; try proving each by mutual inclusion.

  1. A − B = A ∩ B'
  2. A ⊆ B ⟺ A ∩ B' = ∅ ⟺ A' ∪ B = U
  3. (A − B) ∪ (A ∩ B) = A
  4. (A − B) ∩ (A ∩ B) = ∅ (the two parts partition A)
  5. A △ B = (A ∪ B) − (A ∩ B)
  6. A △ B = (A ∩ B') ∪ (A' ∩ B)
  7. (A △ B) △ C = A △ (B △ C) — symmetric difference is associative
  8. 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:

  1. k ∈ X and k ∉ Y
  2. k ∉ X and k ∈ Y
  3. 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:

  1. k ∉ Y (so k ∉ X either, since X ⊆ Y)
  2. k ∈ Y but k ∉ X
  3. 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

OperationNotationDefinitionKey identities
UnionA ∪ Bx ∈ A or x ∈ BA ∪ ∅ = A, A ∪ U = U
IntersectionA ∩ Bx ∈ A and x ∈ BA ∩ ∅ = ∅, A ∩ U = A
ComplementA'x ∈ U, x ∉ AA ∪ A' = U, A ∩ A' = ∅
DifferenceA − Bx ∈ A, x ∉ BA − B = A ∩ B'
Sym. diff.A △ BIn exactly one(A ∪ B) − (A ∩ B)
LawStatement
De Morgan 1(A ∪ B)' = A' ∩ B'
De Morgan 2(A ∩ B)' = A' ∪ B'
DistributiveA ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
DistributiveA ∪ (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.