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.