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?
 A: 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}$.
A: Let $C(t) := \sum_{n\ge0}c_nt^n$ be the generating series. Then, sung the fact that
$$c_n = c_{n-1} + n^2$$
for $n>0$, we have
\begin{align}
C(t) = & \sum_{n\ge0}c_nt^n\\
= & c_0 + \sum_{n\ge1}(c_{n-1}+n^2)t^n\\
= & tC(t) + \sum_{n\ge0}n^2t^n\\
= & tC(t) + t\frac{d}{dt}\left(t\frac{d}{dt}\sum_{n\ge0}t^n\right)\\
= & tC(t) + t\frac{d}{dt}\left(t\frac{d}{dt}\frac{1}{1-t}\right)\\
= & tC(t) + \frac{t}{(1-t)^2}.\\
\end{align}
Therefore,
$$C(t) = \frac{t}{(1-t)^3}.$$
A: $\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

$\ds{\mc{C}\pars{z} \equiv \sum_{r = 0}^{\infty}c_{r}z^{r}\,,\quad\verts{z} < 1\,,\qquad c_{0} = 0\,,\quad
\left.c_{r}\right\vert_{\ r\ \geq\ 1} = \sum_{i = 1}^{r}i^{2}}$.

$$\bbox[10px,#ffe,border:0.1em groove navy]{%
\begin{array}{l}
\mbox{Besides any 'Generating Function Method', the identity can be easily proved by using the}
\\
falling\ factorial\ a^{\underline{n}} \pars{~\mbox{see, for example, Knuth et. al.}\ Concrete\ Mathematics\ \mbox{book}~}:
\\[1mm]
\ds{i^{\underline{1}} = i}\ \mbox{and}\
\ds{i^{\underline{2}} = i\pars{i - 1} = i^{2} - i}\
\mbox{such that}\ \ds{i^{2} =  i^{\underline{2}} + i^{\underline{1}}}.
\\[2mm]
\mbox{Then,} 
\\
\ds{\color{#f00}{\left.c_{r}\right\vert_{\ r\ \geq\ 1}} =
\sum_{i = 1}^{r}i^{2} =
\sum_{0\ \leq\ i\ <\ r + 1}\pars{i^{\underline{2}} + i^{\underline{1}}} =
\pars{{1 \over 3}\,i^{\underline{3}} + {1 \over 2}\,i^{\underline{2}}}
_{1}^{r + 1} =
{1 \over 3}\,\pars{r + 1}^{\underline{3}} + {1 \over 2}\,\pars{r + 1}^{\underline{2}}}
\\[2mm]
\ds{= {1 \over 3}\pars{r + 1}r\pars{r - 1} + {1 \over 2}\pars{r + 1}r =
2{r + 1 \choose 3} + {r + 1 \choose 2}}
\\[2mm]
\ds{= {r + 1 \choose 3} + \bracks{{r + 1 \choose 3} + {r + 1 \choose 2}} =
\color{#f00}{{r + 1 \choose 3} + {r + 2 \choose 3}}}
\\[4mm]
\mbox{In the last step, we used the}\ Pascal\ Triangle\ Identity.
\end{array}}
$$

The Generating Function Method is somehow longer:
\begin{align}
\color{#f00}{\mc{C}\pars{z}} & =
\sum_{r = 1}^{\infty}z^{r}\braces{\sum_{i = 1}^{\infty}i^{2}\bracks{i \leq r}} =
\sum_{i = 1}^{\infty}i^{2}\sum_{r = i}^{\infty}z^{r} =
\sum_{i = 1}^{\infty}i^{2}\,{z^{i} \over 1 - z} =
{1 \over 1 - z}\sum_{i = 1}^{\infty}i^{2}z^{i}
\\[5mm] & =
{1 \over 1 - z}\pars{z\,\partiald{}{z}}^{2}\sum_{i = 1}^{\infty}z^{i} =
{1 \over 1 - z}\pars{z\,\partiald{}{z}}^{2}\pars{z \over 1 - z} =
{1 \over 1 - z}\bracks{z\pars{1 + z} \over \pars{1 - z}^{3}} =
\color{#f00}{{z\pars{1 + z} \over \pars{1 - z}^{4}}}
\\[5mm] & =
{2 \over \pars{1 - z}^{4}} - {3 \over \pars{1 - z}^{3}} +
{1 \over \pars{1 - z}^{2}} = 
\sum_{r = 0}^{\infty}\bracks{2{-4 \choose r} - 3{-3 \choose r} +
{-2 \choose r}}\pars{-z}^{r}
\\[5mm] & =
\sum_{r = 0}^{\infty}\bracks{2{r + 3 \choose 3} - 3{r + 2 \choose 2} +
{r + 1 \choose 1}}z^{r} =
\sum_{r = 0}^{\infty}\bracks{\color{#f00}{{r + 1 \choose 3} +
{r + 2 \choose 3}}}z^{r}
\end{align}


The last identity is straightforward recovered by using Pascal Triangle Identity.

