Tutorials › Topology (Undergraduate) › Choosing a Cardinality Proof for Standard Sets

Countability and Cardinality · Tutorial 34 of 799

Choosing a Cardinality Proof for Standard Sets

Learn to match a cardinality question with an enumeration, an injection, or a diagonal proof, and see why these methods work on familiar sets.

Intermediate 11 min read

What You'll Learn

  • Decide when an enumeration or an injection is the most efficient countability proof.
  • Prove that a finite union of countable sets is countable.
  • Encode pairs of natural numbers and apply the method to products.
  • Use reduced numerator-denominator representations to prove the rationals countable.
  • Prove that real intervals are uncountable by a decimal diagonal argument.
  • Avoid the ambiguity caused by decimal expansions that end in repeating nines.

Choose the Proof to Fit the Set

Cardinality questions about familiar sets call for different proof strategies. To show that a set is countable, one can often give an enumeration or inject it into \(\mathbb{N}\). For products, a pairing function turns two indices into one. For real intervals, however, an attempted list is exactly what a diagonal argument defeats. The aim here is to choose a method that matches the structure of the set, then check that the method actually proves the claim.

Definition: A set is countable if it is finite or admits an injection into \(\mathbb{N}\). It is countably infinite if it is in bijection with \(\mathbb{N}\). A set is uncountable if it is not countable. An enumeration of a set is a sequence whose terms include every element of that set; terms may repeat unless the enumeration is explicitly required to be one-to-one.

For a countable set, choose the simplest route available. An explicit enumeration is useful when the elements have a natural order. An injection into \(\mathbb{N}\) is often cleaner when each element has a finite code. If a set is a product, encode its coordinates as a pair of natural-number indices. To prove uncountability, a diagonal construction is useful when a proposed enumeration would give each object a sequence of entries, such as decimal digits.

Shape of the setUseful strategy
A finite union of countable setsAssign each element to one component and record its index and component.
A product of countable setsEncode coordinate indices with a pairing function.
Fractions or other finite descriptionsChoose a canonical representation and encode its entries.
Infinite digit strings or real numbersAssume a list exists, then construct an object differing from its \(n\)th entry in position \(n\).

Finite Unions and Products

Proposition: The union of two countable sets is countable. More generally, a finite union of countable sets is countable.

Proof. Let \(A\) and \(B\) be countable. By the definition of countability, choose injections \(i_A:A\to\mathbb{N}\) and \(i_B:B\to\mathbb{N}\); if one of the sets is empty, its injection is the empty function. Define a function from \(A\cup B\) to \(\mathbb{N}\times\{1,2\}\) by sending \(x\in A\) to \((i_A(x),1)\), and sending \(x\in B\setminus A\) to \((i_B(x),2)\). This function is injective: elements assigned different second coordinates have different images, while elements assigned the same second coordinate have different first coordinates because the relevant \(i_A\) or \(i_B\) is injective. The finite-product result for countable sets, established in the earlier material on finite products, says \(\mathbb{N}\times\{1,2\}\) is countable. Thus \(A\cup B\) injects into a countable set and is countable. Repeating this argument proves the finite-union statement; the empty union is empty and hence countable. \(\square\)

For products, the key device is a pairing function: a bijection from \(\mathbb{N}\times\mathbb{N}\) to \(\mathbb{N}\). One standard choice, with \(\mathbb{N}=\{1,2,\dots\}\), lists pairs by diagonals:

$$ \pi(m,n)=\frac{(m+n-2)(m+n-1)}{2}+m. $$

The earlier result on pairing natural numbers establishes that this formula gives a bijection. Its purpose is to turn two indices into one without losing the ability to distinguish pairs. If \(A\) and \(B\) inject into \(\mathbb{N}\), compose their coordinate injections with \(\pi\); the resulting map \(A\times B\to\mathbb{N}\) is injective. The same reasoning, applied repeatedly, handles any finite product of countable sets.

Worked Example: A Pair of Natural-Number Indices

Encode the pair \((4,3)\) and recover it from its code. Here \(m=4\), \(n=3\), so \(m+n-2=5\) and \(m+n-1=6\). Therefore

$$ \pi(4,3)=\frac{5\cdot6}{2}+4=15+4=19. $$

To check the code, the diagonal with \(m+n-2=5\) has codes from \(16\) through \(21\): its first code is \(\frac{5\cdot6}{2}+1=16\), and its last is \(\frac{5\cdot6}{2}+6=21\). The code \(19\) is the fourth entry on this diagonal, so \(m=4\); then \(m+n-2=5\) gives \(4+n-2=5\), hence \(n=3\). The recovered pair is the original \((4,3)\).

Check: substituting the recovered indices gives \(\pi(4,3)=19\), as required.

Worked Example: A Finite Union of Countable Sets

Consider \(A=2\mathbb{Z}\) and \(B=2\mathbb{Z}+1\), the even and odd integers. Each is countable because it is the image of the countable set \(\mathbb{Z}\) under an injective map: \(k\mapsto 2k\) for \(A\), and \(k\mapsto 2k+1\) for \(B\). The integers are countable by the earlier enumeration of \(\mathbb{Z}\).

Every integer belongs to exactly one of \(A\) or \(B\). The union proposition therefore shows that \(A\cup B=\mathbb{Z}\) is countable. Concretely, if \(z:\mathbb{N}\to\mathbb{Z}\) is an enumeration, the two lists \(2z(1),2z(2),\dots\) and \(2z(1)+1,2z(2)+1,\dots\) can be interleaved. The first terms of the interleaving are \(2z(1),2z(1)+1,2z(2),2z(2)+1\); every even and every odd integer appears because its corresponding integer index appears in the list \(z\).

Check: any integer \(j\) is even if \(j=2k\) for an integer \(k\), and otherwise is odd, with \(j=2k+1\) for an integer \(k\). Thus this union accounts for every integer, not merely the nonnegative ones.

Fractions: Use a Canonical Code

Theorem: The rational numbers \(\mathbb{Q}\) are countably infinite.

Proof. Every rational number has a unique representation \(p/q\) in lowest terms with \(p\in\mathbb{Z}\), \(q\in\mathbb{N}\), and \(\gcd(|p|,q)=1\). For zero, this representation is \(0/1\). Let \(\iota:\mathbb{Z}\to\mathbb{N}\) be the index map from an enumeration of the integers; it is a bijection. Associate to \(p/q\) the pair \((\iota(p),q)\). Unique reduced representations imply that distinct rationals give distinct pairs. Since \(\mathbb{N}\times\mathbb{N}\) injects into \(\mathbb{N}\) by the pairing function, this gives an injection \(\mathbb{Q}\to\mathbb{N}\), so \(\mathbb{Q}\) is countable. It is infinite because it contains the infinitely many distinct integers. Therefore it is countably infinite. \(\square\)

The requirement that the fraction be reduced matters for the coding argument. For instance, \(1/2\) and \(2/4\) are the same rational number, not two different elements of \(\mathbb{Q}\). A list that includes both is not a one-to-one enumeration, although repetition alone would not prevent a list from covering the set. Canonical representations make the injection argument direct: one rational number has one code, and distinct rational numbers have distinct codes.

Worked Example: Coding a Rational Number

Use the integer enumeration \(0,1,-1,2,-2,3,-3,\dots\), and let \(\iota(p)\) be the position of \(p\) in this list, starting at \(1\). For the rational number \(-3/2\), the fraction is already reduced: \(p=-3\), \(q=2\), and \(\gcd(3,2)=1\). The integer \(-3\) is in position \(7\), so its code pair is \((7,2)\).

For this pair, \(m+n-2=7\), and \(m+n-1=8\). Hence

$$ \pi(7,2)=\frac{7\cdot8}{2}+7=28+7=35. $$

Thus \(-3/2\) receives the natural-number code \(35\). The code need not be small or appear in numerical order; countability requires an injection, not a particularly convenient ranking.

Check: the pair \((7,2)\) recovers the numerator index \(7\) and denominator \(2\), so the associated fraction is \(-3/2\), the number coded in the first place.

Real Intervals: Defeat Every Proposed List

Theorem: The interval \([0,1]\) is uncountable. Consequently, every real interval with distinct endpoints is uncountable.

Proof. Suppose, for contradiction, that \([0,1]\) is countable. Since it is infinite, it could then be listed as \(x_1,x_2,\dots\). For each \(x_n<1\), choose a decimal expansion that is not eventually all \(9\)s; a terminating decimal is written with zeros after its final nonzero digit. Write its \(n\)th decimal digit as \(a_n\). If \(x_n=1\), set \(a_n=0\). Define \(d_n=1\) when \(a_n\ne1\), and \(d_n=2\) when \(a_n=1\). The decimal \(y=0.d_1d_2d_3\dots\) lies in \([0,1]\), since all its digits are \(1\) or \(2\). It is not eventually all \(9\)s, so it is in the chosen unambiguous form. For each \(n\), its \(n\)th digit differs from the \(n\)th digit of \(x_n\) if \(x_n<1\); it also differs from \(x_n=1\), since \(y<1\). Therefore \(y\ne x_n\) for every \(n\), contradicting that the list contains every point of \([0,1]\). Thus \([0,1]\) is uncountable.

Now let \(a<b\). The function \(t\mapsto a+(b-a)t\) is a bijection from \([0,1]\) to \([a,b]\), so \([a,b]\) is uncountable. For the open interval \((a,b)\), the function \(t\mapsto a+(b-a)(1/4+t/2)\) is an injection from \([0,1]\) into \((a,b)\): its values range from \(a+(b-a)/4\) to \(a+3(b-a)/4\), both strictly between \(a\) and \(b\). If \((a,b)\) were countable, this injection would imply \([0,1]\) was countable, which it is not. The same argument applies to intervals with one or both endpoints included, since each contains a nonempty open interval. \(\square\)

Worked Example: An Open Interval Is Uncountable

Consider \((2,6)\). The map \(f:[0,1]\to(2,6)\) defined by \(f(t)=2+4(1/4+t/2)\) is injective because its coefficient of \(t\) is \(2\), which is nonzero. Its endpoint values are \(f(0)=2+4/4=3\) and \(f(1)=2+4(3/4)=5\); as \(t\) ranges over \([0,1]\), \(f(t)\) lies in \([3,5]\), which is contained in \((2,6)\). If \((2,6)\) were countable, the injection \(f\) would make \([0,1]\) countable. This contradicts the diagonal theorem, so \((2,6)\) is uncountable.

Check: the selected values \(3\) and \(5\) satisfy \(2<3\le f(t)\le5<6\), confirming that the map really takes its values inside the open interval.

A Common Pitfall: Decimal Ambiguity

A diagonal proof must account for the fact that some real numbers have two decimal expansions. For example, \(0.5000\dots=0.4999\dots\). A flawed argument might construct \(0.4999\dots\) as a number differing in a chosen digit from a listed expansion \(0.5000\dots\), then claim the new number is absent from the list. That conclusion does not follow: the two decimals represent the same real number.

The correction is to choose the listed expansions so none is eventually all \(9\)s, using trailing zeros for terminating decimals, and to construct the diagonal number with digits only \(1\) and \(2\). The constructed expansion is not eventually all \(9\)s either. Under this convention, distinct digit strings represent distinct reals, so the disagreement at position \(n\) proves that the constructed number is not the \(n\)th listed real. The diagonal argument then establishes a genuine difference in numbers, not just in notation.

Check Your Understanding

For each question, identify whether an enumeration, an injection, a pairing function, or a diagonal argument is the most useful tool.

  1. Why does the union of three countable sets remain countable?
  2. Use the pairing function to compute the code for \((2,5)\).
  3. What feature of reduced fractions ensures that the rational-number coding is injective?
  4. Why does an injection from \([0,1]\) into \((a,b)\), for \(a<b\), show that \((a,b)\) cannot be countable?
  5. Why must the decimal expansions in the diagonal proof be chosen to avoid an eventual tail of \(9\)s?