Q:

How do I obtain the Jacobi theta function?

If I enter the series $$\sum_{n=-\infty}^\infty e^{-(n+x)^2}$$ into WolframAlpha it expresses it by the Jacobi theta function $$\sqrt{\pi} \vartheta_3(\pi x,e^{-\pi^2})=\sqrt{\pi} \big(1+2\sum_{n=1}^\infty e^{-(\pi n)^2} \cos(2\pi nx) \big).$$
My question is, how can I show that these both expressions are the same? I somehow cannot see the direct connection. Where does the $\cos$ come from?

A:

I see it as an exercise on Fourier series. $f(x)=\sum_{n=-\infty}^{\infty}e^{-(n+x)^2}$ is even (consider $x\mapsto-x$ together with $n\mapsto-n$), periodic (of period $1$), and smooth, so it has a Fourier expansion: \begin{align}f(x)&=\frac{a_0}{2}+\sum_{k=1}^{\infty}a_k\cos 2\pi kx,\\a_k&=2\int_0^1 f(x)\cos 2\pi kx~dx=2\sum_{n=-\infty}^\infty\int_0^1 e^{-(n+x)^2}\cos 2\pi kx~dx\\\color{gray}{[n+x=y]}&=2\sum_{n=-\infty}^\infty\int_n^{n+1}e^{-y^2}\cos 2\pi ky~dy=2\int_{-\infty}^\infty e^{-y^2}\cos 2\pi ky~dy,\end{align} with a well-known integral remaining (evaluated using complex integration, or power series for $\cos$, or even Feynman's trick).

