In my math class, we had an exercise asking us to prove that the following set is not countable: $$\prod \limits^\infty_{i=1} \{0,1\} = \{0,1\} \times \{0,1\} \times \{0,1\} \times \cdots$$ By Cantor's diagonalization argument, we can show that $$f : \mathbb{N} \to \prod \limits^\infty_{i=1} \{0,1\}$$ defined by $f(n) = (b_{1_n}, b_{2_n}, \cdots)$ is not surjective if we fix some $q = (q_1, q_2, q_3, \cdots) \in \prod \limits^\infty_{i=1} \{0, 1\}$ where $$q_i = \begin{cases} 1 & \operatorname{if} ~ b_{i_i} = 0 \\ 0 & \operatorname{if} ~ b_{i_i} = 1 \end{cases}$$ (i.e., the $n$th element of $q$ is opposite of the $n$th element of $f(n)$), which would mean that $x \neq f(n)$ for all $n \in \mathbb{N}$ and $\prod \limits^\infty_{i=1} \{0, 1\}$ is uncountable.
However, it seems possible to define a bijection for $f: \mathbb{N} \to \prod \limits^\infty_{i=1} \{0, 1\}$ if we define $f(n)$ to be an ordered tuple representing the coefficients of the binary expansion of $n -1$. For example: $$ 0 = 0 \cdot 2^0 + 0 \cdot 2^1 + 0 \cdot 2^2 + \cdots \\ 1 = 1 \cdot 2^0 + 0 \cdot 2^1 + 0 \cdot 2^2 + \cdots \\ 2 = 0 \cdot 2^0 + 1 \cdot 2^1 + 0 \cdot 2^2 + \cdots \\ 3 = 1 \cdot 2^0 + 1 \cdot 2^1 + 0 \cdot 2^2 + \cdots \\ n = a_{n_0} \cdot 2^0 + a_{n_1} \cdot 2^1 + a_{n_2} \cdot 2^2 + \cdots $$ So then we could define $f: \mathbb{N} \to \prod \limits^\infty_{i=1} \{0,1\}$ by $$f(k) = (a_{k-1_0}, a_{k-1_1}, a_{k-1_2}, \cdots)$$ which would give us $$ f(1) = (0, 0, 0, \cdots) \quad \text{(the coefficients of the binary expansion of 0)}\\ f(2) = (1, 0, 0, \cdots) \quad \text{(the coefficients of the binary expansion of 1)} \\ f(3) = (0, 1, 0, \cdots) \quad \text{(the coefficients of the binary expansion of 2)} \\ f(4) = (1, 1, 0, \cdots) \quad \text{(the coefficients of the binary expansion of 3)} \\ f(n + 1) = (a_{n_0}, a_{n_1}, a_{n_2}, \cdots) \quad \text{(the coefficients of the binary expansion of n)} $$ (Note: I use $k$ and $k - 1$ to preserve the domain of $\mathbb{N}$, but it is trivial to prove that $|\mathbb{N} \cup \{0\}| = |\mathbb{N}|$. Also, assume that more significant coefficients omitted by the ellipses are an infinite number of zeros.)
In my mind, $f$ would be injective because every $n \in \mathbb{N}$ would have a unique binary expansion comprised of only 0s and 1s as coefficients (hence, the basis for the base-2 number system working), and $f$ would be surjective because we can turn a tuple of coefficients back into a base-10 integer. (i.e., $(b_0, b_1, b_2, \cdots)$ would translate directly to ${\dots b_2 b_1 b_0}_2 = n = k - 1$.) Thus we've established a bijection that allows us to conclude that $|\mathbb{N}| = |\prod \limits^\infty_{i=1} \{0, 1\}|$, making it countable.
Would this disprove Cantor's diagonalization argument for this instance, or are there flaws to the binary expansion argument?
Reference: Doud, Darrin, and Pace P. Nielsen. “Exercise 30.6.” A Transition to Advanced Mathematics, Provo, Utah, 2022, p. 231.