Solve $\sum nx^n$

Convergence of the series below is assumed throughout.

$$\begin{align} \sum\limits_{n\ge0}nx^n&=\sum\limits_{n\ge0}x(x^n)' &\text{integrate } nx^{n-1}\\ &=x\sum\limits_{n\ge0}(x^n)' &\text{factor } x \,\text{out}\\ &=x\left(\sum\limits_{n\ge0}(x^n)\right)' &\text{differentiate the whole series} \\ &=x\left(\frac1{1-x}\right)' &|x|<1\\ &=\frac x{(1-x)^2} &\text{differentiate }\frac {1}{1-x} \end{align}$$


Hint: The basic idea that we can switch $\frac{d}{dx}$ and $\sum$ in any compact subset of the disc of convergence for the power series.


Both your and the book's development are the same. The advantage of the book's method is that it points at the following: If you want terms in $n x^n$, you get them by $x \dfrac{d}{dx} x^n$, to get $n^2 x^n$, you do $x \dfrac{d}{d x} \left(x \dfrac{d}{d x} x^n \right)$, and so on. If you use the notation $D$ for the operator $\dfrac{d}{d x}$, you can then write $n x^n = x D x^n$, $n^2 x^n = (x D)^2 x^n$, and in general $n^k x^n = (x D)^k x^n$, and if now $p(\cdot)$ is any polynomial, by combining several of the previous formulas you get $p(n) x^n = p(x D) x^n$.

Let $A(x) = \sum_{n \ge 0} a_n x^n$. This idea applied term by term to $A(x)$ is: $$ \sum_{n \ge 0} p(n) a_n x^n = p(x D) A(x) $$