Gaussian integral using integration by parts

Homework Statement

Show in detail that:
$$\sigma_{x}^{2} = \int_{-\infty}^{\infty} (x -\bar{x})^{2} \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{(x-X)^{2}}{2\sigma^{2}}} = \sigma^{2}$$
where,
$$G_{X,\sigma}(x) = \frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{(x-X)^{2}}{2\sigma^{2}}}$$

Homework Equations

$$\int u dv = uv -\int v du$$

The Attempt at a Solution

There are some hints that are given. Replace $\bar{x}$ with $X$ (according to the text, this is because they are equal after many trials). make the substitutions $x-X=y$ and $y/\sigma=z$. Integrate by parts to obtain the result.

After following the hints I get the following integral:
$$\frac{\sigma}{\sqrt{2\pi}} \int_{\infty}^{\infty} z^{2}e^{-\frac{z^{2}}{2}}dz$$
How would one go about using integration by parts for this integral?

Last edited:

D H
Staff Emeritus
What have you tried?

BTW, your problem statement doesn't look right. That ##(x-\bar x)## should be ##(x-\bar x)^2##. You also have a problem in your final integral.

If the problem is what you asked, you want to integrate by parts twice, taking down the ##x^2## one degree at each step.

D H
Staff Emeritus
You only need to integrate by parts once if you know the value of ##\int_{-\infty}^{\infty} \exp(x^2) \, dx## (or of ##\int_{-\infty}^{\infty} \exp(x^2/2) \, dx\,\,##).

You only need to integrate by parts once if you know the value of ##\int_{-\infty}^{\infty} \exp(x^2) \, dx## (or of ##\int_{-\infty}^{\infty} \exp(x^2/2) \, dx\,\,##).
as it happens I don't know, altho I think I have done them over and over -- you'd think I would learn.

Working with integration by parts I've tried some different combinations of $u$ and $dv$:

$$\frac{\sigma}{\sqrt{2\pi}} \int_{-\infty}^{\infty} z^{2} e^{-\frac{z^2}{2}} dz\\ u=z^{2}\\ du = 2 z dz\\ dv = e^{-\frac{z^{2}}{2}}dz\\ v = 2.5\\ 2.5 z^{2} |_{-\infty}^{\infty} - \int 2.5 *2z dz\\ =0$$

Trying to recognize some symetry:
$$\frac{\sigma}{\sqrt{2\pi}} \int_{-\infty}^{\infty} z^{2} e^{-\frac{z^2}{2}} dz\\ \frac{2\sigma}{\sqrt{2\pi}} \int_{0}^{\infty} z^{2} e^{-\frac{z^2}{2}} dz\\ u = z^{2}\\ dv = e^{-\frac{z^{2}}{2}} dz$$
seems to blow up to infinity as does setting $u=z$ and $dv = ze^{-\frac{z^{2}}{2}}dz$

What I would like is a hint about choosing my $u$ and $dv$. Or it seems like there's something I'm missing here.

vela
Staff Emeritus
Homework Helper
Don't use limits when integrating dv. The latter choice of u=z and ##dv=ze^{-z^2/2}\,dz## is the way to go.

$$\frac{\sigma}{\sqrt{2\pi}} \int_{-\infty}^{\infty} z^{2} e^{-\frac{z^{2}}{2}}dz\\ u = z\\ du = dz\\ \\ dv = z e^{-\frac{z^{2}}{2}} dz\\ v = ?\\ \\$$
working to find v and using a strange result that I found on the boards mentioned by nicksauce near the middle of the page link
$$\int z e^{-\frac{z^{2}}{2}} dz\\ u = z\\ du = dz\\ \\ dv = e^{-\frac{z^{2}}{2}} dz \\ v = \frac{\sqrt{\pi}}{\sqrt{2}}\\ \\ z\frac{\sqrt{\pi}}{\sqrt{2}} - \int \frac{\sqrt{\pi}}{\sqrt{2}} dz = 0\\$$
plugging back into above
$$u = z\\ du = dz\\ v = 0\\ dv = z e^{-\frac{z^{2}}{2}} dz\\ \\$$
It seems like everything just keeps going to 0 or infinity.

vela
Staff Emeritus
Homework Helper
Don't use limits when integrating dv. Calculate the indefinite integral.

How would I handle $\int e^{-\frac{z^{2}}{2}} dz$ if its an indefinite integral?

vela
Staff Emeritus
Homework Helper
You don't.

$$\sigma_{x}^{2} = \int_{-\infty}^{\infty} (x-X)^2 \frac{1}{\sigma\sqrt{2\pi}} e^{-(x-X)^{2}/2\sigma^{2}} \\ = \int_{-\infty}^{\infty} y^2 \frac{1}{\sigma\sqrt{2\pi}} e^{-y^{2}/2\sigma^{2}} \\ = \frac{\sigma}{\sqrt{2\pi}}\int_{-\infty}^{\infty} \frac{y^2}{\sigma^{2}}e^{-y^{2}/2\sigma^{2}} \\ = \frac{\sigma}{\sqrt{2\pi}}\int_{-\infty}^{\infty} z^{2}e^{-z^{2}/2} \\$$

then IBP and a u-sub to find $v$ by evaluating $dv$ as an indefinite integral.
$$u = z\\ du = dz\\ \\ v = -e^{-\frac{z^{2}}{2}}\\ dv = z e^{-\frac{z^{2}}{2}} dz\\ \\ \\ -ze^{-z^2/2} |_{-\infty}^{\infty} + \int_{-\infty}^{\infty} e^{-z^{2}/2}dz\\ = \sqrt{2\pi}$$
going back up to the top
$$\sigma_{x}^{2} = \sigma$$

Can you see where I'm missing the extra $\sigma$? Also, what is the point of doing integration by parts if I just end up with the integral $\int_{-\infty}^{\infty} e^{-z^{2}/2}dz=\sqrt{2\pi}$, but I had to use wolfram to evaluate it, when at the very beginning I could have used wolfram to get $\int_{-\infty}^{\infty} z^{2}e^{-z^{2}/2}=\sqrt{2\pi}$.

Is there a trick to evaluating $\int_{-\infty}^{\infty} e^{-z^{2}/2}dz$ by hand?

D H
Staff Emeritus
Can you see where I'm missing the extra $\sigma$?
You left out the dx, dy, and dz in your integrals. Don't do that.

Ray Vickson
Homework Helper
Dearly Missed
Working with integration by parts I've tried some different combinations of $u$ and $dv$:

$$\frac{\sigma}{\sqrt{2\pi}} \int_{-\infty}^{\infty} z^{2} e^{-\frac{z^2}{2}} dz\\ u=z^{2}\\ du = 2 z dz\\ dv = e^{-\frac{z^{2}}{2}}dz\\ v = 2.5\\ 2.5 z^{2} |_{-\infty}^{\infty} - \int 2.5 *2z dz\\ =0$$

Trying to recognize some symetry:
$$\frac{\sigma}{\sqrt{2\pi}} \int_{-\infty}^{\infty} z^{2} e^{-\frac{z^2}{2}} dz\\ \frac{2\sigma}{\sqrt{2\pi}} \int_{0}^{\infty} z^{2} e^{-\frac{z^2}{2}} dz\\ u = z^{2}\\ dv = e^{-\frac{z^{2}}{2}} dz$$
seems to blow up to infinity as does setting $u=z$ and $dv = ze^{-\frac{z^{2}}{2}}dz$

What I would like is a hint about choosing my $u$ and $dv$. Or it seems like there's something I'm missing here.

Using ##u = z## and ##dv = z\: \exp(-z^2/2) \, dz## is exactly the way to go. I cannot get it to "blow up" as you claim.

You left out the dx, dy, and dz in your integrals. Don't do that.
And there is my missing sigma! Thank you DH.