Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need help with the following problem. Suppose $Z=N(0,s)$ i.e. normally distributed random variable with standard deviation $\sqrt{s}$. I need to calculate $E[Z^2]$. My attempt is to do something like \begin{align} E[Z^2]=&\int_0^{+\infty} y \cdot Pr(Z^2=y)dy\\ =& \int_0^{+\infty}y\frac{1}{\sqrt{2\pi s}}e^{-\frac y{2s}}dy\\ =&\frac{1}{\sqrt{2\pi s}}\int_0^{\infty}ye^{-\frac y{2s}}dy. \end{align}

By using integration by parts we get

$$\int_0^{\infty}ye^{-\frac y{2s}}dy=\int_0^{+\infty}2se^{-\frac y{2s}}dy=4s^2.$$

Hence $E[Z^2]=\frac{2s\sqrt{2s}}{\sqrt{\pi}},$ which does not coincide with the answer in the text. Can someone point the mistake?

share|cite|improve this question
Note that $\Pr(Z^2=y)=0$, identically. In fact you might want to debunk thoroughly the misconceptions which led you to write the identity where this quantity appears. – Did Mar 23 '13 at 7:55
Any luck with my suggestion above? – Did Mar 29 '13 at 7:58

This is old, but I feel like an easy derivation is in order.

The variance of any random variable $X$ can be written as $$ V[X] = E[X^2] - (E[X])^2 $$

Solving for the needed quantity gives $$ E[X^2] = V[X] + (E[X])^2 $$

But for our case, $E[X] = 0$, so the answer of $\sigma^2$ is immediate.

share|cite|improve this answer

The answer is $s = \sigma^2$. The integral you want to evaluate is

$$E[Z^2] = \frac{1}{\sqrt{2 \pi} \sigma} \int_{-\infty}^{\infty} dz \: z^2 \exp{(-\frac{z^2}{2 \sigma^2})}$$

share|cite|improve this answer
The answer should be $s$ because $s=\sigma^2$. I am curios what is wrong with the method I wrote. – John Peter Dec 23 '12 at 10:54
Your method is wrong because you misunderstand the definition of expected value. The expected value of a random variable $Z$ having probability distribution $f(z)$ is $\int_{-\infty}^{\infty} dz \: z f(z) $. For the expected value of a function $g(Z)$, the result is $\int_{-\infty}^{\infty} dz \: g(z)f(z) $. – Ron Gordon Dec 23 '12 at 11:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.