# Probability of new random variables that depent in 2 other random independent variable

You have 2 independent random variables with pdfs $$f_X(x)=0.25[u(x)-u(x-4)] \quad \text{and} \quad f_Y(y)=e^{-y}u(y).$$

Define new random variable by $$Z= \begin{cases} Y, & X \le 2\\ X, & X >2\end{cases}$$ Calculate: $$\mathbb{P}(Z\le2)$$.

So here I am stuck and do not know how to proceed, the only hint my lecturer said: using in "Law of total probability",I dont know how to connect the new r/v Z to X Y and . Please help

Compute $$\mathbb{P}[X\le 2]$$ from the pdf. Then you have $$\begin{split} \mathbb{P}[Z \le 2] &= \mathbb{P}[Z \le 2, X > 2] + \mathbb{P}[Z \le 2, X \le 2] \\ &= \mathbb{P}[Z \le 2| X > 2] \mathbb{P}[X>2] + \mathbb{P}[Z \le 2| X \le 2] \mathbb{P}[X\le 2]\\ \end{split}$$ Now plug in the definition of $$Z$$ and it should convert nicely to what you can deal with.
• @Knowledge The trick to condition on the interesting event is a classic one. The missing step in the middle is $\mathbb{P}[Z \le 2] = \mathbb{P}[Z \le 2, X \le 2 \text{ or } X > 2]$ where the second event partitions the entirety of the event universe, i.e. exactly one of $X \le 2 \text{ or } X > 2$ must always be true. – gt6989b May 28 at 15:19
• @Knowledge in order to understand whether $Z$ is defined with the top branch (and depends on $Y$) or on the bottom branch (and depends on $X$), you need to know the status of an additional event (which here is $X \le 2$). You condition on that event, which gives you 2 different branches to consider, and then convert your expressions in $Z$ to $X$ or $Y$, depending on which branch you are in. – gt6989b May 28 at 16:26