I have seen a proof of the variance of a standard normal distribution, but am getting an incorrect answer am and not sure why. Here is my reasoning.

$$\mathbb{V}[X] = \mathbb{E}[X^2] - \mathbb{E}[X]^2 = \mathbb{E}[X^2]$$

$$ \mathbb{E}[X^2] = \frac{1}{\sqrt(2\pi)}\int_{-\inf}^{+inf} x^2 e^{-\frac{x^2}{2}} dx$$

Then do integration by parts and let $u=x^2$ and $dv = e^{-\frac{x^2}{2}}$ (In the proof I have seen, you choose $u=x$ and $dv = x e^{-\frac{x}{2}}$ and this makes sense to me and works out... )


$$ \frac{du}{dx} = 2x$$

and $$ v = \sqrt(2 \pi)$$

as this is just the integral over the standard normal. Then the integral becomes

$$ \mathbb{E}[X^2] =\frac{1}{\sqrt(2\pi)} \int_{-\inf}^{+inf} x^2 e^{-\frac{x^2}{2}} dx = \frac{1}{\sqrt(2\pi)} \left( x^2|_{-inf}^{inf} \sqrt(2 \pi) \ - \sqrt(2 \pi)\int_{-\inf}^{+inf} 2x dx\right ) = \left( x^2 - x^2\right)|_{-inf}^{inf} = 0$$

but this is oviously incorrect. Im sure I have just a stupid error but can't seem to find it.

  • $\begingroup$ How do you get $v=\sqrt{2\pi}$? I think this is your mistake. The problem with choosing $dv=e^{-x^2/2}$ is that it doesn't have a primitive in terms of elementary functions. $\endgroup$ Aug 25, 2019 at 11:26
  • $\begingroup$ I basically just did this: en.wikipedia.org/wiki/Gaussian_integral based on the notion that the definite integral can be evaluated... Sorry, your answer is partly out of my depth. Does this mean that when you can generally do integration by parts, you can only when the functions have elementary indefinite integrals? $\endgroup$ Aug 25, 2019 at 11:31
  • 1
    $\begingroup$ It is still possible to do integration by parts with non-elementary functions. v needs to be a primitive of $dv$. One primitive is given by $v(x)=\int_0^x e^{-t^2/2}dt$. $\endgroup$ Aug 25, 2019 at 11:39
  • 2
    $\begingroup$ The Gaussian integral you are refering to is a definite integral, but we need an indefinite integral. $\endgroup$ Aug 25, 2019 at 11:42
  • $\begingroup$ Ok. That makes sense to me (sorry I was a bit lost about what a primitive was and was browsing wikipedia...). Thanks! :) $\endgroup$ Aug 25, 2019 at 11:43

1 Answer 1


Better way to solve that integral if you are familiar with gamma integrals. Are you? $\dfrac{1}{\sqrt{2 \pi}}\int_{-\infty}^{\infty}x^2e^{\frac{-x^2}{2}}dx=\dfrac{2}{\sqrt{2 \pi}}\int_{0}^{\infty}x^2e^{\frac{-x^2}{2}}dx \because(\text{Even function})=\frac{2}{\sqrt{2 \pi}} \cdot \frac{\frac{\sqrt{\pi}}{2}}{\frac{1}{\sqrt{2}}}=1$

  • $\begingroup$ Thanks for the answer! I'm not familiar with gamma integrals but the proof that I have seen (and which makes sense to me) does exactly this limit change (and then integration by parts). Since I have found this proof, my questions is really about why the derivation above is incorrect. $\endgroup$ Aug 25, 2019 at 11:36
  • $\begingroup$ @user3235916 I don't understand your doubt. Do you want me to solve this integral by parts ? $\endgroup$
    – Daman
    Aug 25, 2019 at 11:41
  • $\begingroup$ sorry. I fully believe your derivation! :) I meant that I am asking why mine (in the question above) is incorrect! $\endgroup$ Aug 25, 2019 at 11:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .