# Expectation of a Standard Normal Random Variable

Calculate E(X^3) and E(X^4) for X~N(0,1).

I am having difficulty understanding how to calculate the expectation of those two. I intially would think you just calculate the

$\int x^3e^\frac{-x^2}{2} dx$ and $\int x^4e^\frac{-x^2}{2} dx$ for $E(X^3)$ and $E(X^4)$, respectively.

However for lecture for $E(X^2)$ this appearsappears.

• Technically, the expectation is the integral of $\frac{x}{\sqrt{2\pi}}e^{-x^2/2}$, though the constant does not matter, since the result is $0$. Still, one might as well do things right. Feb 24, 2016 at 5:39
• math.stackexchange.com/q/92648/321264 Jun 19, 2020 at 18:10

I much prefer using moment generating functions to calculate the desired expectations. Note $$M_X(t) = \operatorname{E}[e^{tX}] = \int_{x=-\infty}^\infty e^{tx} \frac{e^{-x^2/2}}{\sqrt{2\pi}} \, dx = \int_{x=-\infty}^\infty \frac{e^{-(x^2 - 2tx + t^2)/2} e^{t^2/2}}{\sqrt{2\pi}} \, dx = e^{t^2/2} \int_{x=-\infty}^\infty \frac{e^{-(x-t)^2/2}}{\sqrt{2\pi}} \, dx.$$ But this last integrand is a normal density with mean $t$ and variance $1$, thus integrates to $1$. Hence $$M_X(t) = e^{t^2/2}.$$ Now we recall that $$\operatorname{E}[X^k] = \left[\frac{d^k M_X(t)}{dt^k}\right]_{t=0},$$ so let's calculate successive derivatives: \begin{align*} M_X'(t) &= t e^{t^2/2} \\ M_X''(t) &= e^{t^2/2} + t^2 e^{t^2/2} = (1+t^2)e^{t^2/2} \\ M_X'''(t) &= 2t e^{t^2/2} + (1+t^2)t e^{t^2/2} = (3t+t^3)e^{t^2/2} \\ M_X^{(4)}(t) &= (3+3t^2) e^{t^2/2} + (3t^2 + t^4) e^{t^2/2} = (3 + 6t^2 + t^4) e^{t^2/2}, \end{align*} and it is fairly easy to continue this. Now simply evaluate all of these at $t = 0$ to get \begin{align*} \operatorname{E}[X] &= 0 \\ \operatorname{E}[X^2] &= 1 \\ \operatorname{E}[X^3] &= 0 \\ \operatorname{E}[X^4] &= 3. \end{align*} The polynomial coefficients of $M_X^{(k)}(t)$ are related to Hermite polynomials, and they happen to have a closed form (the proof of which is beyond the scope of this post, but it can be shown via induction): if $M_X^{(k)}(t) = P_k(t)e^{t^2/2}$ with $P_k(t) = a_{k,0} + a_{k,1} t + \cdots + a_{k,k} t^k$, then $$a_{k,j} = \begin{cases} \displaystyle \frac{k!}{2^{(k-j)/2} ((k-j)/2)! \, j!}, & k-j \equiv 0 \pmod 2 \\ 0, & \text{otherwise}. \end{cases}$$ But for the evaluation of $M_X^{(k)}(t)$ at $t = 0$, it is sufficient to only consider the constant term $a_{k,0}$ of $P_k(t)$, which is given by $$\operatorname{E}[X^{2m}] = a_{2m,0} = \frac{(2m)!}{2^m m!}, \quad k = 2m,$$ and $0$ otherwise. This readily gives us the additional even moments $$\operatorname{E}[X^6] = 15, \quad \operatorname{E}[X^8] = 105, \quad \operatorname{E}[X^{10}] = 945, \ldots.$$
Use the same argument for $E[X]$ to say that $E[X^3] = 0$.
For $E[X^4]$, let $u = x^3$ and $dv = x\cdot\frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}x^2}$. Then $du = 3x^2$, $v = -\frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}x^2}$, and \begin{align*} E[X^4] &= \int_{-\infty}^\infty x^4f_X(x)\,dx\\ &=\int_{-\infty}^\infty x^4\cdot\frac{1}{\sqrt{2\pi}}\exp\left\{-\frac{1}{2}x^2\right\}\,dx\\ &=uv|_{-\infty}^\infty-\int_{-\infty}^\infty v\,du\\ &=\left(-x^3\exp\left\{-\frac{1}{2}x^2\right\}\right)\bigg|_{-\infty}^\infty-\int_{-\infty}^\infty 3x^2\cdot\frac{-1}{\sqrt{2\pi}}\exp\left\{-\frac{1}{2}x^2\right\}\,dx\tag 1\\ &=0+3\int_{-\infty}^\infty x^2\cdot\frac{1}{\sqrt{2\pi}}\exp\left\{-\frac{1}{2}x^2\right\}\,dx\tag 2\\ &=3\cdot 1\\ &= 3 \end{align*} where in $(1)$ I let you verify that indeed the left term is zero, and in $(2)$ I used the result presented in your lecture notes.
• As Andre pointed out, your notes are technically wrong; the density of $X$ is $$f_X(x) = \frac{1}{\sqrt{2\pi}} e^{-\frac{1}{2}x^2}.$$ If you integrate $e^{-\frac{1}{2}x^2}$ you get $\sqrt{2\pi} \neq 1$. Densities integrate to $1$. So you need to divide by $\sqrt{2\pi}$.