I am trying to compute the expected value, E$[x]$, of a random variable $X\sim\mathcal{N}(\mu,\sigma^2)$. The density function of the normal distribution is $$f_X(x)=\frac{1}{\sigma \sqrt{2\pi}}\exp\left(-\left(\frac{x-\mu}{\sigma\sqrt{2}}\right)^2\right), \ \ \ -\infty<x<\infty.$$

I am attempting to use the following substitution to help find the expected value: $$y=\frac{x-\mu}{\sigma\sqrt{2}}\implies dx=\sigma\sqrt{2} dy \tag{1}.$$

The expected value is computed as \begin{align} \text{E}[x]&=\int_{-\infty}^{\infty} x f_X(x) \ dx \\ &=\frac{1}{\sigma \sqrt{2\pi}}\int_{-\infty}^{\infty} x\exp\left(-\left(\frac{x-\mu}{\sigma\sqrt{2}}\right)^2\right) \ dx \\ &=\frac{1}{\sqrt{\pi}}\int_{-\infty}^{\infty}(\mu+\sigma\sqrt{2} y)\exp(-y^2)\ dy \ \ \ \ \text{(using substitution $(1)$)} \\ &=\frac{\mu}{\sqrt{\pi}}\int_{-\infty}^{\infty} \exp(-y^2) \ dy \ + \ \sigma\sqrt{\frac{2}{\pi}}\int_{-\infty}^{\infty} y\exp(-y^2) \ dy \\ &=\sigma\sqrt{\frac{2}{\pi}}\left(\left[-\frac{1}{2}\exp(-y^2)\right]_{-\infty}^{\infty}+\frac{1}{2}\int_{-\infty}^{\infty}\frac{\exp(-y^2)}{y} \ dy\right). \end{align} I am unsure what this simplifies to (specifically how to deal with the final integral). I've noticed that the integrand is odd (does the integral simply cancel?).

  • $\begingroup$ Try $\endgroup$
    – BruceET
    Commented Feb 23, 2021 at 7:58
  • $\begingroup$ @BruceET Thanks. I have read the solution and agree with the result. However, I'm wondering if my method will work. It seems the most intuitive to me. $\endgroup$
    – M B
    Commented Feb 23, 2021 at 8:00

1 Answer 1


Your substitution is terrible but it must work as well! the natural substitution is


Using this (in this case you are standardizing your Gaussian) the result is very easy.

Considering valid your procedure, reading your last but one passage, the sum is the following

$$\frac{\mu}{\sqrt{\pi}}\cdot \sqrt{\pi}+0=\mu$$

this because the first integral is the Gaussian integral (in the link you can find the easy proof too) and the second is the integral of an odd function over a symmetric domain around zero.

  • $\begingroup$ Would you suggest that I instead use the substitution $$Y=\frac{X-\mu}{\sigma}?$$ If it's easier, it's probably a good idea. It never occurred to me. $\endgroup$
    – M B
    Commented Feb 23, 2021 at 8:27
  • 1
    $\begingroup$ @MB the substitution I suggested you is the more natural but the passages are more or less the same as yours $\endgroup$
    – tommik
    Commented Feb 23, 2021 at 8:31

You must log in to answer this question.

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