Course contentsShow
← Mathematics
Lesson 2526 of 3,12151. Discrete Math — Sets, Relations, FunctionsFree lesson

Set Difference and Complement

Define set difference (A − B) and the complement of a set relative to the universal set.

Set Difference and Complement

What You'll Learn

You'll learn how to precisely describe the elements in one set that aren't in another, both as a general difference and as a complement relative to a universal set.

Set Difference (A − B)

The set difference A − B (read as "A minus B") is the set of all elements that belong to A but do not belong to B.

Formal definition:

A − B = {x : x ∈ A and x ∉ B}

Example: If A = {1, 2, 3, 4, 5} and B = {3, 4, 5, 6, 7}, then:

  • A − B = {1, 2} (elements in A but not in B)
  • B − A = {6, 7} (elements in B but not in A)

Notice that A − B and B − A are generally not the same! Order matters in set difference.

Complement of a Set

The complement of a set A, written as Aᶜ or A', is the set of all elements in the universal set U that are not in A.

Formal definition:

Aᶜ = U − A = {x : x ∈ U and x ∉ A}

Example: If U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} and A = {2, 4, 6, 8, 10}, then:

  • Aᶜ = {1, 3, 5, 7, 9} (the odd numbers in this universe)

Think of the complement as "everything else" within your context. The universal set defines the boundary of "everything possible."

Analogy

Think of the universal set as a bookshelf containing all your books. If set A contains all fiction books, then Aᶜ contains all the non-fiction books on that shelf. If B contains mystery novels, then A − B contains fiction books that aren't mysteries.

Key Takeaway: Set difference A − B removes B's elements from A; the complement Aᶜ removes A's elements from the entire universal set U.