TITLE: Compute $\sum_{k=1}^{\infty}e^{-\pi k^2}\left(\pi k^2-\frac{1}{4}\right)$
QUESTION [20 upvotes]: How may I evaluate the below series?
$$\sum_{k=1}^{\infty}e^{-\pi k^2}\left(\pi k^2-\frac{1}{4}\right)$$
I'm supposed to come up with a solution by only using high school knowledge.
Thanks in advance for your hints, suggestions!

REPLY [23 votes]: I don't know about high school math, but there is an answer using Mellin transforms. First compute the Mellin transform of the sum, then invert to get a closed form expression.
Introduce $$ f(x) = \sum_{k\ge 1} e^{- k^2 x} \left(\pi k^2 - \frac{1}{4} \right),$$
so that we are looking for $f(\pi).$
We have straightforwardly (using the definition of the Mellin transform) that the Mellin transform $f^*(s)$ of $f(x)$ is given by
$$ f^*(s) = \mathfrak{M}\left(f(x); s\right) = 
\Gamma(s) 
\sum_{k\ge 1} \left(\frac{\pi}{k^{2(s-1)}} - \frac{1}{4} \frac{1}{k^{2s}} \right) =
\Gamma(s) \left(\pi \zeta(2(s-1)) - \frac{1}{4} \zeta(2s) \right).$$
Now the Mellin inversion integral (which we'll evaluate at $x=\pi$) is
$$\frac{1}{2\pi i} \int_{c-i\infty}^{c+i\infty} f^*(s) x^{-s} ds =
\frac{1}{2\pi i} \int_{c-i\infty}^{c+i\infty} \Gamma(s) \left(\pi \zeta(2(s-1)) - \frac{1}{4} \zeta(2s) \right) x^{-s} ds.$$
Now the only singularity of the first zeta term is at $s=3/2$, with residue
$$ \operatorname{Res}\left(\Gamma(s) \pi \zeta(2(s-1)) x^{-s}; s=3/2\right) =
1/2\,{\frac {\Gamma \left( 3/2 \right) \pi }{{x}^{3/2}}}.$$
The only singularity of the second zeta term is at $s=1/2$, with residue
$$ \operatorname{Res}\left(\Gamma(s) \frac{1}{4} \zeta(2s) x^{-s}; s=1/2\right) =
1/8\,{\frac {\Gamma \left( 1/2 \right) }{\sqrt {x}}}.$$
It follows that
$$ f(x) = 1/2\,{\frac {\Gamma \left( 3/2 \right) \pi }{{x}^{3/2}}}
-  1/8\,{\frac {\Gamma \left( 1/2 \right) }{\sqrt {x}}}.$$
Finally set $x=\pi$ to get
$$\frac{1}{\sqrt{\pi}} \left(1/2\Gamma(3/2)-1/8\Gamma(1/2)\right) =
\frac{1}{\sqrt{\pi}} \left(1/4\Gamma(1/2)-1/8\Gamma(1/2)\right) =
\frac{1}{8} \frac{1}{\sqrt{\pi}} \Gamma(1/2) = \frac{1}{8}.$$
The reason why there is only one pole in every case is because the trivial zeros of the zeta function cancel the poles of the gamma function.