Search Knowledge

© 2026 LIBREUNI PROJECT

Cardinality and Infinite Sets

Cardinality and Infinite Sets

Cardinality is a measure of the “number of elements” of a set. For finite sets, this is just a natural number, but for infinite sets, things become more complex.

Equinumerosity

Two sets AA and BB have the same cardinality, A=B|A| = |B|, if there exists a bijection f:ABf: A \to B.

A set is countably infinite if it has the same cardinality as the natural numbers N\mathbb{N}. Surprisingly, the set of rational numbers Q\mathbb{Q} is countable, while the set of real numbers R\mathbb{R} is not.

python
1def count_to_infinity(limit):
2 # Demonstrating that Even numbers are equinumerous to Natural numbers
3 # f(n) = 2n
4 evens = [(n, 2*n) for n in range(limit)]
5 return evens
6 
7print("Mapping N to Evens (First 5):")
8for pair in count_to_infinity(5):
9 print(f"n={pair[0]} maps to even={pair[1]}")

Cantor’s Diagonal Argument

Georg Cantor proved that the cardinality of the real numbers (the Continuum, c\mathfrak{c}) is strictly greater than the cardinality of the natural numbers (0\aleph_0). He used a technique called diagonalization.

python
1import random
2 
3def cantors_diagonal(rows):
4 """Given a list of decimal expansions, create a number that isn't in the list."""
5 new_number = "0."
6 for i in range(len(rows)):
7 # Take the i-th digit of the i-th row and change it
8 digit = int(rows[i][i+2]) # offset for "0."
9 new_digit = (digit + 1) % 10
10 new_number += str(new_digit)
11 return new_number
12 
13sequences = ["0.12345", "0.55555", "0.98765", "0.11111", "0.00000"]
14print(f"Generated number not in list: {cantors_diagonal(sequences)}")

What is the result of the union of two countably infinite sets?

Cantor’s Theorem

Cantor’s Theorem states that for any set AA, the cardinality of its power set P(A)\mathcal{P}(A) is strictly greater than the cardinality of AA: A<P(A)|A| < |\mathcal{P}(A)| This results in an infinite hierarchy of infinities: 0,1,2,\aleph_0, \aleph_1, \aleph_2, \dots

Does there exist a set with cardinality between integers and real numbers?

Previous Module Axiomatic Systems
Next Module Category Theory