TITLE: Namesake of Cantor's diagonal argument
QUESTION [9 upvotes]: 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?

REPLY [3 votes]: 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.