# Integrate $\int_{-\infty}^\infty xe^{-\alpha x^2+\beta x}dx$ [duplicate]

I am familiar with the gauusian integral $$\int_{-\infty}^\infty e^{-\alpha x^2+\beta x}dx=\sqrt{\frac{\pi}{\alpha}}e^{\beta^2/(4\alpha)}$$ Could anyone help me to find out the value of the following? $$\int_{-\infty}^\infty xe^{-\alpha x^2+\beta x}dx$$ Integration by parts turns out to contain error function which I am not familiar with.

## marked as duplicate by user296602, Silvia Ghinassi, user228113, colormegone, DanielFeb 11 '16 at 3:37

• Try comuting the derivative of $e^{-\alpha x^2+\beta x}$. What can you do with this? – vrugtehagel Feb 10 '16 at 19:33
• Integral by part? – Taj Mohamed Bandalandabad Feb 10 '16 at 19:34
• @ vrugtehagel: So I get $\int x\cdot(\beta e^{x (\beta -\alpha x)}-2 \alpha x e^{x (\beta -\alpha x)})$ – E Be Feb 10 '16 at 19:37
• $$\int_{-\infty}^\infty xe^{-\alpha x^2+\beta x}dx=\frac{\partial}{\partial\beta}\int_{-\infty}^\infty e^{-\alpha x^2+\beta x}dx=\frac{\partial}{\partial\beta}\left(\sqrt{\frac{\pi}{\alpha}}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}e^{\beta^2/(4\alpha)}\right)=\sqrt{\frac{\pi}{\alpha}}\frac{\beta}{2\alpha}e^{\beta^2/(4\alpha)}$$ – Did Feb 10 '16 at 19:54
• @Achaire You complete the square $-\alpha x^2 + \beta x = -\alpha\left(x-\frac{\beta}{2\alpha}\right)^2 + \frac{\beta^2}{4\alpha}$ and substitute $u = x-\frac{\beta}{2\alpha}$. – Winther Feb 10 '16 at 20:04

We write (assuming $\alpha>0$) \begin{align} \int_{-\infty}^{\infty}xe^{-\alpha x^2+\beta x}&=\frac 1{-2\alpha}\int_{-\infty}^{\infty}-2\alpha xe^{-\alpha x^2+\beta x}+\frac{\beta}{-2\alpha}\int_{-\infty}^{\infty}e^{-\alpha x^2+\beta x}-\frac{\beta}{-2\alpha}\int_{-\infty}^{\infty}e^{-\alpha x^2+\beta x}\\ &=\frac 1{-2\alpha}\int_{-\infty}^{\infty}(-2\alpha+\beta) xe^{-\alpha x^2+\beta x}+\frac{\beta}{2\alpha}\sqrt{\frac{\pi}{\alpha}}e^{\beta^2/(4\alpha)}\\ &=\frac{1}{-2\alpha}\left[e^{-\alpha x^2+\beta x}\right]_{-\infty}^{\infty}+\frac{\beta}{2\alpha}\sqrt{\frac{\pi}{\alpha}}e^{\beta^2/(4\alpha)}\\ &=\frac{\beta}{2\alpha}\sqrt{\frac{\pi}{\alpha}}e^{\beta^2/(4\alpha)} \end{align}

• Well done, but isn't it equal to$\frac{\beta}{2\alpha}\sqrt{\frac{\pi}{\alpha}}e^{\beta^2/(4\alpha)}$? – E Be Feb 10 '16 at 19:55
• Yes, thank you. It was a typo. – vrugtehagel Feb 10 '16 at 19:57

You should complete $ax^2-\beta x$ to quadratic form $a (x-\beta/a)^2-\beta^2/a^2$. After this apply the change of variable $u=ax-\beta$ and integrate $\int u \exp(-u^2/2)du=\exp(-u^2/2)$.

Hint: $xe^{-\alpha x^2 + \beta x} = \frac{d}{d\beta}e^{-\alpha x^2 + \beta x}$

Hint: Write the integrand as $(e^{\beta x})(-\frac1{2\alpha}e^{-\alpha x^2})'$ and use integration by parts. You get

$$\left[-\tfrac1{2\alpha}e^{-\alpha x^2+\beta x}\right]_{-\infty}^{\infty} + \tfrac{\beta}{2\alpha}\int_{-\infty}^{\infty}e^{-\alpha x^2 + \beta x}\; dx$$

The first term vanishes and the second term is $\tfrac{\beta}{2\alpha}$ times your familiar integral.

Hint: try with integration by parts:

$$\int_{-\infty}^{+\infty}\ x e^{F(x)}\ \text{d}x = x\cdot \int_{-\infty}^{+\infty}\ e^{F(x)}\ \text{d}x - \int_{-\infty}^{+\infty} e^{F(x)}\ \text{d}x$$

Where $F(x) = -ax^2 + \beta x$

Or use the Feynman trick: differentiation under the integral sign. Since you know what the result of $\int_{-\infty}^{+\infty}\ e^{-ax^2 + \beta x}\ \text{d}x$ just notice that

$$x e^{-ax^2 + \beta x} = \frac{\partial}{\partial \beta} e^{-ax^2 + \beta x}$$

thence, just differentiate the result of the known integral with respect upon $\beta$:

$$\int_{-\infty}^{+\infty}\ x e^{-ax^2 + \beta x}\ \text{d}x = \int_{-\infty}^{+\infty}\ \text{d}x \frac{\partial}{\partial \beta} e^{-ax^2 + \beta x}\ = \frac{\beta}{2a}\sqrt{\frac{\pi}{a}}\ e^{\beta^2/4a}$$

$$\int_{-\infty}^{\infty}xe^{-\alpha x^2+\beta x}\ dx=-\frac{1}{2\alpha}\int_{-\infty}^{\infty}(-2\alpha x+\beta-\beta)e^{-\alpha x^2+\beta x}\ dx$$

$$=-\frac{1}{2\alpha}\int_{-\infty}^{\infty}(-2\alpha x+\beta)e^{-\alpha x^2+\beta x}\ dx+\frac{\beta}{2\alpha}\int_{-\infty}^{\infty}e^{-\alpha x^2+\beta x}\ dx$$ $$=-\frac{1}{2\alpha}\int_{-\infty}^{\infty}(-2\alpha x+\beta)e^{-\alpha x^2+\beta x}\ dx+\frac{\beta}{2\alpha}\sqrt{\frac{\pi}{\alpha}}e^{\beta^2/4\alpha}$$ since first integral diminishes, $$=0+\frac{\beta}{2\alpha}\sqrt{\frac{\pi}{\alpha}}e^{\beta^2/4\alpha}$$ $$=\frac{\beta}{2\alpha}\sqrt{\frac{\pi}{\alpha}}e^{\beta^2/4\alpha}$$