<s>[INST] Find a generating function for $\sum_{k=0}^{n} k^2$ 
Find a generating function for $\sum_{k=0}^{n} k^2$

I know my solution is wrong, but why?  
My solution:
If $F(x)$ generates $\sum_{k=0}^{n} k^2$ then $F(x)(1-x)$ generates $k^2$.  
$\frac{x}{(1-x)^4}: \left\{ 0,1,4,9,16,25...  \right\}$
$\frac{x}{(1-x)^3}: \left\{ 0,1,3,5,7,9...  \right\}$
$\frac{x}{(1-x)^2}: \left\{ 0,1,2,2,2,2...  \right\}$
$\frac{x}{1-x}: \left\{ 0,1,1,1,1,1...  \right\}$
$x: \left\{ 0,1,0,0,0,0...  \right\}$  
So, $F(x)=\frac{x}{(1-x)^5}$ generates $\sum_{k=0}^{n} k^2$
 [/INST] Just consider:
\begin{align}
\sum_{n \ge 0} z^n
  &= \frac{1}{1 - z} \\
\sum_{n \ge 0} n^2 z^n
  &= z \frac{\mathrm{d}}{\mathrm{d} z} 
       \left( z \frac{\mathrm{d}}{\mathrm{d} z} \frac{1}{1 - z} \right) \\
  &= \frac{z + z^2}{(1 - z)^3} \\
\sum_{n \ge 0} \left( \sum_{0 \le k \le n} k^2 \right) z^n
  &= \frac{z + z^2}{(1 - z)^4}
\end{align}
Just for the heck of it:
\begin{align}
\sum_{0 \le k \le n} k^2
  &= [z^n] \frac{z + z^2}{(1 - z)^4} \\
  &= [z^{n - 1}] (1 - z)^{-4} + [z^{n - 2}] (1 - z)^{-4} \\
  &= (-1)^{n - 1} \binom{-4}{n - 1} + (-1)^{n - 2} \binom{-4}{n - 2} \\
  &= \binom{n - 1 + 4 - 1}{4 - 1} + \binom{n - 2 + 4 - 1}{4 - 1} \\
  &= \binom{n + 2}{3} + \binom{n + 1}{3} \\
  &= \frac{(n + 2) (n + 1) n + (n + 1) n (n - 1)}{3!} \\
  &= \frac{(2 n + 1) (n + 1) n}{6}
\end{align}
</s>