TITLE: Justifying $\sum_{n=0}^\infty\log(1+x^{2^n}) = -\log(1-x)$ for $0\le x<1$
QUESTION [7 upvotes]: I studied the official solution to a Putnam competition problem and got stuck in a step, which is summarized as follows:

For $0\le x<1$, we have
$$
\sum_{n=0}^\infty\log(1+x^{2^n}) = -\log(1-x)\tag{1}
$$

My two closely related questions below are based on the justification of (1).
The solution gave the following argument for justifying (1):
Due to the uniqueness of binary expansions of nonnegative integers, we have the identity of formal power series
$$
\frac{1}{1-x}=\prod_{n=0}^{\infty}\left(1+x^{2^{n}}\right)\,;\tag{2}
$$
the product converges absolutely for $0\le x<1$.
But I don't understand what this means. Question 1: In particular, how is "the uniqueness of binary expansions of nonnegative integers" used here?
Naively, if we treat the infinite sum as a finite sum and apply (2), then we have
$$
\sum_{n=0}^\infty\log(1+x^{2^n}) 
= \log \prod_{n=0}^{\infty}\left(1+x^{2^{n}}\right) 
= \log \frac{1}{1-x}
= -\log (1-x) \tag{3}
$$
But Question 2: how can one justify the first equal sign?

REPLY [2 votes]: The product
$$
(1+x)(1+x^2)(1+x^4)\cdots(1+x^{2^N})
$$
is the sum of all the following terms
$$
x^{\sum_{n=0}^N a_n 2^n}
$$
where $a_n\in\{0,1\}$, $0\le n\le N$. But "due to the uniqueness of binary expansions of nonnegative integers", we know that the set
$$
\{\sum_{n=0}^N a_n 2^n\mid a_n\in\{0,1\}\}
$$
is exactly $\{0,1,2,\cdots, K\}$ where
$$
K = 1+2+4+\cdots+2^N = 2^{N+1}-1
$$
Hence
$$
(1+x)(1+x^2)(1+x^4)\cdots(1+x^{2^N})=\sum_{n=0}^K x^n\;.
$$
Taking $N\to\infty$, we have equation (2).

In fact, to get equation (2), alternatively, we may define
$$
a_N = \prod_{n=1}^N(1+x^{2^n})\;.
$$
Then
\begin{align}
(1-x)a_N 
&= (1-x)(1+x)(1+x^2)\cdots(1+x^{2^N})\\
&= (1-x^2)(1+x^2)\cdots(1+x^{2^N})\\
&=\cdots\\
&= (1-x^{2^N})(1+x^{2^N})=(1-x^{2^{N+1}})
\end{align}
Hence $(1-x)a_N\to 1$ as $N\to\infty$, and therefore have equation (2).

To show equation (3), note that for all $N$:
$$
\sum_{n=0}^N\log(1+x^{2^n}) = \log \prod_{n=1}^N(1+x^{2^n})\tag{*}
$$
Taking $N\to\infty$ and using the continuity of the function $\log x$ we have
$$
\sum_{n=0}^\infty\log(1+x^{2^n}) = \log \prod_{n=1}^\infty(1+x^{2^n})\;.
$$
Now apply equation (2) to get (3).

To elaborate on the last step:
\begin{align}
\lim_{N\to\infty}\sum_{n=0}^N\log(1+x^{2^n}) 
&= \lim_{N\to\infty}\log \prod_{n=1}^N(1+x^{2^n})
\quad &\text{by (*)}\\
&= \log \lim_{N\to\infty} \prod_{n=1}^N(1+x^{2^n})
\quad &\text{(by continuity)}\\
& = \log\frac{1}{1-x}\quad
&\text{(by (2))}
\end{align}