# Variance of the standard normal distribution.

Suppose $X \sim N(0,1)$. Find $\mathrm{E}(X)$ and $\mathrm {Var} (X)$.

I have found $E(X)=0$. It's easy. While calculating variance of $X$ I got $2$ where as the actual answer should be $1$. Here's how I proceed $:$

\begin{align*} \mathrm{Var} (X) &= \frac 1 {\sqrt {2\pi}} \int_{-\infty}^{\infty} x^2 e^{-{\frac {x^2} 2}}\ dx \\ &= \sqrt {\frac 2 {\pi}} \int_{0}^{\infty} x^2 e^{-{\frac {x^2} 2}}\ dx \\ \end{align*} Now taking the substitution $\frac {x^2} 2 = y$ I found that
\begin{align*} \int_{0}^{\infty} x^2 e^{-{\frac {x^2} 2}}\ dx &= \sqrt {2} \int_{0}^{\infty} e^{-y} y^{\frac 1 2}\ dy \\ &= \sqrt {2}\ \Gamma \left ({\frac 3 2} \right) \\ &= \sqrt {\frac {\pi} 2} \\ \end{align*}

So \begin{align*} \mathrm {Var} (X) &= \sqrt {\frac 2 {\pi}}.\sqrt {\frac {\pi} 2} \\ &= 1 \\ \end{align*}

Please check my calculation? Thank you very much.

• But you are using the fact that the mean is zero and the variance is 1 in the PDF of the random variable!! Why do you want to calculate them, while they are given? Sep 7, 2018 at 17:15
• No I want to verify it @Blackmath. Sep 7, 2018 at 17:19
• Verify the given? I still don't see the point. You used the measures themselves to calculate them. When you write the PDF as $$f_X(x)=\frac{1}{\sqrt{2\pi}}e^{-\frac{x^2}{2}}$$ you assume that the mean is zero and the variance is 1. But then you go ahead to find them!!! Sep 7, 2018 at 18:04

It should be $\Gamma(3/2)$, not $\Gamma(1/2)$. Note that $$\Gamma(t) = \int_0^\infty e^{-y} y^{t-1}\; dy$$
• if I take that substitution at the very first stage I could get $\frac 1 2$ instead of $1$. What's the problem then @Robert Israel? Sep 7, 2018 at 17:18
• $x \mapsto x^2/2$ is not one-to-one on $(-\infty, \infty)$. Sep 7, 2018 at 18:16
$$E(X^2) = \frac{1}{\sqrt{2\pi}}\int\limits_{-\infty}^{\infty} x^2 e^{-\frac{x^2}{2}} \ dx=\frac{\sqrt{2}}{\sqrt{\pi}}\int\limits_{0}^{\infty} x^2 e^{-\frac{x^2}{2}} \ dx$$ Use integration by parts \begin{equation} \int fg' = fg - \int f'g \end{equation} By taking $f = x$ and $g' = xe^{-\frac{x^2}{2}}$ we get $f' = 1$ and $g = -e^{-\frac{x^2}{2}}$, i.e. \begin{equation} \int\limits_{0}^{\infty} x^2 e^{-\frac{x^2}{2}} \ dx =-x\mathrm{e}^{-\frac{x^2}{2}}-{\displaystyle\int}-\mathrm{e}^{-\frac{x^2}{2}}\,\mathrm{d}x \end{equation} Use $u = \frac{x}{\sqrt{2}}$ \begin{equation} \int\limits_{0}^{\infty} x^2 e^{-\frac{x^2}{2}} \ dx =-x\mathrm{e}^{-\frac{x^2}{2}}+ \frac{\sqrt{\pi}}{\sqrt{2s}} \underbrace{{} {}{\displaystyle\int}\dfrac{2\mathrm{e}^{-u^2}}{\sqrt{{\pi}}}\,\mathrm{d}u}_{\operatorname{erf}(u)} \end{equation} Using $u = \frac{x}{\sqrt{2}}$ we get \begin{equation} \int\limits_{0}^{\infty} x^2 e^{-\frac{x^2}{2}} \ dx =\dfrac{\sqrt{{\pi}}\operatorname{erf}\left(\frac{x}{\sqrt{2}}\right)}{\sqrt{2}}-x\mathrm{e}^{-\frac{x^2}{2}} \end{equation} So \begin{equation} E(X^2) = \frac{\sqrt{2}}{\sqrt{\pi}}\Big(\dfrac{\sqrt{{\pi}}\operatorname{erf}\left(\frac{x}{\sqrt{2}}\right)}{\sqrt{2}}-x\mathrm{e}^{-\frac{x^2}{2}}\Big) = \operatorname{erf}\left(\frac{x}{\sqrt{2}}\right) + \Gamma(x) \Big\vert_0^{\infty} \end{equation} where $\Gamma(x) = K x\mathrm{e}^{-\frac{x^2}{2}}$ goes to zero at $x = 0$ and $+\infty$. So \begin{equation} E(X^2) = \operatorname{erf}\left(\frac{x}{\sqrt{2}}\right)\Big\vert_0^{\infty} = 1 - 0 =1 \end{equation} So \begin{equation} Var(X) = E(X^2) - [E(X)]^2 = 1 - 0 = 1 \end{equation}