Question about variance and expected value of $X\sim N(\mu,\sigma^2)$

608 Views Asked by At

I have a random variable $X\sim N(\mu,\sigma^2)$. Assume I define $Y=|X|$ , How can I find Y's variance and expected value?

First I calculated its density directly and if I'm not mistaken it's $f_Y(x)=\frac{1}{\sqrt{2\pi}}(e^{\frac{-(\frac{x-\mu}{\sigma})^2}{2}}-e^{\frac{-(\frac{x+\mu}{\sigma})^2}{2}})$.

Now $\mathbb{E}[Y]=\mu\sigma$ but $\mathbb{E}[Y^2]=\displaystyle\int_{-\infty}^{\infty}x^2 f_Y(x)dx$ but I'm stuck with integrating this. The derivative of $e^{\frac{-(\frac{x-\mu}{\sigma})^2}{2}}$ is $2\frac{(x-\mu)}{\sigma^2}e^{\frac{-(\frac{x-\mu}{\sigma})^2}{2}}$. Can I calculate the variance of Y in another way?