For $a>0$, prove $\int_{-\infty}^\infty e^{-x^2}\cos ax\,dx=\sqrt{\pi}e^{-\frac{a^2}{4}}$ by justifying term by term integration. 
For $a>0$, prove $\displaystyle\int_{-\infty}^\infty e^{-x^2}\cos ax\,dx=\sqrt{\pi}e^{-\frac{a^2}{4}}$ by justifying term by term integration.

$$\int_{-\infty}^\infty e^{-x^2}\cos ax\,dx=\int_{-\infty}^\infty e^{-x^2}\sum_{k=0}^{+\infty}(-1)^k\frac{(ax)^{2k}}{(2k)!}\,dx
$$
I wonder how to justify that the integral sign and the summation sign can be interchanged? I want to use Dominated Convergence Theorem, but I can't find a Dominated function. I only need to know how to do this way but no other methods. This is an exercise in Folland's Real Analysis, he hints that it can be proved this way.

Since for any $n\in \mathbb N$,$$\left|e^{-x^2}\sum_{k=0}^{n}(-1)^k\frac{(ax)^{2k}}{(2k)!}\right|\leq e^{-x^2}\sum_{k=0}^{+\infty}\frac{(a|x|)^{2k}}{(2k)!}\leq e^{-x^2}\sum_{k=0}^{+\infty}\frac{(a|x|)^{k}}{k!}=e^{-x^2+a|x|},$$
and $$\int_{\mathbb R}e^{-x^2+a|x|}\,dx=2\int_0^\infty e^{-x^2+ax}\,dx<\infty,$$
we can use DCT to change the order of integration and summation.
