TITLE: Computing $\sum_{n=-\infty}^\infty \int_{-\pi}^\pi e^{-x^2} \cos(nx) dx $
QUESTION [5 upvotes]: I'm trying to find $$ \sum_{n=-\infty}^\infty \int_{-\pi}^\pi e^{-x^2} \cos(nx) dx. $$
About the only thing I can think of is the well-known identity
$$ \sum_{n=-k}^k \cos(nx) = \sum_{n=-k}^k e^{inx} = \frac{\sin\left((k+\frac{1}{2})x\right)}{\sin\left(\frac{x}{2}\right)}. $$
But this doesn't seem to simplify things much.

REPLY [2 votes]: Well, there were two solid answers posted. So, let's try this using the complex Fourier series.
We have 
$$e^{-x^2}=\sum_{n=-\infty}^{\infty}C_ne^{inx}\tag 1$$
where 
$$C_n=\frac{1}{2\pi}\int_{-\pi}^{\pi}e^{-t^2}e^{-int}dt \tag 2$$
Using $(2)$ in $(1)$ with $x=1$ yields 
$$1=\sum_{n=-\infty}^{\infty}\frac{1}{2\pi}\int_{-\pi}^{\pi}e^{-t^2}e^{-int}dt \tag 3$$
whereupon multiplying both sides of $(3)$ by $2\pi$ and exploiting the fact that the sine function is odd reveals 
$$\bbox[5px,border:2px solid #C0A000]{2\pi=\sum_{n=-\infty}^{\infty}\int_{-\pi}^{\pi}e^{-t^2}\cos (nt)\,dt }$$