Logic, Sets and Infinity

How to Prove Two Infinite Sets Have the Same Size

Learn four reliable ways to show two infinite sets are equally large, with worked bijections and the two-injections shortcut.

Key takeaways

  • Same cardinality means a bijection exists, and one failed attempt at a bijection proves nothing.
  • Explicit formulas work well for intervals, integers and many simple subsets.
  • The Cantor-Schröder-Bernstein theorem lets you replace one hard bijection with two easy injections.
  • To prove sizes differ, you must show that no bijection can exist, usually with a diagonal argument.

Two sets have the same size, or cardinality, when there is a bijection between them: a pairing that gives every element of each set exactly one partner in the other. To prove that two infinite sets are equally large, you either build such a pairing or use a theorem that guarantees one exists.

This guide gives you the main methods in the order you are likely to try them, with every example worked. You will also see why intuition about "bigger" can mislead.

The definition and why it is the right one

A function is injective if different inputs give different outputs, surjective if it reaches every target, and bijective if both. Write |A| = |B| when a bijection from A to B exists.

For finite sets this agrees with counting. You can tell that a theater has as many people as seats if everyone sits and no seat is empty, without counting either. For infinite sets, pairing is all we have.

The relation behaves like equality: the identity pairs A with itself, an inverse reverses a pairing, and composing two bijections gives a third. So you can chain results.

One warning: a part can match the whole. The map n → 2n pairs the positive integers with the positive even integers. Another map between the same sets, such as n → n restricted to evens, may fail to be a bijection, but that is irrelevant. One success settles the matter.

Method 1: write down a bijection

Start with the natural numbers N = {0, 1, 2, ...} and the integers Z. Define

f(n) = n/2           if n is even
f(n) = −(n + 1)/2    if n is odd

n:     0   1   2   3   4   5
f(n):  0  −1   1  −2   2  −3

To verify, give the inverse: for an integer k ≥ 0 take n = 2k, and for k < 0 take n = −2k − 1. For k = −3 this gives n = 5, matching the table. A function with a two-sided inverse is a bijection, which is often the cleanest check.

For intervals of real numbers, stretching and shifting does the job. The map f(x) = a + (b − a)x pairs the open interval (0, 1) with (a, b) when a < b. So a short segment and a long one have exactly as many points.

Method 2: borrow a familiar function

Calculus supplies many ready-made bijections.

From To Map
All real numbers Positive reals eˣ
(0, 1) (1, ∞) 1/x
(−π/2, π/2) All real numbers tan x
(0, 1) All real numbers tan(π(x − 1/2))

For the last row, x → π(x − 1/2) stretches (0, 1) onto (−π/2, π/2), with angles in radians, and tangent then covers the line once. So the interval of length 1 has as many points as the whole real line.

You can justify each with monotonicity and limits: a continuous, strictly increasing function whose values approach the two ends of a target interval, without reaching them, is a bijection onto that interval.

Method 3: shift a sequence to absorb extra points

How do you pair the closed interval [0, 1] with the open interval (0, 1)? There are two endpoints too many, and no continuous bijection exists. The trick is to hide them in an infinite sequence, much as a new guest is absorbed into a full hotel.

f(0)   = 1/2
f(1)   = 1/3
f(1/n) = 1/(n + 2)     for whole numbers n ≥ 2
f(x)   = x             for every other x

Follow the sequence 0, 1, 1/2, 1/3, 1/4, ... . It is sent to 1/2, 1/3, 1/4, 1/5, 1/6, ... , which is the same sequence with its first two terms removed. Every point of (0, 1) is hit exactly once. This is the room-shifting idea of Hilbert's Hotel applied inside an interval.

The same trick shows that the irrational numbers have the same cardinality as all the real numbers. Pick an infinite sequence of distinct irrationals, such as √2, 2√2, 3√2 and so on. List the rationals as q₁, q₂, q₃, and so on. Now fold the two lists into the sequence: send qₙ to the (2n − 1)th irrational in it, send its nth term to its (2n)th term, and leave every other real number where it is.

Choosing a proof method
1 Try a formula Look for a direct two-way pairing 2 Borrow a function Stretches, exponentials and tangent 3 Absorb extras Shift a sequence to hide spare points 4 Use two injections Apply Cantor-Schröder- Bernstein Try a formula Look for a direct two-way pairing 1 Borrow a function Stretches, exponentials and tangent 2 Absorb extras Shift a sequence to hide spare points 3 Use two injections Apply Cantor-Schröder-Bernstein 4

Method 4: two injections

The Cantor-Schröder-Bernstein theorem says: if there is an injection from A into B and an injection from B into A, then there is a bijection between A and B. It does not require the axiom of choice.

Redo the interval problem.

  1. The map x → x sends (0, 1) injectively into [0, 1].
  2. The map x → x/2 + 1/4 sends [0, 1] injectively onto [1/4, 3/4], which lies inside (0, 1).
  3. By the theorem, |(0, 1)| = |[0, 1]|.

Two lines replace a delicate piecewise formula.

The idea of the proof is to trace each element backward: to the thing that maps to it, then to the thing that maps to that, and so on. Such a chain either goes on forever, forms a loop, or stops in A or in B. Depending on which, you pair using one injection or the other.

Seeing the two-injections proof work

Take A and B both equal to the natural numbers, with the injections f(n) = 2n from A to B and g(m) = 2m from B to A. A bijection obviously exists here, but the method of proof builds its own.

Trace an element a of A backward. If a is even, it came from a ÷ 2 in B under g. If that number is even, it came from half of it in A under f. Keep halving until you reach an odd number, where the chain stops.

a = 12:  12 (in A) ← 6 (in B) ← 3 (in A)     stops in A
a = 10:  10 (in A) ← 5 (in B)                stops in B
a = 0:   0 ← 0 ← 0 ← ...                     never stops

The rule is: if the chain stops in A, or never stops, pair a with f(a). If it stops in B, pair a with the element of B that g sends to a.

So 12 is paired with 24, 10 is paired with 5, and 0 is paired with 0. Each element of B ends up with exactly one partner, because each chain is split into consecutive couples with no one left out. The general proof is this same bookkeeping done for arbitrary injections.

Countable sets: list or count

To show an infinite set has the same size as N, listing its members without repetition is a bijection in disguise. To show N × N, the set of pairs of natural numbers, is countable, you can use the Cantor pairing function:

π(m, n) = (m + n)(m + n + 1)/2 + n

π(0,0) = 0
π(1,0) = 1     π(0,1) = 2
π(2,0) = 3     π(1,1) = 4     π(0,2) = 5

It walks along the diagonals m + n = 0, 1, 2 and so on. Proving it is a bijection takes a little algebra with triangular numbers. With two injections the argument is quicker: n → (n, 0) goes one way, and (m, n) → 2ᵐ3ⁿ goes the other, injective by unique prime factorization.

Two further facts help. An infinite subset of a countable set is countable. A union of countably many countable sets is countable, a result whose proof uses a weak form of the axiom of choice.

A surprising one: the square and the interval

The open unit square, all points (x, y) with x and y in (0, 1), has the same cardinality as the interval (0, 1).

One injection is easy: x → (x, 1/2). For the other, write x = 0.x₁x₂x₃... and y = 0.y₁y₂y₃..., always choosing the expansion that does not end in endless nines. Interleave:

(x, y)  →  0. x₁ y₁ x₂ y₂ x₃ y₃ ...

The result cannot end in all nines, since that would force both x and y to do so. So you can recover x and y from the odd and even places, and the map is injective. Now apply the two-injections theorem. Cantor reportedly found this result startling, since it seemed to ignore dimension. The pairing is far from continuous, which is why dimension survives in topology.

Chaining results

Once you have a few equalities, you rarely need to start over. Suppose you want to show that [0, 1] has the same cardinality as the set of all real numbers. You already know that [0, 1] pairs with (0, 1), and that (0, 1) pairs with the reals through tangent. Compose the two and you are done.

The same habit gives the plane. The unit square pairs with the interval, as shown above. A tangent map in each coordinate pairs the square with the whole plane, and one tangent map pairs the interval with the line. So the plane has exactly as many points as the line.

Before writing a proof, list the sets you already understand and look for a bridge to one of them. Powers help here too: infinite sequences of 0s and 1s have the same cardinality as the real numbers, a fact best proved with two injections, since binary expansions are doubled in places just as decimal ones are.

Common mistakes

  • Concluding sizes differ because a particular map fails. You need every map to fail.
  • Assuming all infinite sets match. The diagonal argument shows the reals cannot be paired with N.
  • Giving only an injection. That proves |A| ≤ |B|, nothing more.
  • Ignoring double decimal expansions in digit-based constructions.
  • Listing "all of one kind, then all of another" when the first kind is infinite.
Proving equal or unequal
Equal size Give one bijection Or give injections both ways Chain known bijections Unequal size Assume an arbitrary map Construct a missed element Conclude no bijection exists VS Equal size Give one bijection Or give injections both ways Chain known bijections Unequal size Assume an arbitrary map Construct a missed element Conclude no bijection exists

Written for 4Mathematics with AI writing tools and not reviewed line by line by a person. Check anything you rely on against a textbook or primary source. Report an error.

Keep reading

All 41 articles in Logic, Sets and Infinity →

Latest news on this topic