• Foundation
  • About 14 min
  • 5 practice questions

Union, intersection, difference and complement

Combine sets with union, intersection, difference and complement, picture them in Venn diagrams and use De Morgan's laws.

If something looks wrong, please tell us.

Sets become useful when we combine them. Four operations, union, intersection, difference and complement, let you describe 'students who play cricket or football', 'numbers that are even and prime' or 'members who are not graduates'. This lesson defines each one, shows how it looks in a Venn diagram and works through examples element by element, so that the counting formulas in the next lesson have a firm base.

Venn diagrams

A Venn diagram draws the universal set U as a rectangle and each set inside it as a circle. Where two circles overlap, the elements belong to both sets. Shading the right region is a quick way to see what an operation produces and to check an answer before writing it down.

The four operations

The union A ∪ B is the set of elements in A or in B or in both: {x : x ∈ A or x ∈ B}. In a Venn diagram it is everything inside either circle. The intersection A ∩ B is the set of elements in both A and B: {x : x ∈ A and x ∈ B}, the overlap of the circles. If A ∩ B = ∅, the sets are called disjoint: the circles do not overlap.

The difference A − B is the set of elements of A that are not in B: {x : x ∈ A and x ∉ B}. It is the part of circle A outside circle B. Order matters: A − B and B − A are usually different. The complement of A, written A', is the set of elements of U that are not in A, so A' = U − A. It is everything inside the rectangle but outside circle A.

The four set operations
OperationSymbolIn words
UnionA ∪ Bin A or B or both
IntersectionA ∩ Bin both A and B
DifferenceA − Bin A but not in B
ComplementA'in U but not in A

Laws that always hold

  • Commutative: A ∪ B = B ∪ A and A ∩ B = B ∩ A.
  • Associative: (A ∪ B) ∪ C = A ∪ (B ∪ C), and the same for ∩.
  • Identity: A ∪ ∅ = A and A ∩ U = A.
  • Complement: A ∪ A' = U, A ∩ A' = ∅ and (A')' = A.
  • Difference: A − B = A ∩ B'.
  • De Morgan's laws: (A ∪ B)' = A' ∩ B' and (A ∩ B)' = A' ∪ B'.

De Morgan's laws say that taking a complement swaps union and intersection. In words: not being in 'A or B' means being outside A and outside B; not being in 'A and B' means being outside at least one of them.

Worked example 1: the four operations

Let A = {1, 2, 3, 4, 5} and B = {4, 5, 6, 7}. Union: put in every element from either set once, A ∪ B = {1, 2, 3, 4, 5, 6, 7}. Intersection: only 4 and 5 are in both, so A ∩ B = {4, 5}. Difference: from A remove 4 and 5, so A − B = {1, 2, 3}; from B remove 4 and 5, so B − A = {6, 7}. Notice that A − B, A ∩ B and B − A do not overlap and together make up A ∪ B.

Worked example 2: checking De Morgan's law

Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, A = {2, 4, 6, 8, 10} and B = {1, 2, 3, 4}. Then A ∪ B = {1, 2, 3, 4, 6, 8, 10}, so (A ∪ B)' = {5, 7, 9}. Now work the other side. A' = {1, 3, 5, 7, 9} and B' = {5, 6, 7, 8, 9, 10}. Their common elements are 5, 7 and 9, so A' ∩ B' = {5, 7, 9}. Both sides agree, as De Morgan's law promises. Checking a law on a small example like this is a reliable way to remember which way it goes.

Complement swaps the operation: (A ∪ B)' = A' ∩ B' and (A ∩ B)' = A' ∪ B'. A difference is an intersection with a complement: A − B = A ∩ B'.

— Rule to remember

Key takeaways

Union collects, intersection keeps what is shared, difference removes, and complement takes everything outside within U. Disjoint sets have an empty intersection. A − B is not the same as B − A. When unsure of an identity, test it on small sets and shade a Venn diagram; both take less than a minute and catch most mistakes.

Check your understanding

  1. 1. If A = {2, 4, 6, 8} and B = {6, 8, 10}, what is A ∩ B?

    1. {6, 8}
    2. {2, 4, 6, 8, 10}
    3. {2, 4}
    4. {10}
    Show answer

    Answer: A. The intersection keeps elements in both sets: only 6 and 8 are common.

  2. 2. For A = {2, 4, 6, 8} and B = {6, 8, 10}, what is A − B?

    1. {10}
    2. {6, 8}
    3. {2, 4, 10}
    4. {2, 4}
    Show answer

    Answer: D. A − B keeps the elements of A that are not in B. Removing 6 and 8 from A leaves {2, 4}.

  3. 3. Let U = {1, 2, 3, 4, 5, 6, 7, 8} and A = {1, 3, 5, 7}. What is A'?

    1. {1, 3, 5, 7}
    2. {1, 2, 3, 4, 5, 6, 7, 8}
    3. ∅
    4. {2, 4, 6, 8}
    Show answer

    Answer: D. A' contains the elements of U that are not in A: 2, 4, 6 and 8.

  4. 4. By De Morgan's law, (A ∪ B)' is equal to which set?

    1. A' ∪ B'
    2. A ∩ B
    3. A' ∩ B'
    4. A' ∪ B
    Show answer

    Answer: C. Taking the complement of a union gives the intersection of the complements: (A ∪ B)' = A' ∩ B'.

  5. 5. Let A = {1, 3, 5}, B = {2, 4, 6} and C = {3, 6, 9}. Which pair of sets is disjoint?

    1. A and C
    2. B and C
    3. Every pair
    4. A and B
    Show answer

    Answer: D. A ∩ B = ∅, so A and B are disjoint. A and C share 3, and B and C share 6.

Sign in to keep track of the lessons you finish.

Next lesson → Counting with Venn diagrams

Privacy · Terms · Refunds · Delivery