Why is integral by parts not working in Gaussian expectation calculation?

81 Views Asked by At

My Procedure:

$$\begin{align*} E(x)=&\int_{- \infty}^{+\infty}x\frac{1}{\sqrt{2\pi}\sigma}e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx \\ = &\frac{1}{\sqrt{2\pi}\sigma} \int_{- \infty}^{+\infty}xe^{-\frac{(x-\mu)^2}{2\sigma^2}}dx \end{align*}$$ Using integral by parts: let

$$u=x$$ $$dv=e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx$$ we have $$du=dx$$ and $$v = \int_{- \infty}^{+\infty}dv=\int_{- \infty}^{+\infty}e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx$$ Since we know the integral of a pdf is 1: $\int_{- \infty}^{+\infty}\frac{1}{\sqrt{2\pi}\sigma}e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx=1$, then we have $$v=\int_{- \infty}^{+\infty}e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx=\sqrt{2\pi}\sigma$$

Then, $$uv-\int_{- \infty}^{+\infty}vdu = x\sqrt{2\pi}\sigma|_{-\infty}^{+\infty}-\int_{- \infty}^{+\infty}\sqrt{2\pi}\sigma dx$$

It seems something's wrong. But where?

1

There are 1 best solutions below

1
On BEST ANSWER

This integral can be solved as follows.

$E(x)=\frac{1}{\sqrt{2\pi}\sigma} \int_{- \infty}^{+\infty}(x-\mu)e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx+\frac{\mu}{\sqrt{2\pi}\sigma} \int_{- \infty}^{+\infty}e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx$ .

By letting $t=(x-\mu)^2$, the first integral of the right-hand side (RHS) becomes

$\frac{1}{2\sqrt{2\pi}\sigma} \int_{+\infty}^{+\infty}e^{-\frac{t}{2\sigma^2}}dt=0$,

while the second integral of the RHS is obviously

$\frac{\mu}{\sqrt{2\pi}\sigma} \int_{- \infty}^{+\infty}e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx=\mu$.

Thus, the final result is $E(x)=\mu$ as well known.