P.d.f of the absolute value of a normally distributed variable
I came across this question as an exercise, had a brief idea, but didn't know how to proceed.
Let $X \sim N(0, 1)$. What is the p.d.f of $|X|$ ?
I know the final p.d.f looks just like the right half of the original pdf, but extended vertically for a factor of 2.
Could someone please show mathematically what the p.d.f of variable |X| is going to be, and explain briefly? Thank you.
You can to take the cdf as a starting point.
$P(|X| \leq x)=P(-x \leq X \leq x)$
$X\sim \mathcal N(0,1)$
$=P(X \leq x)-P(X \leq -x)$
$=P(X \leq x)-\left[ 1-P(X \leq x) \right]$
$=2 \cdot P(X \leq x)-1=2\cdot F(x)-1=2 \cdot \lim\limits_{a \to -\infty} \int_{a}^x \frac{1}{\sqrt{2\cdot \pi}}\cdot e^{-\frac{{(t-\mu)}^2}{2 \sigma ^2}} \, dt-1$
$=2\cdot F(x)-2\cdot F(a)-1$
Differentiating :
$$2\cdot \frac{dF(x)}{dx}-2\cdot \frac{dF(a)}{dx}-0=2\cdot f(x)-0-0=2\cdot f(x)$$
$$=2\cdot \frac{1}{\sqrt{2\cdot \pi}}\cdot e^{-\frac{{(x-\mu)}^2}{2 \sigma ^2}}, \quad \forall \ x\geq 0$$
$-1$ and $F(a)$ are constants.