# Find CDF of random variable which depends on other variable

Let $X$ be a random variable with uniform distribution on $[-1, 1]$. Find the CDF of random variable Y given by the following formula:

$Y = \left\{\begin{matrix} -\frac{1}{2},& X < - \frac{1}{2}\\ X,& -\frac{1}{2} \leq X \leq \frac{1}{4}\\ \frac{1}{4}, & X > \frac{1}{4} \end{matrix}\right.$

So I've found PDF and CDF of $X$:

$f_X(x) = \begin{cases} \frac{1}{2}, & x \in [-1, 1]\\ 0, & \text{otherwise} \end{cases}$

$F_X(a) = \int_{-\infty}^{a} f_X(x) dx = \left\{\begin{matrix} 0, & a \leq -1\\ \frac{a+1}{2}, & a \in (-1, 1) \\ 1, & a \geq 1 \end{matrix}\right.$

I tried to find Y's CDF by:

$F_Y(a) = P(Y \leq a)$

$= P(-\frac{1}{2} \leq a, X < - \frac{1}{2}) + P(X \leq a, - \frac{1}{2} \leq X \leq \frac{1}{4}) + P(\frac{1}{4} \leq a, X > -\frac{1}{4})$

But what should I do next? I'm finding such CDF for the first time and my notes say I need to consider a few different cases, but I have no clue what they should look like and how to do it. Any tips would be helpful.

Tip: You can find a CDF, but not a pdf, for all points on the support.

Notice that $Y$ will have a support of the interval $[-\tfrac 12;\tfrac 14]$, but will have a probability mass at the two end points, with a probability density in the interval between.   It is a mixed distribution.

That is $~\mathsf P(Y{=}-\tfrac 12)~=~\mathsf P(-1{\leq}X{<}-\tfrac 12)~$ and $~\mathsf P(Y{=}\tfrac 14)~=~\mathsf P(\tfrac 14{<}X{\leq}1)~$.

So then

$$F_Y(a)~=~\mathsf P(Y\leq a) ~=~ \begin{cases} 0 &:& a<-\tfrac 12\\ \tfrac {2a+3}4 & : & -\tfrac 12\leq a < \tfrac 14 \\ 1 &:& \tfrac 14 \leq a \end{cases}$$

If you've peeked, notice the step discontinuities.

Note that $P(Y\leq y) = \int_\mathbb{R} P(Y \leq Y | X = x) f_X(x) dx$ by the law of total probability.

You can split the integral up by $x< -1/2$, $-1/2 \leq x \leq 1/4$ and $x> 1/4$ and do it.