# Complex gaussian, complete the square

## Homework Statement

Evaluate this integral (in essence the Fourier transform of the Gaussian):

$$\int_{-\infty}^{+\infty} e^{-ax^2} e^{ikx}\, dx$$

2. The attempt at a solution
One way is to complete the square, so that

$$-ax^2 + ikx = -a(x-ik/2a)^2 - (k/2a)^2$$

so the integral becomes
$$e^{-(k/2a)^2} \int_{-\infty}^{+\infty} e^{-a(x-ik/2a)^2}\, dx$$

then change the variable $$x \rightarrow x-ik/2a$$, so that the integral becomes like the usual Gaussian and the result is $$\sqrt{\pi/a} e^{-(k/2a)^2}$$.

3. Nuissance
The problem is that I have changed a real variable x into a complex one, while still keeping the same integration limits, which is plus minus infinity (on the real axis, not the complex plane). I don't see any legal reason behind this. What is more, if we use Euler's formula $$e^{ikx} = \cos(kx) + i\sin (kx)$$ and integrate the real and imaginary parts separately, the imaginary part vanishes because it's odd with respect to the origin, while cosine in the real part can be expanded as a Taylor series, each term then can be integrated with the Gaussian, we sum back the results and the final formula is exactly the same as with the supposedly illegal completion of the square, so evidently we can complete the square, with a good justification. What is the justification?