# Exponential integration involving polynomial

$$\int \exp( aZ^2 + bZ ) \, dZ$$

noting that $a<0$ , $b>0$

Thanks.

• Complete the square to get an error function. Nov 5, 2015 at 19:38
• As written I'm pretty sure the indefinite integral can't be done - perhaps you really meant the integral to have limits from $-\infty$ to $+\infty$ - that integral can be evaluated .
– WW1
Nov 5, 2015 at 19:45
• Do you intend capital $Z$ and lower-case $z$ to refer to the same thing? If so, you shouldn't do that; if not, then your question is unclear. Nov 5, 2015 at 19:55

Denote $$\Phi(y) = \int_{-\infty}^y\exp\left(-\frac{1}{2}x^2\right) \mathrm{d}x$$ By construction $$\Phi^\prime\left(y\right) = \exp\left(-\frac{1}{2} y^2 \right)$$ Now observe that, for $a>0$ $$\frac{\mathrm{d}}{\mathrm{d} x} \Phi\left(\sqrt{2 a} x - b\right) = \sqrt{2 a} \Phi^\prime\left(\sqrt{2 a} x - b\right) = \sqrt{2 a} \exp\left(-\frac{1}{2} \left(\sqrt{2 a} x - b\right)^2 \right)$$ Now, expand the square: $$\sqrt{2 a} \exp\left(-\frac{1}{2} \left(\sqrt{2 a} x - b\right)^2 \right) = \sqrt{2 a} \exp\left(-a x^2 + \sqrt{2 a} b x - \frac{1}{2} b^2 \right)$$ Hence $$\exp\left(-a x^2 + c x\right) = \frac{\mathrm{d}}{\mathrm{d}x} \frac{\exp\left(\frac{c^2}{2a}\right)}{\sqrt{2a}} \Phi\left( \sqrt{2 a} x - \frac{c}{\sqrt{2a}} \right)$$ which is to say $$\int \exp\left(-a Z^2 + c Z\right) \mathrm{d} Z = \frac{}{\sqrt{2a}} \exp\left(\frac{c^2}{2a}\right) \Phi\left( \sqrt{2 a} Z - \frac{c}{\sqrt{2a}} \right) + {\color\gray C}$$
When you see something like $aZ^2+bZ$ you immediately think that maybe completing the square is what you need: $$aZ^2 + bZ = a\left( Z^2 + \frac b a Z \right) = a\left( Z^2 + \frac b a Z + \frac{b^2}{4a^2} \right) - \frac{b^2}{4a} = a\left( Z - \frac b {2a} \right)^2 - \frac{b^2}{4a}$$ Then \begin{align} & \int_{-\infty}^\infty \exp \left( aZ^2 + bZ \right) \, dZ = \int \exp \left( a\left( Z - \frac b {2a} \right)^2 - \frac{b^2}{4a} \right) \, dz \\[10pt] = {} & \exp\left( -\frac {b^2}{4a} \right) \int_{-\infty}^\infty \exp \left( a\left( Z - \frac b {2a} \right)^2 \right) \, dZ \end{align} Letting $W = Z - \dfrac b {2a}$ so that $dW = dZ$, we see that as $Z$ goes from $-\infty$ to $+\infty$, so does $W$, and we get $$\exp\left( -\frac {b^2}{4a} \right) \int_{-\infty}^\infty \exp \left( aW^2 \right) \, dW.$$ Now letting $V= W\sqrt{-2a}$, so that $aW^2 = \frac{-1} 2 V^2$ and $dW = \dfrac{dV}{\sqrt{-2a}}$, we get $$\frac {1} {\sqrt{-2a}} \exp\left( -\frac {b^2}{4a} \right) \int_{-\infty}^\infty \exp \left( -\frac 1 2 V^2 \right) \, dV.$$ Now you have the familiar Gaussian integral and you get
$$\frac{1}{\sqrt{-2a}} \exp\left( -\frac {b^2}{4a} \right) \cdot \sqrt{2\pi}.$$
Use partial integration on $e^{bz}$ and $\exp(az^2+bz)$ as follows: $$\int{e^{az^2}e^{bz}dz}=\frac{e^{az^2}e^{bz}}{b}-\int{\frac{2ze^{az^2}e^{bz}}{b}dz}\\ \int{\frac{2ze^{az^2}e^{bz}}{b}dz}=\frac{2z}{b}\int{e^{az^2}e^{bz}dz}-\frac 2 b\iint{e^{az^2}e^{bz}dz^2}$$ Let $A=I'=B''=\exp(az^2+bz)$ so we have $$\int Adz=\frac Ab-\left(\frac {2z}b\int Adz - \frac 2b\iint Adz^2\right)\\ \left(1+\frac 2bz\right)B' = \frac {B''}b + \frac {2B}b+C_0\\ B=\left(-\frac b2-z\right)B'+\left(-\frac 1 2\right)B'' +C_1\\ B'=\left(-\frac b2-z\right)B''+(-1)B'+\left(-\frac 1 2\right)B'''\\ I=\left(-\frac b4-\frac 1 2z\right)I'+\left(-\frac 1 4\right)I''$$ Hopefully this is a solvable differential equation, maybe you know better than me?