Set Operations

Union, intersection, complement, difference, and symmetric difference

Set Operations

Arithmetic combines numbers; set operations combine sets. Join two sets, find what they share, or carve out what one has and the other lacks.

Union & Intersection

Choose a pair of sets, then switch between union (A ∪ B) and intersection (A ∩ B). Watch which elements light up in each case.

Union and Intersection

Select an operation and see which regions of the Venn diagram are highlighted.

AB123456

A ∪ B =

{ 1, 2, 3, 4, 5, 6 }

All elements that are in A or B (or both).

Go deeper:Set Operations

Just as arithmetic gives us ways to combine numbers, set operations give us ways to combine sets. Union brings sets together, intersection finds what they share, and complement identifies what lies outside.

Key insight: Union collects everything from both sets (logical OR), while intersection keeps only what they share (logical AND). These two operations are duals of each other under De Morgan's laws.

Complement & Difference

Click elements in and out of A and B, then switch between complement (Aᶜ), difference, and symmetric difference (A Δ B) to see what each one keeps.

Complement, Difference, Symmetric Difference

Choose an operation and see the highlighted region on the Venn diagram. Modify sets A and B below.

U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}AB12345678910

A = {1, 2, 3, 4, 5}

B = {3, 4, 5, 6, 7}

Aᶜ =

{ 6, 7, 8, 9, 10 }

All elements in U but not in A.

Go deeper:Complement & Difference

Key insight: The complement of A contains everything in the universal set that is not in A. The symmetric difference A Δ B contains elements in exactly one of the two sets -- it is the "exclusive or" of set theory.

Set Operations Calculator

Pick a preset pair or type your own sets, choose an operation, and turn on step-by-step mode to watch the result build one element at a time.

Set Operations Calculator

Choose two sets, pick an operation, and see the result. Toggle step-by-step mode for explanations.

A ∪ B =

{ 1, 2, 3, 4 }

|A ∪ B| = 4

ElementIn AIn BIn Result
1YNY
2YYY
3YYY
4NYY
Go deeper:Set Operations Calculator

These operations obey elegant algebraic laws -- commutativity, associativity, distributivity, and De Morgan's laws -- that mirror (and generalize) the rules of Boolean logic.

Key insight: De Morgan's laws state that (A ∪ B)ᶜ = Aᶜ ∩ Bᶜ and (A ∩ B)ᶜ = Aᶜ ∪ Bᶜ. These laws connect union, intersection, and complement in a beautiful symmetry.

Key Takeaways

  • Union and intersection -- the fundamental ways to combine sets, analogous to OR and AND
  • Complement and difference -- removing elements to carve out new sets
  • De Morgan's laws -- complement swaps union and intersection, linking all three operations
  • Algebraic structure -- set operations satisfy commutativity, associativity, and distributivity

Spot a mistake or have an idea?

Search