Solution (source code)

= Solution

For $n=0$, the <change of variables> $s=\sqrt a\,x$ reduces the <integral> to the given <Gaussian integral>:
$$
\boxed{\int_{-\infty}^{\infty}e^{-ax^2}dx
=\frac1{\sqrt a}\int_{-\infty}^{\infty}e^{-s^2}ds=\sqrt{\frac\pi a}.}
$$
For $n=1$, the integrand is an integrable <odd function>, so its contributions from the two half-lines cancel:
$$
\boxed{\int_{-\infty}^{\infty}x e^{-ax^2}dx=0.}
$$
The condition $a>0$ ensures convergence in both cases.