# completing the square in a gaussian integral

I'm trying derive this integral

$$I = \int_{-\infty}^\infty dx~\exp[-ax^2 + ikx]$$

I was following someone else's work for a similar integral of

$$\int_{-\infty}^\infty dx~\exp[-ax^2]\exp[bx]$$

where they completed the square and got $\exp\left[-(x\sqrt{a} - \frac{b}{2\sqrt{a}})^2+\frac{b^2}{4a}\right]$

I tried completing the square on $-ax^2 + ikx$ and got $-a(x - \frac{ik}{2a})^2 - \frac{k^2}{4a}$ and even when I tried to complete the square on $-ax^2 + bx$ I got edit: $-a(x - \frac{b}{2a})^2 - \frac{b^2}{4a}$.

I'm wondering where I went wrong that when I completed the square on $-ax^2 + bx$ I got edit: $-a(x - \frac{b}{2a})^2 - \frac{b^2}{4a}$ instead of the $-(x\sqrt{a} - \frac{b}{2\sqrt{a}})^2+\frac{b^2}{4a}$ the other person got, and what I'm not getting about this.

edit To get my result of $-a(x - \frac{ik}{2a})^2 - \frac{k^2}{4a}$ I followed $a(x + \frac{b}{2a})^2 + (c - \frac{b^2}{4a})$ where I set $a = -a,~ b = ik,~c = 0$.

I have a good idea that once I figure out the correct polynomial in the exponential that I'll then make some substitutions, pull out a few constants and try to get the integral to look like $\exp[-ax^2]$, which I can then just recognize as a form of the gaussian integral. I also know that

$$\int_{-\infty}^\infty dx~\exp[-ax^2 + bx] = \exp\left[\frac{b^2}{4a}\right] \sqrt{\frac{\pi}{a}}$$ and I was also wondering if I could use this result and just replace $b = ik$. I would prefer to be able to derive this result myself however, rather than just relying on this.

• "wondering where I went wrong..." well expand out both sides of your equation. One has $ax^2$ with a plus sign and one has $ax^2$ with a minus sign. So it's wrong. It's hard to tell where you went wrong without seeing the work. Sep 21, 2017 at 3:18
• Whoops, just noticed I dropped a "-a" in my original question. I'll change that and see if that what you were referring to? Sep 21, 2017 at 3:24
• This is chaos, but if I had to guess it's that you forgot to apply the $a\to -a$ to the last term $\frac{b^2}{2a}$ there. Your $-ax^2+ikx = -a(x-ik/2a)^2 -k^2/4a$ is right. The corresponding correct formula should be $-ax^2+bx = -a(x-b/2a)^2 +b^2/4a$ as can be seen equivalent by letting $b=ik.$ Sep 21, 2017 at 3:36
• In general for completing the square, just expand it out and make sure it's right... if not it's usually pretty easy to figure out which sign needs to be changed. Sep 21, 2017 at 3:40
• I have a quick question about the result that this other person got that $-ax^2 + bx = -(\sqrt{a}x - b/2\sqrt{a})^2 - b^2/4a$. Is that completely wrong or am I just not seeing how they got it? Because that was my issue in the first place- I thought that I was doing it wrong because I couldn't get their result. But if your saying my answer of $-a(x - ik/2a)^2 - k^2/2a$ is right, then I'm not sure how the other person got their result. Sep 21, 2017 at 3:44