# Density function of random variable $|X|$

Suppose $X$ is uniformly distributed over $(-1,1)$. Can someone explain to me what it means to find the density function of random variable $|X|$? Is it the same with the probability density function, which is $\frac{1}{2}$ on $(-1,1)$.

• The rv $Y=|X|$ only takes values between $0$ and $1$, and has continuous distribution. We want the density function of $Y$ in the ordinary sense. One way to find it is to find the cdf $F_Y(y)$ of $Y$ and then differentiate. Note that $F_Y(y)=\Pr(Y\le y)=\Pr(-y\le X\le y)$. – André Nicolas Nov 17 '15 at 4:55
• One could do it more quickly, it is almost obvious that $Y$ is uniform on $(0,1)$. But you should go through the calculation. – André Nicolas Nov 17 '15 at 4:57
• $F_Y(y) = P\{Y \leq y\} = P\{|x| \leq y\} = P\{ -y \leq x \leq y\} = \int_{-y}^{y}f(x)dx = y$. Then $f_Y = 1$. Is that correct? – Paichu Nov 17 '15 at 5:20
• Correct, in the interval $(0,1)$, and $0$ elsewhere. I am assuming your first $|X|$ is a typo, you meant $X$ is uniform on $(-1,1)$. – André Nicolas Nov 17 '15 at 5:56

I am assuming that you did not make a typo, meaning you are given that $|X|$ follows a $\text{unif}(-1,1)$. Then you are simply looking for a height $h$ that makes the the area over $(-1,1)$ equal 1: $$h\cdot(1-(-1)) = 1.$$ implies that $h = 1/2$.
If you meant "Suppose $X\sim \text{unif}(-1,1)$, find the density of $|X|$", then that is a different problem. This is probably an exercise in using a many-to-one change of variable. If that is the case, then yes, let $Y = |X|$. Then $$f_Y(y) = 1.$$