Coefficient of $x^n$ What is the coefficient of $x^n$ of this following expression:                            
$$(x+x^2+x^3+ \dots + x^r)^n$$
I tried it but failed. I know that it can be solved  by combinations but how? What is the theorem? Is it in generating functions?

Here we suppose $r\geq 2$. We have
$$(x + x^2 + \cdots + x^r)^n$$
$$=x^n(1+x+\cdots+x^{r-1})^n$$
$$=x^n(1+xp(x))^n$$
where $$p(x) = 1 + x + \cdots + x^{r-2}.$$
Next we use the binomial theorem to write
$$=x^n(1+xp(x))^n$$
$$= x^n\left(\sum_{k=0}^n \binom{n}{k}x^kp(x)^k\right)$$
$$= \sum_{k=0}^n \binom{n}{k}x^{n+k}p(x)^k$$
and we see the coefficient of $x^n$ is $\binom n 0 = 1$.
