Improper integral of an even power of $x$ times $e^{-x^2}$ In Donald McQuarrie’s Mathematical Methods for Scientists and Engineers, he has a problem I would like to assign to my class, but I am having trouble solving it. It states

Show that
$$\int_0^\infty e^{-x^2} \cos\alpha x \,dx = \frac{\sqrt{\pi}}{2} e^{-\alpha^2/4},$$
by expanding $\cos\alpha x$ in a Maclaurin series and integrating term by term.

Doing as suggested, you get
$$
\int_0^\infty e^{-x^2} \left( 1 - \frac{\alpha^2}{2!} x^2 + \frac{\alpha^4}{4!} x^4 + \dots \right)dx.
$$
I know that the first integral is $\sqrt{\pi}/2$ and that the remaining integrals can be evaluated using the following result from a table of integrals that I have
$$
\int_0^\infty x^{2n} e^{-x^2} dx = \frac{1 \cdot 3 \cdot 5 \dots (2n-1) }{2^{n+1}} \sqrt{\pi}.
$$
Doing this, I can complete the problem, the issue is that I do not know how to evaluate the above integral to obtain the result I found in the table of integrals.
Can anyone point me in the right direction?
 A: Evaluate the table integral as follows
$$
\int_0^\infty x^{2n} e^{-x^2} dx = 
(-1)^n \frac{d^n}{da^n} \bigg(\int_0^\infty e^{-ax^2} dx\bigg)_{a=1}  \\=
(-1)^n \frac{d^n}{da^n} \bigg(\frac{\sqrt{\pi}}2 a^{-1/2} \bigg)_{a=1} =\frac{1 \cdot 3 \cdot 5 \cdots (2n-1) }{2^{n+1}} \sqrt{\pi}.
$$
A: As @Quanto already pointed out the Feynman method, let me add a more direct approach using integration by parts:
$$\int_0^{\infty} x^{2n}e^{-x^2} \, \mathrm{d}x = \int_0^{\infty} x^{2n-1} \cdot xe^{-x^2} \, \mathrm{d}x = -\frac{1}{2}x^{2n-1}e^{-x^2}\Big|_0^{\infty} + \frac{2n-1}{2}\int_0^{\infty} x^{2n-2}e^{-x^2} \, \mathrm{d}x.$$
The first summand vanishes; the formula thus follows by induction.
A: The gamma function is defined as
\begin{equation*}
\Gamma(z) = \int_{0}^{\infty}t^{z-1} \, e^{-t} \, dt, \quad \Re(z) > 0.
\end{equation*}
Setting $t = x^{2}$ and $z=n + 1/2$, it follows that
\begin{equation*}
\frac{1}{2}\Gamma\left(n+\frac{1}{2}\right) = \int_{0}^{\infty}x^{2n} \, e^{-x^{2}} \, dx.
\end{equation*}
Repeated use of the recurrence $\Gamma(z+1) = z \, \Gamma(z)$, with $\Gamma(1/2) = \sqrt{\pi}$, gives the result
\begin{equation*}
\frac{1}{2}\Gamma\left(n+\frac{1}{2}\right) = \frac{1}{2}\left(\frac{2n-1}{2}\right)\left(\frac{2n-3}{2}\right)\cdots\left(\frac{1}{2}\right)\Gamma\left(\frac{1}{2}\right) = \frac{(2n-1)(2n-3)\cdots 5 \cdot 3 \cdot 1}{2^{n+1}}\sqrt{\pi}.
\end{equation*}
