Namesake of Cantor's diagonal argument There are two results famously associated with Cantor's celebrated diagonal argument. The first is the proof that the reals are uncountable.

This clearly illustrates the namesake of the diagonal argument in this case. However, I am told that the proof of Cantor's theorem also involves a diagonal argument. Given a set $S$, suppose there exists a bijection $f:S\longrightarrow\ P(S)$ from $S$ to its powerset. The construction of the set
$$B=\{b\in S\mid b\notin f(b)\}$$
is said to be a diagonal argument due to the dual occurrence of $b$ in $b\notin f(b)$. Now I am not exactly sure why this is called a diagonal argument. Is there a geometric representation of this argument like the picture above? Or is it simply an analogy to the first proof using the idea of constructing a witness to show $f$ is not surjective?
 A: Diagonalization is a common method in mathematics. Essentially it means "write it in an infinite matrix and then walk along a coordinate line which approaches infinity on both axes".
The "Cantor diagonal argument" says write the numbers in a matrix, and take the $n$-th number's $n$-th digit, and change it.
The Cantor theorem is a form of diagonalization because what you actually do is write the function in matrix form:
$$\begin{array}{|c|c|c|c|c}
&x_1 & x_2 & x_3 & \ldots\\ \hline
f(x_1)\\ \hline
f(x_2)\\ \hline
f(x_3)\\ \hline
\vdots
\end{array}$$
Now we write $1$ into the blank cells if $x_i\in f(x_j)$, and $0$ otherwise. The proof takes the set of all $x\in X$ such that $x\notin f(x)$, That is walk along the diagonal and take the coordinates which give $0$. This defines a subset of $X$ which is not in the range of $f$, much like the diagonal argument gives a number which is not in the enumeration.

Similar, but different arguments are given when showing the real numbers can be defined as Cauchy sequences of rationals up to some equivalence, and that this is a complete space. We take a Cauchy sequence of Cauchy sequences and we take the $k$-th element of the $k$-th sequence. 
Of course this is not exactly what we do, but it is close enough. We need to toy with $\epsilon-\delta$ and define the diagonal we are going to walk on (for the $k$-th element we want to take some $x^k_j$ for $j$ large enough so and so...)
A: HINT $\ $ To see the analogy, represent subsets by bit-vectors, so the i'th element of the vector is $1$ if the i'th element is in the subset, and 0 if not. Then the rows of the matrix are the bit-vectors of the subsets, and said powerset diagonalization corresponds simply to complementing the diagonal bits in the bit-matrix.
Ignoring ordering, it boils down to the very simple fact that when we have at least as many "components" (indexes) as "objects" (vectors) then we can always construct a different object simply by making sure that it differs from each object in at least one component. Introducing an ordering simply provides a vivid way to visualize this construction, by placing the changed components along the diagonal. 
A: If the first 'diagonalization' you exhibited is over the alphabet $\{0,1\}$ and $S=\mathbb{N}$ in the second 'diagonalization', then the arguments are the same. To see this, note that every real number in $[0,1]$ corresponds to a set of natural numbers when viewed as a characteristic function of that set. The (characteristic function of the) set $B$ is then exactly the new real number generated in the first diagonal argument. You should work the details out yourself.
A: The proof of the first result you give mentions
the 1st digit of the 1st number, and
the 2nd digit of the 2nd number, and
the 3rd digit of the 3rd number, and
the 4th ditit of the 4th number, and
........ etc.  You see the "dual occurrence" of something here.  You also see that the first digit of the first number is not the same as the first digit of the number you're constructing, and the second digit of the second number is not the same as the second digit of the number you're constructing and so on.  The same thing happens with the second proof.
