Determine $\int_{-\infty}^\infty e^{ipx - qx^2} dx$. I have to evaluate the following integral:
$$\int_{-\infty}^\infty e^{ipx - qx^2} dx\,,$$
where $p \in \mathbb{R}$ and $q > 0$. I am suppose to use contour integration, but I am not sure what the contour should be. I am also allowed to use $$\int_{-\infty}^\infty e^{-x^2} dx = \sqrt{\pi}\,.$$
 A: This answer aligns with that of @Ricardo770 but with a little twist: Write $I$ for the integral and note that, by completing the square,
$$ I = \int_{-\infty}^{\infty} e^{-q\left(x-\frac{ip}{2q}\right)^2-\frac{p^2}{4q}} \, \mathrm{d}x. $$
So we have
$$ e^{\frac{p^2}{4q}}I = \int_{-\infty}^{\infty} e^{-q\left(x-\frac{ip}{2q}\right)^2} \, \mathrm{d}x. $$
Now differentiating both sides with respect to $p$,
\begin{align*}
\frac{\partial}{\partial p}\Bigl( e^{\frac{p^2}{4q}}I \Bigr)
&= -ip \int_{-\infty}^{\infty} \left(x-\frac{ip}{2q}\right) e^{-q\left(x-\frac{ip}{2q}\right)^2} \, \mathrm{d}x \\
&= \frac{ip}{2q} \left[ e^{-q\left(x-\frac{ip}{2q}\right)^2} \right]_{-\infty}^{\infty} \\
&= 0.
\end{align*}
Therefore $p \mapsto e^{\frac{p^2}{4q}}I$ is constant with the value $ e^{\frac{p^2}{4q}}I \bigr|_{p=0} = I(0) = \sqrt{\frac{\pi}{q}} $ and hence
$$ I = \sqrt{\frac{\pi}{q}} e^{-\frac{p^2}{4q}}. $$
A: If you are allowed to use $\int_{-\infty}^\infty e^{-x^2} dx = \sqrt{\pi}$, then
$$\int_{-\infty}^\infty e^{ipx - qx^2} dx
= e^{-\frac{p^2}{4q}} \int_{-\infty}^\infty e^{- q(x- \frac {i p}{2q} )^2 }dx
= \frac1{\sqrt q}e^{-\frac{p^2}{4q}} \int_{-\infty}^\infty e^{- t^2 }dt= \sqrt{\frac{{\pi}}{q}}e^{-\frac{p^2}{4q}}
$$
A: First note that your integrand is an even function which allows you to rewrite the integral as follows:
$$\int_{-\infty}^{\infty} e^{ipx}e^{-qx^{2}}dx=2\int_{0}^{\infty} \cos(px)e^{-qx^{2}}dx$$
Now define
$$I(p)=\int_{0}^{\infty} \cos(px)e^{-qx^{2}}dx$$
Taking derivative with respect to $q$
$$\frac{dI(p)}{dp}=-\int_{0}^{\infty} x\sin(px)e^{-qx^{2}}dx$$
Integrating by parts the last equation gives
$$\frac{dI(p)}{dp}=-\frac{p}{2q}\int_{0}^{\infty} \cos(px)e^{-qx^{2}}dx$$
But note that the integral in the right hand side is equal to I(p), so we get a first order differential equation:
$$\frac{dI(p)}{dp}=-\frac{p}{2q}I(p)$$
Integrating this ODE leads us to:
$$I(p)=ce^{-\frac{p^{2}}{4q}}$$ where $c$ is a constant to be defined.
Observe that $$I(0)=\int_{0}^{\infty} e^{-qx^{2}}dx=\frac{1}{2}\sqrt{\frac{\pi}{q}}$$
consequently $c=\frac{1}{2}\sqrt{\frac{\pi}{q}}$ and we get the final answer:
$$I(p)=\frac{1}{2}\sqrt{\frac{\pi}{q}}e^{-\frac{p^{2}}{4q}}$$
or
$$\boxed{\int_{-\infty}^{\infty} e^{ipx}e^{-qx^{2}}dx=\sqrt{\frac{\pi}{q}}e^{-\frac{p^{2}}{4q}}}$$
A: In this solution, $p$ is an arbitrary complex number.
For $R>0$, let $C_R$ be the counterclockwise parallelogram contour whose corners are $\pm R$ and $\pm R-\dfrac{p\text{i}}{2q}$.  Define $f:\mathbb{C}\to\mathbb{C}$ via
$$f(z):=\exp\left(-qz^2\right)$$
for all $z\in\mathbb{C}$.  Then, $f$ is an entire function, making
$$\oint_{C_R}\,f(z)\,\text{d}z=0\,.$$
This shows that
$$\int_{-R}^{+R}\,\text{e}^{-q\left(x-\frac{p\text{i}}{2q}\right)^2}\,\text{d}x-\int_{-R}^{+R}\,\text{e}^{-qx^2}\,\text{d}x=g(R)\,,$$
where
$$g(R):=\text{i}\,\left(\int_{-\frac{p}{2q}}^0\,\text{e}^{-q(-R+\text{i}y)^2}\,\text{d}y-\int_{-\frac{p}{2q}}^0\,\text{e}^{-q(+R+\text{i}y)^2}\,\text{d}y\right)\,.$$
Observe that $\lim\limits_{R\to\infty}\,g(R)=0$.  Therefore,
$$\lim_{R\to\infty}\,\left(\int_{-R}^{+R}\,\text{e}^{-q\left(x-\frac{p\text{i}}{2q}\right)^2}\,\text{d}x-\int_{-R}^{+R}\,\text{e}^{-qx^2}\,\text{d}x\right)=0\,.$$
Ergo,
$$\int_{-\infty}^{+\infty}\,\text{e}^{-q\left(x-\frac{p\text{i}}{2q}\right)^2}\,\text{d}x=\int_{-\infty}^{+\infty}\,\text{e}^{-qx^2}\,\text{d}x=\sqrt{\frac{\pi}{q}}\,.$$
Therefore,
$$\int_{-\infty}^{+\infty}\,\text{e}^{\text{i}px-qx^2}=\text{e}^{-\frac{p^2}{4q}}\,\int_{-\infty}^{+\infty}\,\text{e}^{-q\left(x-\frac{p\text{i}}{2q}\right)^2}\,\text{d}x=\sqrt{\frac{\pi}{q}}\,\text{e}^{-\frac{p^2}{4q}}\,.$$
