Cardinality and Countability
305 words
2 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# Cardinality and Countability ## 9.1 Comparing Sizes Sets $A$ and $B$ have the **same cardinality** ($|A| = |B|$) if there exists a bijection $f: A \to B$. $|A| \leq |B|$ if there exists an injection $f: A \to B$.

Cardinality and Countability
9.1 Comparing Sizes
Sets A and B have the same cardinality (∣A∣=∣B∣) if there exists a bijection f:A→B.
∣A∣≤∣B∣ if there exists an injection f:A→B.
9.2 Countable Sets
A set is countable if it is finite or has the same cardinality as N.
Examples of countable sets:
- Z — map n→2n (positive) and n→−(2n+1) (negative)
- Q — diagonal enumeration of fractions
- N×N — use Cantor pairing function π(m,n)=2(m+n)(m+n+1)+n
Countable Union Theorem
A countable union of countable sets is countable.
9.3 Uncountable Sets
R is uncountable — there is no bijection with N.
Cantor's Diagonal Argument
Assume f:N→R is a bijection. List all real numbers in (0,1):
f(1)=0.a11a12a13… f(2)=0.a21a22a23… f(3)=0.a31a32a33…
Construct b=0.b1b2b3… where bi=aii (e.g., bi=5 if aii=5, bi=6 if aii=5).
Then b differs from every f(i) at the i-th decimal place, so b is not in the list. Contradiction. □
9.4 Schröder-Bernstein Theorem
If ∣A∣≤∣B∣ and ∣B∣≤∣A∣, then ∣A∣=∣B∣.
✅ Practice Questions
Q1: Show [0,1] and (0,1) have the same cardinality.
SolutionConstruct a bijection: Map 0→21, 21→31, 31→41, etc., and map all other points to themselves. This is a bijection between [0,1] and (0,1). Q2: Is the set of all infinite binary sequences countable? SolutionNo. By diagonal argument: assume countable, list them, flip the i-th bit of the i-th sequence. The resulting sequence is not in the list. So uncountable. Join Discord PreviousAdvanced Logic & InductionNextUncountable Sets