About the identity $1=(1-x)(1+x+x^2+\cdots)$ I'm learning about generating function. I have trouble understanding why
$$1=(1-x)(1+x+x^2+\cdots),$$
if in the second parenthesis it stop at any $k\in\mathbb N, x^k$ then an additional term $(-x)(x^k)$ will appear.
 A: I'm probably missing something here, but:
If $$s= 1+\underbrace{x+x^2+x^3+\cdots}$$ then  $$xs= \underbrace{x+x^2+x^3+\cdots}$$
so $$ s-sx = 1$$
A: Formal Power Series
In the context of formal power series, numerical convergence is not the main concern. Two series are considered close if the coefficients of all terms of degree less than or equal to $n$ are equal; the greater the $n$, the closer they are. Thus, as a formal power series,
$$
\begin{align}
\lim_{n\to\infty}(1-x)\sum_{k=0}^{n-1} x^k
&=\lim_{n\to\infty}1-x^n\\
&=1
\end{align}
$$
In this case, the series actually does converge numerically for $|x|\lt1$, but this is not important for a formal power series.

Cauchy Product Formula
The product of two formal power series can be evaluated using the Cauchy Product Formula. The Cauchy Product Formula also gives
$$
(1-x)\sum_{k=1}^\infty x^k=1
$$
A: When talking about generating functions, the intuition is to treat $x$ as a number "very close to $0$", so that $x^n$ becomes smaller and smaller as $n$ gets bigger.
A: Consider the identity $$2=2^0+2^{-1}+2^{-2}+\cdots$$
If you stop the series at any $k\in \mathbb{N}$, you don't get $2$, but rather $2-2^{-k}$.  This extra term only appears when we terminate the series at a finite step, and vanishes as $k\to \infty$.
A: If you stop at $x^{n - 1}$, the left side will read $1 - x^n$ which you can verify by multiplying it out.
Your identity only holds for $-1 < x < 1$. When that is true, $x^n = 0$ for large n.
