Cardinality & Counting

Power sets, inclusion-exclusion, and comparing set sizes

Cardinality & Counting

The cardinality of a set measures its size -- the number of elements it contains. For finite sets this is simply counting, but the concept extends far beyond: power sets grow exponentially, inclusion-exclusion handles overlaps, and bijections let us compare sizes without counting at all.

These counting principles are the bridge between set theory and combinatorics, and they lay the groundwork for understanding infinite cardinalities.

Power Set Explorer

Build the power set P(S) -- the set of all subsets of S. Watch how the number of subsets doubles with each new element.

Power Set Generator

Explore all subsets of a set, organized by size

S = {a, b, c}
|P(S)| = 2^|S| = 2^3 = 8 subsets
0 elements -- C(3,0) = 1 subset
{}
1 element -- C(3,1) = 3 subsets
{a}
{b}
{c}
2 elements -- C(3,2) = 3 subsets
{a, b}
{a, c}
{b, c}
3 elements -- C(3,3) = 1 subset
{a, b, c}

Key insight: The power set of an n-element set has exactly 2ⁿ elements. Each element is either in a subset or not, giving 2 choices per element. This exponential growth is why |P(S)| > |S| always -- even for infinite sets.

Inclusion-Exclusion Principle

Count the elements in a union of overlapping sets by adding, subtracting, and correcting for overcounting.

Inclusion-Exclusion Principle

Watch how alternating addition and subtraction gives the correct count

AB
Step 0/3
Start: 0

|A union B| = |A| + |B| - |A intersection B|

Key insight: |A ∪ B| = |A| + |B| − |A ∩ B|. Without subtracting the intersection, elements in both sets get counted twice. For three or more sets, the pattern alternates: add singles, subtract pairs, add triples, and so on.

Cardinality Comparison

Compare the sizes of sets by constructing bijections. Two sets have the same cardinality if and only if a bijection exists between them.

Cardinality Comparison

Build a bijection between sets to compare their cardinalities

{1, 2, 3} and {a, b, c} -- different elements, same cardinality

Click an element in Set A, then click an element in Set B to create a mapping. Click a mapped element in A to remove its mapping.
Set A (|A| = 3)
Set B (|B| = 3)

Key insight: A bijection between two sets proves they have the same size, even when you cannot count the elements. This idea becomes essential for infinite sets, where "counting" breaks down entirely.

Key Takeaways

  • |P(S)| = 2ⁿ -- the power set always has exponentially more elements than the original set
  • Inclusion-exclusion -- the systematic way to count elements in unions of overlapping sets
  • Bijections prove equal cardinality -- a perfect pairing means two sets are the same size
  • From finite to infinite -- these principles generalize to measure the sizes of infinite sets