Set Operations

Union, intersection, complement, difference, and symmetric difference

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.

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

Union & Intersection

Explore union (A ∪ B) and intersection (A ∩ B) by manipulating sets and watching the results update in real time.

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).

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

Visualize set complement (Aᶜ), set difference (A − B), and symmetric difference (A Δ B). See how removing elements creates new sets.

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.

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

Combine multiple set operations into compound expressions and verify algebraic identities like De Morgan's laws.

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

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