Cantor's diagonal argument
In set theory, Cantor's diagonal argument, also called the diagonalisation argument, the diagonal slash argument or the diagonal method, was published in 1891 by Georg Cantor as a mathematical proof that there are infinite sets which cannot be put into onetoone correspondence with the infinite set of natural numbers.^{[1]}^{[2]}^{[3]} Such sets are now known as uncountable sets, and the size of infinite sets is now treated by the theory of cardinal numbers which Cantor began.
The diagonal argument was not Cantor's first proof of the uncountability of the real numbers; it was actually published much later than his first proof, which appeared in 1874.^{[4]}^{[5]} However, it demonstrates a powerful and general technique that has since been used in a wide range of proofs, also known as diagonal arguments by analogy with the argument used in this proof. The most famous examples are perhaps Russell's paradox, the first of Gödel's incompleteness theorems, and Turing's answer to the Entscheidungsproblem.
Historically, the diagonal argument first appeared in the work of Paul du BoisReymond in 1875.^{[6]}
Contents
Uncountable set
In his 1891 article, Cantor considered the set T of all infinite sequences of binary digits (i.e. consisting only of zeroes and ones). He begins with a constructive proof of the following theorem:
 If s_{1}, s_{2}, … , s_{n}, … is any enumeration of elements from T, then there is always an element s of T which corresponds to no s_{n} in the enumeration.
To prove this, given an enumeration of arbitrary members from T, like e.g.

s_{1} = (0, 0, 0, 0, 0, 0, 0, ...) s_{2} = (1, 1, 1, 1, 1, 1, 1, ...) s_{3} = (0, 1, 0, 1, 0, 1, 0, ...) s_{4} = (1, 0, 1, 0, 1, 0, 1, ...) s_{5} = (1, 1, 0, 1, 0, 1, 1, ...) s_{6} = (0, 0, 1, 1, 0, 1, 1, ...) s_{7} = (1, 0, 0, 0, 1, 0, 0, ...) ...
he constructs the sequence s by choosing its n^{th} digit as complementary to the n^{th} digit of s_{n}, for every n. In the example, this yields:

s_{1} = (0, 0, 0, 0, 0, 0, 0, ...) s_{2} = (1, 1, 1, 1, 1, 1, 1, ...) s_{3} = (0, 1, 0, 1, 0, 1, 0, ...) s_{4} = (1, 0, 1, 0, 1, 0, 1, ...) s_{5} = (1, 1, 0, 1, 0, 1, 1, ...) s_{6} = (0, 0, 1, 1, 0, 1, 1, ...) s_{7} = (1, 0, 0, 0, 1, 0, 0, ...) ... s = (1, 0, 1, 1, 1, 0, 1, ...)
By construction, s differs from each s_{n}, since their n^{th} digits differ (highlighted in the example). Hence, s cannot occur in the enumeration.
Based on this theorem, Cantor then uses an indirect argument to show that:
 The set T is uncountable.
He assumes for contradiction that T was countable. Then (all) its elements could be written as an enumeration s_{1}, s_{2}, … , s_{n}, … . Applying the previous theorem to this enumeration would produce a sequence s not belonging to the enumeration. However, s was an element of T and should therefore be in the enumeration. This contradicts the original assumption, so T must be uncountable.
Interpretation
The interpretation of Cantor's result will depend upon one's view of mathematics. To constructivists, the argument shows no more than that there is no bijection between the natural numbers and T. It does not rule out the possibility that the latter are subcountable. In the context of classical mathematics, this is impossible, and the diagonal argument establishes that, although both sets are infinite, there are actually more infinite sequences of ones and zeros than there are natural numbers.
Real numbers
The uncountability of the real numbers was already established by Cantor's first uncountability proof, but it also follows from the above result. To see this, we will build a onetoone correspondence between the set T of infinite binary strings and a subset of R (the set of real numbers). Since T is uncountable, this subset of R must be uncountable. Hence R is uncountable.
To build this onetoone correspondence (or bijection), observe that the string t = 0111… appears after the binary point in the binary expansion 0.0111…. This suggests defining the function f(t) = 0.t, where t is a string in T. Unfortunately, f(1000…) = 0.1000… = 1/2, and f(0111…) = 0.0111… = 1/4 + 1/8 + 1/16 + … = 1/2. So this function is not a bijection since two strings correspond to one number—a number having two binary expansions.
However, modifying this function produces a bijection from T to the interval (0, 1)—that is, the real numbers > 0 and < 1. The idea is to remove the "problem" elements from T and (0, 1), and handle them separately. From (0, 1), remove the numbers having two binary expansions. Put these numbers in a sequence: a = (1/2, 1/4, 3/4, 1/8, 3/8, 5/8, 7/8, …). From T, remove the strings appearing after the binary point in the binary expansions of 0, 1, and the numbers in sequence a. Put these eventuallyconstant strings in a sequence: b = (000…, 111…, 1000…, 0111…, 01000…, 11000…, 00111…, 10111…, ...). A bijection g(t) from T to (0, 1) is defined by: If t is the n^{th} string in sequence b, let g(t) be the n^{th} number in sequence a; otherwise, let g(t) = 0.t.
To build a bijection from T to R: start with the tangent function tan(x), which provides a bijection from (−π/2, π/2) to R; see right picture. Next observe that the linear function h(x) = πx  π/2 provides a bijection from (0, 1) to (−π/2, π/2); see left picture. The composite function tan(h(x)) = tan(πx  π/2) provides a bijection from (0, 1) to R. Compose this function with g(t) to obtain tan(h(g(t))) = tan(πg(t)  π/2), which is a bijection from T to R. This means that T and R have the same cardinality—this cardinality is called the "cardinality of the continuum."
General sets
A generalized form of the diagonal argument was used by Cantor to prove Cantor's theorem: for every set S the power set of S; that is, the set of all subsets of S (here written as P(S)), has a larger cardinality than S itself. This proof proceeds as follows:
Let f be any function from S to P(S). It suffices to prove f cannot be surjective. That means that some member T of P(S), i.e. some subset of S, is not in the image of f. As a candidate consider the set:
 T = { s ∈ S: s ∉ f(s) }.
For every s in S, either s is in T or not. If s is in T, then by definition of T, s is not in f(s), so T is not equal to f(s). On the other hand, if s is not in T, then by definition of T, s is in f(s), so again T is not equal to f(s); cf. picture. For a more complete account of this proof, see Cantor's theorem.
Consequences
This result implies that the notion of the set of all sets is an inconsistent notion. If S were the set of all sets then P(S) would at the same time be bigger than S and a subset of S.
Russell's Paradox has shown us that naive set theory, based on an unrestricted comprehension scheme, is contradictory. Note that there is a similarity between the construction of T and the set in Russell's paradox. Therefore, depending on how we modify the axiom scheme of comprehension in order to avoid Russell's paradox, arguments such as the nonexistence of a set of all sets may or may not remain valid.
The diagonal argument shows that the set of real numbers is "bigger" than the set of natural numbers (and therefore, the integers and rationals as well). Therefore, we can ask if there is a set whose cardinality is "between" that of the integers and that of the reals. This question leads to the famous continuum hypothesis. Similarly, the question of whether there exists a set whose cardinality is between S and P(S) for some infinite S leads to the generalized continuum hypothesis.
Analogues of the diagonal argument are widely used in mathematics to prove the existence or nonexistence of certain objects. For example, the conventional proof of the unsolvability of the halting problem is essentially a diagonal argument. Also, diagonalization was originally used to show the existence of arbitrarily hard complexity classes and played a key role in early attempts to prove P does not equal NP.
Version for Quine's New Foundations
The above proof fails for W. V. Quine's "New Foundations" set theory (NF). In NF, the naive axiom scheme of comprehension is modified to avoid the paradoxes by introducing a kind of "local" type theory. In this axiom scheme,
 { s ∈ S: s ∉ f(s) }
is not a set — i.e., does not satisfy the axiom scheme. On the other hand, we might try to create a modified diagonal argument by noticing that
 { s ∈ S: s ∉ f({s}) }
is a set in NF. In which case, if P_{1}(S) is the set of oneelement subsets of S and f is a proposed bijection from P_{1}(S) to P(S), one is able to use proof by contradiction to prove that P_{1}(S) < P(S).
The proof follows by the fact that if f were indeed a map onto P(S), then we could find r in S, such that f({r}) coincides with the modified diagonal set, above. We would conclude that if r is not in f({r}), then r is in f({r}) and vice versa.
It is not possible to put P_{1}(S) in a onetoone relation with S, as the two have different types, and so any function so defined would violate the typing rules for the comprehension scheme.
See also
References
 ↑ Georg Cantor (1892). "Ueber eine elementare Frage der Mannigfaltigkeitslehre". Jahresbericht der Deutschen MathematikerVereinigung 1890–1891. 1: 75–78 (84–87 in pdf file).<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles> (in german)
 ↑ Keith Simmons (30 July 1993). Universality and the Liar: An Essay on Truth and the Diagonal Argument. Cambridge University Press. pp. 20–. ISBN 9780521430692.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 ↑ Rudin, Walter (1976). Principles of Mathematical Analysis (3rd ed.). New York: McGrawHill. p. 30. ISBN 0070856133.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 ↑ Gray, Robert (1994), "Georg Cantor and Transcendental Numbers" (PDF), American Mathematical Monthly, 101: 819–832, doi:10.2307/2975129<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 ↑ Bloch, Ethan D. (2011). The Real Numbers and Real Analysis. New York: Springer. p. 429. ISBN 9780387721767.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 ↑ Du BoisReymond, Paul (1875), "Über asymptotische Werte, infinitäre Approximationen und infinitäre Auflösungen von Gleichungen", Mathematische Annalen, 8: 363–414, doi:10.1007/bf01443187<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
External links
 Cantor's Diagonal Proof at MathPages
 Weisstein, Eric W., "Cantor Diagonal Method", MathWorld.