# integral of $x e^{-x^2}$

What is the result of the following expression?

$$$$\int^{\infty}_{-\infty}dx\;x\;e^{-x^2}$$$$

On trying to use $$u=x^2$$ and evaluate the above, I get $$\frac{\sqrt \pi}{2}$$, but my homework solution says it is $$0$$ as $$x\;e^{-x^2}$$ is an odd function. How is this possible?

EDIT (my steps):

Setting $$u=x^2$$, $$du = 2xdx$$. Using this in the integral results in,

$$$$\int^{\infty}_{-\infty}\frac{du}{2}e^{-u^2}$$$$

Taking $$\frac{1}{2}$$ out of the integral, the rest is $$\int^{\infty}_{-\infty} e^{-u^2} = \sqrt\pi$$ and so the result $$\frac{\sqrt\pi}{2}$$.

What is wrong with the approach above?

• You'd have to show us the different steps in your evaluation of the integral for us to find if you made a possibly tiny mistake in the calculations. By the way, it might be safer tu use the subsitution $u=-x^2$.
– MasB
Oct 25, 2020 at 11:49
• actually you cannot substitute $u = x^2$ as the function is not invertible in the given range Oct 25, 2020 at 12:00
• with $u=x^2$ the extremes of integration becom both $+\infty$ and so the integral should be zero, shouldn't it? Oct 25, 2020 at 13:04

You have two mistakes in your substitution.

You substitute $$u = x^2,$$ but you write $$e^{-u^2}$$ after replacing $$x^2$$ in $$e^{-x^2}.$$ (This is technically an error but I think it actually is not responsible for the error in the answer.)

The critical error is that after substitution your bounds are $$-\infty$$ and $$\infty.$$ After the substitution $$u=x^2,$$ there are no negative values of $$u.$$ As $$x$$ increases from $$-\infty$$ to $$0$$, $$u$$ decreases from $$\infty$$ to $$0$$.

You can fully account for this by writing your substitution in two parts:

\begin{align} \int_{-\infty}^\infty dx\,xe^{-x^2} &= \int_{-\infty}^0 dx\,xe^{-x^2} + \int_0^\infty dx\,xe^{-x^2} \\ &= \int_{\infty}^0 du\,\frac12 e^{-u} + \int_0^\infty du\,\frac12 e^{-u}. \\ \end{align}

Can you finish it from there?

• Thanks David K. I see my folly in substitution - the integrand becomes $𝑒^{−𝑢}$ on substitution. And it is much more clear when the limits are split you put, giving (-1 -0) + (-0+1). Oct 25, 2020 at 18:45