So I am trying to compute: $$ \int_{0}^\infty\exp(-x^2)\cos(2xy) \mathrm{d}x $$ using the power series of $\cos$. I have done the following:
We first evaluate the integral by expanding $\cos (2xy) $ using its power series. Uniform convergence of the power series (Weierstrass M-test) allows us to integrate the function term by term. We have that: $$ \cos(2xy) = \sum_{n = 0}^{\infty}\frac{(-1)^n(2xy)^{2n}}{(2n)!} = \sum_{n = 0}^{\infty}4^n\frac{(-1)^n x^{2n}y^{2n}}{(2n)!} $$ Hence, we have that: $$ I(y) = \int_0^\infty \exp(-x^2)\sum_{n = 0}^{\infty} 4^n\frac{(-1)^n x^{2n}y^{2n}}{(2n)!} \mathrm{d}x = \sum_{n = 0}^{\infty} \left[ \int_{0}^{\infty}\exp(-x^2) 4^n\frac{(-1)^n x^{2n}y^{2n}}{(2n)!}\mathrm{d}x \right] $$ Simplifying, we have: $$ \sum_{n = 0}^{\infty} \left[ \int_{0}^{\infty}\exp(-x^2) 4^n\frac{(-1)^n x^{2n}y^{2n}}{(2n)!}\mathrm{d}x \right] = \sum_{n = 0}^{\infty} \left[ \frac{(-1)^n 4^ny^{2n}}{(2n)!}\int_{0}^{\infty}\exp(-x^2) x^{2n}\mathrm{d}x \right] $$
And I am not sure how to simplify this further. Do I need Gamma function theory?
There is a much more direct way of doing this calculation. $cos(2xy)=\frac{e^{2ixy}+e^{-2ixy}}{2}$. $\int_0^{\infty}\frac{e^{-x^2-2ixy}}{2}dx=\int_{-\infty}^0\frac{e^{-x^2+2ixy}}{2}dx$, by changing $x$ to $-x$. Therefore the final integral $=\int_{-\infty}^{\infty}\frac{e^{-x^2+2ixy}}{2}dx=\sqrt{\pi}e^{-\frac{y^2}{4}}$.
(Note: I believe I got the final step right, but the constants should be checked.)