Integrating the arithmetic series to get the sum of first $n$ squares? I only learnt today that series can be differentiated and integrated and I wondered if it is possible to apply the techniques of differential calculus to the finite arithmetic series
$$\sum_{x=0}^n x = n(n+1)/2$$
to obtain the sum of the first $n$ squares:
$$\sum_{x=0}^n x^2 = \frac{n(n+1)(2n+1)}{6}$$
 A: The "generating function" approach to these sorts of problems usually uses that if $$f(z)=\sum_{i=0}^\infty a_iz^i$$ then $f'(z)=\sum_{i=0}^\infty (i+1)a_{i+1}z^i$
In addition, we can note that:
$$\frac{1}{1-z}f(z) = \sum_{i=0}^\infty s_i z^i$$ where $s_k=\sum_{i=0}^k a_i$. That is, if we know the power series for $a_i$ we know the power series for the partial sums of $a_i$.
Now, we can start with $f(z)=\frac{1}{1-z}=\sum z^i$ to start getting power series for $f'(z)$ and $f''(z)$:
$$\frac{1}{(1-z)^2} = f'(z) = \sum_{i=0}^\infty (i+1)z^i$$
$$\frac{2}{(1-z)^3} = f''(z)=\sum_{i=0}^\infty (i+1)(i+2)z^i$$
Now, if $a_i=i$, then $$\sum a_iz^i = f'(z) - f(z) = \frac{z}{(1-z)^2}$$
Letting $s_k=\sum_{i=0}^k a_i$ we get:
$$\sum s_i z^i = \frac{z}{(1-z)^3} = \frac{z}{2}f''(z) = \sum_{i=0}^\infty \frac{(i+1)(i+2)}{2} z^{i+1}$$
Equating coefficients, we see that $s_i=\frac{i(i+1)}{2}$, which is the result you wanted.
The general solution can be messy. It is probably easier to first study these sorts of sums in terms of finite differences, rather than power series, but the power series view (aka "generating functions") has a lot of interesting applications in combinatorics.
A: You might have in mind that $s(x)=\sum\limits_{k=0}^nx^k$ is such that $s'(x)=\sum\limits_{k=0}^nkx^{k-1}$ hence $\sum\limits_{k=1}^nk=s'(1)$.
Now, $(1-x)s(x)=1-x^{n+1}$ hence $(1-x)s'(x)=s(x)-(n+1)x^{n}$. When $x\to1$, $x=1-z$ with $z\to0$, $x^n=1-nz+o(z)$, $s(x)=s(1)-s'(1)z+o(z)$ and $s(1)=n+1$ hence $zs'(1)=n+1-s'(1)z-(n+1)(1-nz)+o(z)$, that is, $2s'(1)=n(n+1)$.
This indicates that $\sum\limits_{k=1}^nk=\frac12n(n+1)$.
The same technique allows to compute $\sum\limits_{k=1}^nk^2=\sum\limits_{k=1}^nk(k-1)+\sum\limits_{k=1}^nk=s''(1)+s'(1)$ since the second derivative $(1-x)s''(x)=2s'(x)-n(n+1)x^{n-1}$ yields the limited expansion $zs''(1)=2s'(1)-2zs''(1)-n(n+1)(1-(n-1)z)+o(z)$, hence $3s''(1)=n(n+1)(n-1)$ and $\sum\limits_{k=1}^nk^2=\frac16n(n+1)(2n+1)$.
A: Let's say we have, $$f(x)=1+x+x^2+x^3+\cdots+x^n$$
$$\frac{x^{n+1}-1}{x-1} = 1+x+x^2+x^3+\cdots+x^n$$
Differentiating,
$$\frac{nx^{n+1}-(n+1)x^n+1}{(x-1)^2} = 1+2x+3x^2+\cdots+nx^{n-1}$$
Multiplying both sides by $x$
$$\frac{nx^{n+2}-(n+1)x^{n+1}+x}{(x-1)^2} = x+2x^2+3x^3+\cdots+nx^{n}$$
Differentiating, again
$$\frac{(-2n^2-2n+1)x^{n+1} +n^2x^{n+2} +(n+1)^2x^n-x-1 }{(x-1)^3} = 1+2^2x+3^2x^2+\cdots+n^2x^{n-1}$$
Then take the limit at $x\to1$,
and we're done.
Disclaimer: This is not at all advisable, and was done just for curiosity. I had to use WA for the differentiation, as I lack the patience
