Distribution of this strange combination of two random variables We have two independent random variables $\gamma_1$ and $\gamma_2$ and we know their CDFs, given by $F_{\gamma_1}(x)$ and $F_{\gamma_2}(x)$. We select a threshold $\gamma_T$ and then we define a random variable $Z$ as follows:
If $\gamma_2 < \gamma_T$, then $Z = \max(\gamma_1, \gamma_2)$.
If $\gamma_2 \geq \gamma_T$, then $Z = \gamma_2$.
I am trying to calculate the CDF of $Z$, $F_Z(x)$.
For the first case ($\gamma_2 < \gamma_T$) I know that $F_Z(x) = F_{\gamma_1}(x) \cdot F_{\gamma_2}(x)$, however I am unable to calculate the CDF for the second case ($\gamma_2 \geq \gamma_T$).
For the second case I have tried $F_Z(x) = F_{\gamma_1}(\gamma_T) \cdot F_{\gamma_2}(\gamma_T) + F_{\gamma_2}(x) - F_{\gamma_2}(\gamma_T)$ but comparing to simulations it doesn't seem to be the correct solution.
I have also checked Example 6-17 in page 193 of the book of Papoulis (4th edition), which I think is related, but I'm not sure how to do the calculation.
Any ideas?
 A: The threshold  partitions the range of $\gamma_2$ into $I_l:=(-\infty,\gamma_T)$ and $I_u:= [\gamma_T,\infty)$.
We need to use conditional probability to get the definition of $Z$:
$$P(Z\leq z) = P(\gamma_2 \in I_l)P(Z\leq z|\gamma_2 \in I_l) + P(\gamma_2 \in I_u)P(Z\leq z|\gamma_2 \in I_u)$$
Case 1: $\gamma_2 \in I_l$
$$P(Z\leq z|\gamma_2 \in I_l) = P(\gamma_1\leq z)P(\gamma_2\leq z|\gamma_2\in I_l)=F_{\gamma_1}(z)\cdot\min\left(1,\frac{F_{\gamma_2}(z)}{F_{\gamma_2}(\gamma_T)}\right)$$
Case 2: $\gamma_2 \in I_u$
$$P(Z\leq z|\gamma_2 \in I_u) = P(\gamma_2\leq z|\gamma_2\in I_u)=\mathbf{1}_{I_u}(z)\cdot\left(\frac{F_{\gamma_2}(z)-F_{\gamma_2}(\gamma_T)}{1-F_{\gamma_2}(\gamma_T)}\right)$$
Putting these into the overall $P(z\leq Z)$ equation we get:
$$P(Z\leq z) = F_{\gamma_2}(\gamma_T)\cdot F_{\gamma_1}(z)\cdot\min\left(1,\frac{F_{\gamma_2}(z)}{F_{\gamma_2}(\gamma_T)}\right) + (1-F_{\gamma_2}(\gamma_T))\cdot\mathbf{1}_{I_u}(z)\cdot\left(\frac{F_{\gamma_2}(z)-F_{\gamma_2}(\gamma_T)}{1-F_{\gamma_2}(\gamma_T)}\right)$$
Simplifying we get
$$P(Z\leq z) = F_{\gamma_1}(z)\cdot\min\left(F_{\gamma_2}(\gamma_T),F_{\gamma_2}(z)\right) + \mathbf{1}_{I_u}(z)\cdot \left(F_{\gamma_2}(z)-F_{\gamma_2}(\gamma_T)\right)$$
