$X \sim N(0, 1)$
$$E(|X|) = \frac1{\sqrt{2\pi}}\int_{-\infty}^{\infty}|x|e^{-x^2/2}dx= \frac{2}{\sqrt{2\pi}}\int_{0}^{\infty}xe^{-x^2/2}dx=\sqrt{\frac{2}{\pi}}$$
I don't understand how the last equality was arrived at. Why is it seemingly obvious that $\int_{0}^{\infty}xe^{-x^2/2}dx= 1$?
Is this some common identity?
Here are the steps that help make it obvious,
\[ \int_0^\infty xe^{\frac{-x^2}{2}} dx = \lim_{\beta \to \infty}\int_0^\beta xe^{\frac{-x^2}{2}} dx \] Let $u=\frac{-x^2}{2}$ then, \[ \frac{d}{dx}u = -x \Rightarrow du = -x\ dx \Rightarrow-du=x\ dx \] So now after adjusting the limits, we have \[ \lim_{\beta \to -\infty}-\int_0^\beta e^{u}\ du = \lim_{\beta \to -\infty}\int_\beta^0 e^{u}\ du = \lim_{\beta \to -\infty} e^u\Bigg|^0_\beta = \lim_{\beta \to -\infty}\left(e^0 - e^\beta\right) = 1 - 0 = 1 \] I hope this helps you understand the equation.