<s>[INST] Find the generating function for $c_r = \sum^r_{i=1}i^2$ Find the generating function of
where $c_0 = 0, c_r = \sum^r_{i=1}i^2$.
Hence show that
$\sum^r_{i=1}i^2 = C^{r+1}_3 + C^{r+2}_3$
Attempt:
$c_r = \sum^r_{i=1}i^2$
= $x + 4x^2 + 9x^3 + ... + r^2x^r$
= $x(1 + 4x + 9x^2 + ... + r^2x^{r-1})$
= $x(\frac{1}{1-2x})$
How do i proceed from here? Is this even right?
 [/INST] We     are  looking  for  a generating  function
\begin{align*}
\sum_{r=0}^\infty c_r x^r=\sum_{r=0}^\infty \left(\sum_{i=1}^r i^2\right) x^r
\end{align*}
Note  that  Cauchy multiplication of a series with $\frac{1}{1-x}$ transforms the coefficient $a_r$ of a series to $\sum_{i=0}^r a_r$.
\begin{align*}
\frac{1}{1-x}\sum_{r=0}^\infty a_r x^r=\sum_{r=0}^\infty \left(\sum_{i=0}^r a_r\right)x^r
\end{align*}

We obtain
  \begin{align*}
\sum_{r=0}^\infty c_r x^r&=\sum_{r=0}^\infty \left(\sum_{i=1}^r i^2\right) x^r\\
&=\frac{1}{1-x}\sum_{r=0}^\infty r^2x^r\tag{1}\\
&=\frac{x^2}{1-x}\sum_{r=0}^\infty r(r-1)x^{r-2}+\frac{x}{1-x}\sum_{r=0}^\infty r x^{r-1}\tag{2}\\
&=\frac{1}{1-x}D_x^2\left(\frac{1}{1-x}\right)+\frac{1}{1-x}D_x\left(\frac{1}{1-x}\right)\tag{3}\\
&=\frac{2x^2}{(1-x)^4}+\frac{x}{(1-x)^3}\tag{4}\\
&=2x^2\sum_{r=0}^\infty \binom{-4}{r} (-x)^r+x\sum_{r=0}^\infty \binom{-3}{r} (-x)^r\tag{5}\\
&=2\sum_{r=0}^\infty \binom{r+3}{3}x^{r+2}+\sum_{r=0}^\infty \binom{r+2}{2}x^{r+1}\tag{6}\\
&=2\sum_{r=2}^\infty \binom{r+1}{3}x^{r}+\sum_{r=1}^\infty \binom{r+1}{2}x^{r}\tag{7}\\
&=\sum_{r=1}^\infty \left(\binom{r+1}{3}+\binom{r+2}{3}\right)x^{r}\tag{8}\\
\end{align*}
  and the claim follows.

Comment:


*

*In (1) we factor out $\frac{1}{1-x}$.

*In (2) we rearrange the series to apply differentiation in the following.

*In (3) we write the expression using the differential operator $D_x:=\frac{d}{dx}$.

*In (4) we apply the differentiation.

*In (5) we use the binomial series expansion.

*In (6) we use the binomial identity $\binom{-p}{q}=\binom{p+q-1}{q}(-1)^q$.

*In (7) we shift the index of the series accordingly to obtain $x^r$ in both series.

*In (8) we collect the series and use the binomial identity $\binom{r+2}{3}=\binom{r+1}{3}+\binom{r+1}{2}$.
</s>