# 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.

• I kind of understand the concept now. Even though I don't know where the 1/radical(2pi) comes from in lecture notes. I appreciate it! Feb 24, 2016 at 6:11
• 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}$.
– Em.
Feb 24, 2016 at 6:16

I see the question is already answered, so I'll present a trick that can help later. I'll break the problem into two sections, even and odd powers, this allows us to use symmetry arguments.

Odd Power Solution: By symmetry, the odd powers will go to zero (i.e. integrating an even function against an odd function will result in zero over $$\mathbb R$$), so $$\boxed{\mathbb E[x^{2n+1}] = 0} \ \ \ (\text{s.t. } n=0,1,2,...)$$

Even Power Solution: I'll work generally $$X \sim N(0,\Sigma)$$. $$\mathbb E[X^{2n}] = \frac{1}{\sqrt{2\pi \Sigma}}\int_{-\infty}^\infty x^{2n} e^{-x^2 / 2\Sigma} dx$$ If we let $$\Delta := -1/2\Sigma$$, then we can rewrite the integral as $$= \frac{1}{\sqrt{2\pi \Sigma}}\int_{-\infty}^\infty x^{2n} e^{x^2 \Delta} dx$$ but notice this can be rewritten as a lot of derivatives on $$\Delta$$ \begin{align} & = \frac{1}{\sqrt{2\pi \Sigma}}\int_{-\infty}^\infty \frac{\partial^n}{\partial \Delta^n} e^{x^2 \Delta} dx \\ & = \frac{1}{\sqrt{2\pi \Sigma}}\frac{\partial^n}{\partial \Delta^n} \int_{-\infty}^\infty e^{x^2 \Delta} dx \\ & = \frac{1}{\sqrt{2 \Sigma}}\frac{\partial^n}{\partial \Delta^n} (-\Delta)^{-1/2}\\ & = \frac{(-1)^n}{\sqrt{2 \Sigma}} (-\Delta)^{-\tfrac{1}{2} - n} \frac{\Gamma(\tfrac 1 2)}{\Gamma(\tfrac 1 2 - n)}\\ & = \frac{(-1)^n}{\sqrt{2 \Sigma}} (-\Delta)^{-\tfrac{1}{2} - n} \frac{\Gamma(\tfrac 1 2)}{\Gamma(\tfrac 1 2 - n)} \\ & = (-1)^n (2 \Sigma)^{n} \frac{\Gamma(\tfrac 1 2)}{\Gamma(\tfrac 1 2 - n)} \end{align}

Hence $$\boxed{\mathbb E[X^{2n}] = (- 2 \Sigma)^{n} \frac{\Gamma(\tfrac 1 2)}{\Gamma(\tfrac 1 2 - n)}} \ \ \ (\text{s.t. } {n= 1,2,3,...})$$

One can check you recover the @heropup's answer.