Find function $f(x)$ whose expansion is $\sum_{k=0}^{+\infty}k^2x^k$. I know the expansion of $\frac{1}{1-x}$ is $$1+x+x^2+\cdots+x^k+\cdots$$
So taking the derivative of $$\frac{\partial}{\partial{x}} \frac{1}{1-x}=\frac{1}{(1-x)^2}$$
And subsequently the expansion is (after taking derivative): $$1+2x+3x^2+4x^3+...+ kx^{(k-1)}$$
And multiplying by $x$: $$x+2x^2+3x^3+\cdots+kx^k+\cdots$$
I can't seem to figure out how to work with knowing the above expansion and knowing I need to arrive at: $$x+2^2 x^2+3^2 x^3 +\cdots+k^2 x^k +\cdots$$
I thought it would be a matter of $f(x)=\frac{1}{(1-x^2)^2}$ or some form of squaring or adding a constant in there but I'm stumped.


Simplify $\displaystyle\sum_{k=0}^{+\infty}k^2x^{k}$.

Differentiate and multiply the below expression by $x$ twice
\begin{align*}
\sum_{k=0}^{+\infty}x^k&=\frac{1}{1-x}\\
\sum_{k=0}^{+\infty}kx^{k-1}&=\frac{1}{(1-x)^2}\\
\sum_{k=0}^{+\infty}kx^{k}&=\frac{x}{(1-x)^2}=-\frac{1}{(1-x)}+\frac{1}{(1-x)^2}\\
\sum_{k=0}^{+\infty}k^2x^{k-1}&=-\frac{1}{(1-x)^2}+\frac{2}{(1-x)^3}=\frac{x+1}{(1-x)^3}\\
\sum_{k=0}^{+\infty}k^2x^{k}&=\frac{x(x+1)}{(1-x)^3}\\
\end{align*}
