# CDF of a mixed stochastic variable

There is an example of a mixed stochastic variable in my probability course for which they define the cdf.

The details are as follows:

Let $X$ be a s.v. with probability distribution: $$P(X=0) = P(X=1) = \frac{1}{2}$$

Let $Y$ be a s.v. with uniform distribution on the interval $[200,500]$. We denote $Y \sim \mathcal{U}[200,500]$ with the following density function: $$f_{200,500}(y) = \frac{1}{500-200}\mathbb{1}_{[200,500]}(y)$$ with $\mathbb{1}(y)_{[200,500]} = 1$ if $y \in [200,500]$ (and zero otherwise).

Assume Y is independent of X.

We define $Z$ as: $$Z = 100 \cdot \mathbb{1}_{\{X=0\}} + Y \cdot \mathbb{1}_{\{X=1\}}.$$

Find the cdf (cummulative distribution function) of $Z$.

The solution is given in my course notes, and intuitively I understand it but in practice I'm not able to find this cdf. Is there a 'standard' approach to this?

$Z$ is a random variable which is either 100 with probability $1/2$ or $Y$ with probability $1/2$. Thus it is a sum of a Dirac delta $1/2*\delta(z -100)$ + $1/2*f_Y(z)$. The distribution of $Y$ is given by you above.
In general, the random variables may not be independent. In which case, for any given $z$, we should sum (or integrate) over all $(x,y)$ that can generate z, weight it with the joint distribution of $X,Y$.
$$P (Z \le z) = \int_{(x,y) \, s.t \, Z \le z}f_{X,Y}(x,y).$$
Note \begin{align*} \Pr[Z\leq z]&=\Pr[Z\leq z|X=0]\Pr[X=0]+\Pr[Z\leq z|X=1]\Pr[X=1]\\ &=\Pr[100\leq z|X=0]\Pr[X=0]+\Pr[Y\leq z|X=1]\Pr[X=1]\\ &=\frac{1}{2}I(z\geq 100)+\frac{1}{2}I(z\geq 200)\min\left\{\frac{z-200}{300},1\right\}. \end{align*} Here, $I(\cdot)$ is the indicator function.