Error in proving of the formula the sum of squares Given formula
$$
\sum_{k=1}^n k^2 = \frac{n(n+1)(2n+1)}{6}
$$
And I tried to prove it in that way:
$$
\sum_{k=1}^n (k^2)'=2\sum_{k=1}^n k=2(\frac{n(n+1)}{2})=n^2+n
$$
$$
\int (n^2+n)\ \text d n=\frac{n^3}{3}+\frac{n^2}{2}+C
$$
But 
$$
\frac{n^3}{3}+\frac{n^2}{2}+C $$ is not equal to 
$$\frac{n(n+1)(2n+1)}{6}=\frac{n^3}{3}+\frac{n^2}{2}+\frac{n}{6}$$
Where I made a mistake?
 A: This is from An Introduction to the Calculus of Finite Differences and Difference Equations by Kenneth S. Miller, 1960. 
We have the difference operator $$ \Delta f(x) = f(x+1) - f(x)  $$
Then we have the factorial polynomials,
$$ x^{(0)} =1,  $$
$$ x^{(1)} =x,  $$
$$ x^{(2)} =x(x-1) = x^2 - x,  $$
$$ x^{(3)} = x(x-1)(x-2) = x^3 - 3 x^2 + 2 x,  $$
$$  x^{(n+1)} = (x-n) x^{(n)} .  $$ 
The pretty difference result is
$$ \Delta  x^{(n)} = n x^{(n-1)}   $$
Without endpoints, indefinite, the fundamental theorem applies as
$$ \sum  x^{(n)} = \frac{x^{(n+1)}}{n+1}, \; \; \; \;  n \neq -1  $$
and with endpoints, we get a shift from $N$ to $N+1$ corresponding to the definition of $\Delta,$ with
$$ \sum_{x=1}^N  x^{(n)} = \left. \frac{x^{(n+1)}}{n+1} \right|_{x=1}^{x=N+1}. \; \; \; \;  n \neq -1  $$
So now we use $$ x^2 = x^2 - x + x = x(x-1) + x  = x^{(2)} + x^{(1)} $$
and find (page 26)
$$ \sum_{x=1}^N  x^{(2)} + x^{(1)} = \left. \frac{x^{(3)}}{3} + \frac{x^{(2)}}{2} \right|_{x=1}^{x=N+1} =  \left. \frac{x(x-1)(x-2)}{3} + \frac{x(x-1)}{2} \right|_{x=1}^{x=N+1} $$
$$ =   \frac{(N+1)N(N-1)}{3} + \frac{(N+1)N}{2}  $$
$$ = \frac{1}{6} (N+1)N \left( 2(N-1) + 3 \right) = \frac{1}{6} (N+1)N \left( 2N-2 + 3 \right) = \frac{1}{6} (N+1)N \left( 2N + 1 \right) .$$
A: I think the fault is that $f(n)=\sum_{k=1}^{n} k^{2}$ is function of $n$ not $k$ remember (k is just an index variable). The problem here is $n, f(n)\in \mathbb{Z}$ exclusively so the analysis we use on reals such as taking derivatives doesn't really make sense in the integers
A: Here's an interesting approach using the summation of binomial coefficients.
First, note that 
$$\sum_{i=1}^n {i+a\choose b} = {{n+a+1}\choose {b+1}}$$
and also that
$$i^2=2\cdot \frac{(i+1)i}{1\cdot 2}-i=2{{i+1}\choose 2}-{i\choose 1}$$
Hence
$$\begin{align}
\sum_{i=1}^ni^2 &=\sum_{i=1}^n \left[2{{i+1}\choose 2}-{i\choose 1}\right]\\
&=2 \sum_{i=1}^n {{i+1}\choose 2}- \sum_{i=1}^n {i\choose 1}\\
&=2{{n+2}\choose 3}-{{n+1}\choose 2}\\
&=2\cdot \frac {(n+2)(n+1)n} {1\cdot 2\cdot 3} -\frac {(n+1)n} {1\cdot 2}\\
&=\frac {(n+1)n} 6 \cdot \left[ 2(n+2)-3 \right]\\
&={\frac 16}n(n+1)(2n+1)
\end{align}$$
A: Adding integers has nothing to do with derivatives. You cannot expect to get anything meaningful form your attempt. 
A: We must take (anti)derivatives in terms of specific variables. The sum $$\sum_{k=1}^n k^2$$ is not a function of $k,$ but rather a function of $n,$ for which you're trying to find a formula. Consequently, $(k^2)'$ makes no sense, as every instance of $k$ is a fixed constant, not an undetermined variable.
A: I have my doubts on the technique used. You see, you can't treat integer functions the same as real valued functions while differentiating. 
For the mentioned problem, here is a hint:
Go one power up.
$$\sum_{k=1}^n (k+1)^3 - k^3 = \sum_{k=1}^n(k+1)^2 + k(k+1) +k^2 = (n+1)^3 -1$$
Can you do the rest?
A: The way you do it makes no sense. The term:
$$
\sum\limits_{k=1}^n k^2
$$
does not depend on $k$, since that is a dummy variable that vanishes once the sum is complete. So differentiating it with respect to this variable that doesn't even exist once the sum is done has no interpretation. To make matters worse, the dummy variable is a separate entity from the limit variable ($n$), which you integrate the second term with respect to, making the integral nothing like the inverse of the derivative you did.
If you want to prove this sum, do it the same way you would prove the sum $\sum\limits_{k=1}^n k = n (n+1)/2$. That is, prove it by induction. Here's how to do it:
Show that if
$$
\sum\limits_{k=1}^n k^2 = \frac{n (n+1) (2 n + 1)}{6}
$$
is true for $n = m$ then it must also be true for $n = m+1$. Then show that it's true for $n = 1$, and then the proof is complete for all natural $n$. The proof should be pretty easy if you want to try it.
Also, if you want to find the expression above (i.e. you don't know what the actual sum should be and you want to come upon the expression yourself) then start with:
$$
\sum\limits_{k=1}^n k^2 = a + b n + c n^2 + d n^3
$$
and then solve for the sum explicitly for $n = 1$, $2$, $3$, and $4$, and make the results equal to the above expression for those integers. Then solve for the 4 unknowns using the 4 explicit equations, and you'll find $a$, $b$, $c$, and $d$. Then proceed with the proof by induction that I explained above.
