Andy from Clitheroe Royal Grammar School sent us his work on this problem. He's given us two methods; can you see why he prefers the second one?

We begin by summing the series

$x+2x^2+3x^3+4x^4+\cdots$

$x$ | + | $x^2$ | + | $x^3$ | + | $x^4$ | + | $\cdots$ |

+ | $x^2$ | + | $x^3$ | + | $x^4$ | + | $\cdots$ | |

+ | $x^3$ | + | $x^4$ | + | $\cdots$ | |||

+ | $\cdots$ |

In other words, we are writing it as a sum of geometric series!

Now, let us factorise the above sum as follows:

$(x + x^2 + x^3 + x^4+\ldots)(1 + x + x^2 + x^3 + x^4+\ldots)$

Wow, a product of geometric series!

We can then take a factor of $x$ out the first bracket to leave us with

$x(1 + x + x^2 + x^3+\ldots)^2$

Using the geometric sum given in the question, this comes to $$x\times \left(\frac{1}{1-x}\right)^2 = \frac{x}{(1-x)^2}$$ __

A similar method could be used for the series $x + 4x^2 + 9x^3 + 16x^4 +\ldots$, factorising it as $(x + 3x^2 + 5x^3 + 7x^4+\ldots)(1 + x + x^2 + x^3 +\ldots)$, then writing the left hand bracket as $(x + x^2 + x^3+\ldots + 2x^2 + 4x^3 + 6x^4+\ldots)$, from which point we can use our previous sum to obtain an answer. Unfortunately this doesn't generalise easily into higher powers, the amount of working needed growing much larger at each stage.

A more elegant solution is differentiation. If we differentiate our first series, we get $1 + 4x + 9x^2 + 16x^3+\ldots + n^2x^{n-1}+\ldots$. Multiplying through by $x$ gives us $x + 4x^2 + 9x^3+\ldots + n^2 x^n+\ldots$, which is the $n^2 x^n$ series we need.

If $x + 2x^2 + 3x^3 + 4x^4+\ldots = x/(1-x)^2$ then $x(d[x + 2x^2 + 3x^3+\ldots]/dx) = x(d[x/(1-x)^2]/dx)$.

But the left-hand side is equal to $x + 4x^2 + 9x^3 + 16x^4 +\ldots$, the sequence we want to sum.

We can resolve the right-hand using the quotient rule, and it comes to $x(1+x)/(1-x)^3$.

__

To take it into higher powers, notice that

$d[x + 4x^2 + 9x^3+\ldots]/dx = 1 + 8x + 27x^2+\ldots$.

Therefore $x d[x + 4x^2 + 9x^3+\ldots]/dx = x + 8x^2 + 27x^3+\ldots$, our next sequence. We can differentiate the previous infinite sum and multiply by $x$ at each stage to get the sum for the next power, and by applying the same process to the closed-form expression, we can obtain a closed-form expression for the next power.