First theorem colored by polynomial degree. (red = 1, green = 2, blue = 3, yellow = 4). Points become smaller as the integer polynomial coefficients become larger. To prove that the set of real algebraic numbers is countable, define the
height of a
polynomial of
degree n with integer
coefficients as:
n − 1 + |
a0| + |
a1| + ... + |
an|, where
a0,
a1, ...,
an are the coefficients of the polynomial. Order the polynomials by their height, and order the real
roots of polynomials of the same height by numeric order. Since there are only a finite number of roots of polynomials of a given height, these orderings put the real algebraic numbers into a sequence. Cantor went a step further and produced a sequence in which each real algebraic number appears just once. He did this by only using polynomials that are
irreducible over the integers. The following table contains the beginning of Cantor's enumeration.
Second theorem Only the first part of Cantor's second theorem needs to be proved. It states: Given any sequence of real numbers
x1,
x2,
x3, ... and any interval [
a,
b], there is a number in [
a,
b] that is not contained in the given sequence.{{efn-ua|This implies the rest of the theorem—namely, there are infinitely many numbers in [
a,
b] that are not contained in the given sequence. For example, let [0,1] be the interval and consider its
subintervals [0, \tfrac{1}{2}], [\tfrac{3}{4},\tfrac{7}{8}], [\tfrac{15}{16}, \tfrac{31}{32}], \ldots. Since these subintervals are
pairwise disjoint, applying the first part of the theorem to each subinterval produces infinitely many numbers in [0,1] that are not contained in the given sequence. In general, for the interval [a, b], apply the first part of the theorem to the subintervals [a, a + \tfrac{1}{2}(b-a)], [a + \tfrac{3}{4}(b-a), a + \tfrac{7}{8}(b-a)], [a + \tfrac{15}{16}(b-a), a + \tfrac{31}{32}(b-a)], \ldots .}} To find a number in [
a,
b] that is not contained in the given sequence, construct two sequences of real numbers as follows: Find the first two numbers of the given sequence that are in the
open interval (
a,
b). Denote the smaller of these two numbers by
a1 and the larger by
b1. Similarly, find the first two numbers of the given sequence that are in (
a1,
b1). Denote the smaller by
a2 and the larger by
b2. Continuing this procedure generates a sequence of intervals (
a1,
b1), (
a2,
b2), (
a3,
b3), ... such that each interval in the sequence contains all succeeding intervals—that is, it generates a sequence of
nested intervals. This implies that the sequence
a1,
a2,
a3, ... is increasing and the sequence
b1,
b2,
b3, ... is decreasing. Either the number of intervals generated is finite or infinite. If finite, let (
aL,
bL) be the last interval. If infinite, take the
limits
a∞ = lim
n → ∞
an and
b∞ = lim
n → ∞
bn. Since
an n for all
n, either
a∞ =
b∞ or
a∞ ∞. Thus, there are three cases to consider: containing closed interval [
a,
b] that contains nested open intervals (
an,
bn) for
n = 1 to
L. Two distinct numbers
y and one
xn are in (
aL,
bL).|Case 1: Last interval (
aL,
bL) :Case 1: There is a last interval (
aL,
bL). Since at most one
xn can be in this interval, every
y in this interval except
xn (if it exists) is not in the given sequence. File:Cantor's first uncountability proof Case 2 svg.svg|thumb|350px|alt=Illustration of case 2. Real line containing interval [
a,
b] that contains nested intervals (
an,
bn) for
n = 1 to ∞. These intervals converge to
a∞.|Case 2:
a∞ =
b∞ :Case 2:
a∞ =
b∞. Then
a∞ is not in the sequence since for all
n:
a∞ is in the interval (
an,
bn) but
xn does not belong to (
an,
bn). In symbols:
a∞
∈ (
an,
bn) but
xn ∉ (
an,
bn). : File:Cantor's first uncountability proof Case 3 svg.svg|thumb|350px|alt=Illustration of case 3. Real line containing [
a,
b] that contains nested intervals (
an,
bn) for
n = 1 to ∞. These intervals converge to the closed interval [a∞, b∞]. The number y is in this interval.|Case 3:
a∞ ∞ :Case 3:
a∞ ∞. Then every
y in [
a∞,
b∞] is not contained in the given sequence since for all
n:
y belongs to (
an,
bn) but
xn does not. The proof is complete since, in all cases, at least one real number in [
a,
b] has been found that is not contained in the given sequence. Cantor's proofs are constructive and have been used to write a
computer program that generates the digits of a transcendental number. This program applies Cantor's construction to a sequence containing all the real algebraic numbers between 0 and 1. The article that discusses this program gives some of its output, which shows how the construction generates a transcendental.
Example of Cantor's construction An example illustrates how Cantor's construction works. Consider the sequence: , , , , , , , , , ... This sequence is obtained by ordering the
rational numbers in (0, 1) by increasing denominators, ordering those with the same denominator by increasing numerators, and omitting
reducible fractions. The table below shows the first five steps of the construction. The table's first column contains the intervals (
an,
bn). The second column lists the terms visited during the search for the first two terms in (
an,
bn). These two terms are in red. Since the sequence contains all the rational numbers in (0, 1), the construction generates an
irrational number, which turns out to be − 1. == Cantor's 1879 uncountability proof ==