Show with generating functions that every positive integer can be written as a unique sum of distinct powers of $2$.
There are 2 parts to the proof that I don't understand. I will point them out as I outline the proof:
The generating function given is $$ g^*(x) = (1+x)(1+x^2)(1+x^4)\cdots (1+x^{2^k}) \cdots. $$
Then I don't understand where the following comes from:
To show that every integer can be written as a unique sum of disticnt powers of $2$, we must show that the coefficient of every power of $x$ in $g^*(x) = 1 + x + x^2 + x^3 + \cdots = (1-x)^{-1} $ or equivalently, $(1-x)g^*(x)=1$.
Then they use the identity $(1-x^k)(1+x^k) = 1 - x^{2k}$ to manipulate $g^*(x)$: $$\begin{align*} (1-x)g^*(x) &= (1-x)(1+x)(1+x^2)(1+x^4)(1+x^8)\cdots\\ &= (1-x^2)(1+x^2) (1+x^4)(1+x^8)\cdots \\ &= (1-x^4)(1+x^4)(1+x^8)\cdots \\ &= \quad \quad \vdots\\ &= 1 \end{align*}$$
That is the the second part that I don't understand. If it's an infinite product, why can they "eventually eliminate all factors of $(1-x)g^*(x)$"?
Update: Alternative proofs are more than welcome.
For your second question, first note that
$$g^*(x)=\prod_{k\ge 0}\left(1+x^{2^k}\right)=(1+x)(1+x^2)(1+x^4)(1+x^8)\dots$$
makes sense: if $n\le 2^m$, the coefficient of $x^n$ in $g^*(x)$ is its coefficient in the polynomial $$\prod_{k=0}^m\left(1+x^{2^k}\right)\;,$$ because the contribution of any factor $1+x^{2^k}$ with $k>m$ must be a factor of $1$, not of $x^{2^k}$. Similarly, the coefficient of $x^n$ in the product
$$(1-x)g^*(x)=(1-x)(1+x)(1+x^2)(1+x^4)(1+x^8)\dots$$
is its coefficient in the polynomial
$$(1-x)\prod_{k=0}^m\left(1+x^{2^k}\right)\;,$$
for exactly the same reason. And by an easy induction
$$(1-x)\prod_{k=0}^m\left(1+x^{2^k}\right)=1-x^{2^{m+1}}\;,$$
so the coefficient of $x^0=1$ is $1$, and the coefficient of $x^n$ for $1\le n\le 2^m$ is $0$. Since this is true for every $m\in\Bbb Z^+$, for each $n>0$ the coefficient of $x^n$ in $(1-x)g^*(x)$ must be $0$, and since the constant term is $1$, $(1-x)g^*(x)=1$.