Find coefficient of $x^n$ in
$(1+x+2x^2+3x^3+.....+nx^n)^2$
My attempt:Let $S=1+x+2x^2+3x^3+...+nx^n$
$xS=x+x^2+2x^3+3x^4+...+nx^{n+1}$
$(1-x)S=1+x+x^2+x^3+....+x^n-nx^{n+1}-x=\frac{1-x^{n+1}}{1-x}-nx^{n+1}-x$
$S=\frac{1}{(1-x)^2}-\frac{x}{1-x}=\frac{1-x+x^2}{(1-x)^2}$. (Ignoring terms which have powers of x greater than $x^n$)
So one can say that
coefficient of $x^n$ in $(1+x+2x^2+3x^3+.....+nx^n)^2$
=coefficient of $x^n$ in $(1-x+x^2)^2(1-x)^{-4}$
Is there a shorter way.
Such coefficient is clearly $$ 2n+\sum_{k=1}^{n-1} k(n-k) = \frac{n(n^2+11)}{6}.$$