Finding the sum of the series $1^2 + 2 × 2^2 + 3^2 + 2 × 4^2 + 5^2 + 2 × 6^2 + . . . + 2(n − 1)^2 + n^2 ,$ The following is a question which has been bugging me for quite a while, 


Find the sum of the series
$$1^2 + 2 × 2^2 + 3^2 + 2 × 4^2 + 5^2 + 2 × 6^2 + . . . + 2(n − 1)^2 + n^2 ,$$
Where $n$ is odd

I started by denoting this entire series with $S$, from there it is apparent that $S$ infact consists of two lesser series I shall call;

*

*$S_A$ The sum of the squares of odd natural numbers up till $n^2$

*$S_B$ Twice the sum of the squares of even natural numbers up till $(n-1)^2$
I resolved this would be easier to tackle by noting that
$$S_A + \frac{1}{2}S_B = \sum_{r=1}^{n} r^2$$
Which is just the sum of the squares of the first $n$ natural numbers
$$\therefore S_A +\frac{1}{2}S_B=\frac{n}{6}(n+1)(2n+1)$$
Leaving only the value of $\frac{1}{2}S_B$ to be found, this is where I am currently facing difficulty as I am unsure on whether my working is correct;


For the sum of the squares of the first n even natural numbers;
$$2^2 + 4^2 .... (2n)^2=2^2\sum_{r=1}^{n} r^2$$
$$\implies \frac{2}{3}n(n+1)(2n+1) $$
Hence the sum of the first $n-1$ even natural numbers should be
$$ \frac{2}{3}n(n-1)(2n-1)$$
And
$$S= \frac{n}{6}(n+1)(2n+1) + \frac{2}{3}n(n-1)(2n-1)$$
$$\therefore S= \frac{1}{6}n(10n^2 -9n + 5n) $$
However the correct answer is
$$\frac{1}{2}n^2(n+1)$$
Where has my working gone wrong and how would I arrive at the correct answer?
 A: The given sum is equal to
$$\begin{align}
1^2 + 2 × 2^2 + 3^2 + &2 × 4^2 + 5^2 + 2 × 6^2 + \dots + 2(n − 1)^2 + n^2\\
&=1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2 + \dots + (n − 1)^2 + n^2\\
&\qquad\;+2^2 + 4^2 + 6^2 + \dots + (n − 1)^2\\
&=\sum_{k=1}^n k^2+\sum_{k=1}^{m}(2k)^2=\sum_{k=1}^n k^2+4\sum_{k=1}^{m}k^2\\
&=\frac{n(n+1)(2n+1)}{6}+4\frac{m(m+1)(2m+1)}{6}\\&=\frac{n(n+1)(2n+1)}{6}+\frac{(n-1)(n+1)n}{6}\\
&=\frac{n(n+1)(2n+1+n-1)}{6}=\frac{n^2(n+1)}{2}
\end{align}$$
where $m=\frac{n-1}{2}$. Note that in the sum involving the even squares there are $m$ terms (not $(n-1)$).
A: As implicitely pointed out in the given answer, your mistake is due to the fact that for the sum of the squares of even natural numbers up to $n-1$ we need to consider  the following:
$$2^2 + 4^2 .... (n-1)^2=2^2\left(1+2^2+\dots+\left(\frac{n-1}2\right)^2\right) $$
and not
$$2^2 + 4^2 .... (2n)^2=2^2\sum_{r=1}^{n} r^2$$
which is the sum of the squares of even natural numbers up to $2n$.
A: Let f(n) be the sum of squares from 1 up to $n^2$. Then the answer to your question is f(n) + 4 f((n-1)/2). Find a formula for f(n) and substitute it. It should be close to 1.5 f(n) since you are adding about half of the terms twice.
