[Math] Find the pdf of $Y = g(X)$, where $X$ is a uniform random variable

probability distributionsrandom variablesstatisticsuniform distribution

The question is as follows:

Let $X$ be a uniform random variable over $(-1,2)$. Let $g(x) = |x|$. Find the pdf of $Y = g(X)$.

And here is my take so far:

$$f(x) = \begin{cases} 1/2 & \text{ if } -1 \leq x \leq 2, \\
0 & \text{ otherwise.}
\end{cases}$$

The cdf of $Y$: $F_Y(y) = P(Y \leq y) = P(|X| \leq y)$.

and from here I know I have to divide intervals but I don't know how to do that. I assume I have to divide it in $4$ different cases where if $y > 0$, if $y > 2$, or $0 < y <2$, $y > 2$? And find cdf and take derivative to find pdf.

Best Answer

Yes, we will have to divide into cases. There are two uninteresting cases, (i) $y\le 0$ and (ii) $y\ge 2$. If $y\le 0$, then $F_Y(y)=\Pr(Y\le y)=0$. If $y\ge 2$ then $\Pr(Y\le y)=1$.

The other two cases are (iii) $0\le y\le 1$ and (iv) $1\lt y\lt 2$.

Case (iii): We have $Y\le y$ if and only if $-y\le X\le y$. The density function of $X$ on the interval $(-1,2)$ is $\frac{1}{3}$. So $\Pr(-y\le X\le y)=\frac{2y}{3}$.

Case (iv): Here $Y\le y$ if and only if $-1\le X\le y$. This interval has length $y-(-1)$, so $F_Y(y)=\frac{y+1}{3}$.

Finally, differentiate $F_Y(y)$ to find the density function of $Y$.