4.3.1 Mixed Random Variables
Here, we will discuss mixed random variables. These are random variables that are neither discrete nor continuous, but are a mixture of both. In particular, a mixed random variable has a continuous part and a discrete part. Thus, we can use our tools from previous chapters to analyze them. In this section, we will provide some examples on how we can do this. Then in section 4.3.2, we will revisit the concept of mixed random variables using the delta "function."
Example
Let $X$ be a continuous random variable with the following PDF: \begin{equation} \nonumber f_X(x) = \left\{ \begin{array}{l l} 2x & \quad 0 \leq x \leq 1\\ 0 & \quad \text{otherwise} \end{array} \right. \end{equation} Let also \begin{equation} \nonumber Y=g(X) = \left\{ \begin{array}{l l} X & \quad 0 \leq X \leq \frac{1}{2}\\ \frac{1}{2} & \quad X>\frac{1}{2} \end{array} \right. \end{equation} Find the CDF of $Y$.
 Solution

First we note that $R_X=[0,1]$. For $x \in [0,1]$, $0 \leq g(x) \leq \frac{1}{2}$. Thus, $R_Y=[0,\frac{1}{2}]$, and therefore $$F_Y(y)=0, \hspace{20pt} \textrm{ for } y < 0,$$ $$F_Y(y)=1, \hspace{20pt} \textrm{ for } y > \frac{1}{2}.$$ Now note that
$P\left(Y=\frac{1}{2}\right)$ $=P\left(X>\frac{1}{2}\right)$ $=\int_{\frac{1}{2}}^{1} 2x dx=\frac{3}{4}.$
Also, for $0 < y < \frac{1}{2}$,$F_Y(y)$ $=P(Y \leq y)$ $=P(X \leq y)$ $=\int_{0}^{y} 2x dx$ $=y^2.$
Thus, the CDF of $Y$ is given by \begin{equation} \nonumber F_Y(y) = \left\{ \begin{array}{l l} 1 & \quad y \geq \frac{1}{2}\\ y^2 & \quad 0 \leq y < \frac{1}{2}\\ 0 & \quad \text{otherwise} \end{array} \right. \end{equation} Figure 4.9 shows the CDF of $Y$. We note that the CDF is not continuous, so $Y$ is not a continuous random variable. On the other hand, the CDF is not in the staircase form, so it is not a discrete random variable either. It is indeed a mixed random variable. There is a jump at $y=\frac{1}{2}$, and the amount of jump is $1\frac{1}{4}=\frac{3}{4}$, which is the probability that $Y=\frac{1}{2}$. The CDF is continuous at other points.The CDF of $Y$ has a continuous part and a discrete part. In particular, we can write $$F_Y(y)=C(y)+D(y),$$ where $C(y)$ is the continuous part of $F_Y(y)$, i.e., \begin{equation} \nonumber C(y) = \left\{ \begin{array}{l l} \frac{1}{4} & \quad y \geq \frac{1}{2}\\ y^2 & \quad 0 \leq y < \frac{1}{2}\\ 0 & \quad y < 0 \end{array} \right. \end{equation} The discrete part of $F_Y(y)$ is $D(y)$, given by \begin{equation} \nonumber D(y) = \left\{ \begin{array}{l l} \frac{3}{4} & \quad y \geq \frac{1}{2}\\ 0 & \quad y < \frac{1}{2} \end{array} \right. \end{equation}

In general, the CDF of a mixed random variable $Y$ can be written as the sum of a continuous function and a staircase function: $$F_Y(y)=C(y)+D(y).$$ We differentiate the continuous part of the CDF. In particular, let's define $$c(y)=\frac{dC(y)}{dy}, \textrm{ wherever }C(y) \textrm{ is differentiable.}$$ Note that this is not a valid PDF as it does not integrate to one. Also, let $\{y_1,y_2,y_3,...\}$ be the set of jump points of $D(y)$, i.e., the points for which $P(Y=y_k)>0$. We then have $$\int_{\infty}^{\infty} c(y) dy+ \sum_{y_k} P(Y=y_k)=1.$$ The expected value of $Y$ can be obtained as $$EY=\int_{\infty}^{\infty} yc(y) dy+ \sum_{y_k} y_k P(Y=y_k).$$
Example
Let $Y$ be the mixed random variable defined in Example 4.14.
 Find $P(\frac{1}{4} \leq Y \leq \frac{3}{8})$.
 Find $P(Y \geq \frac{1}{4})$.
 Find $EY$.
 Solution

Since we have the CDF of $Y$, we can find the probability that $Y$ is in any given interval. We should pay special attention if the interval includes any jump points.
 Find $P(\frac{1}{4} \leq Y \leq \frac{3}{8})$: We can write
$P\left(\frac{1}{4} \leq Y \leq \frac{3}{8}\right)$ $=F_Y\left(\frac{3}{8}\right)F_Y\left(\frac{1}{4}\right)+P\left(Y=\frac{1}{4}\right)$ $=\left(\frac{3}{8}\right)^2\left(\frac{1}{4}\right)^2+0=\frac{5}{64}.$  Find $P(Y \geq \frac{1}{4})$: We have
$P\left(Y \geq \frac{1}{4}\right)$ $=1F_Y\left(\frac{1}{4}\right)+P\left(Y=\frac{1}{4}\right)$ $=1\left(\frac{1}{4}\right)^2=\frac{15}{16}.$  Find $EY$: Here, we can differentiate the continuous part of the CDF to obtain
\begin{equation}
\nonumber c(y)=\frac{dC(y)}{dy}= \left\{
\begin{array}{l l}
2y & \quad 0 \leq y \leq \frac{1}{2}\\
0 & \quad \textrm{otherwise}
\end{array} \right.
\end{equation}
So, we can find $EY$ as
$EY$ $=\int_{0}^{\frac{1}{2}}y (2y) dy+ \frac{1}{2} P\left(Y=\frac{1}{2}\right)$ $=\frac{1}{12}+\frac{3}{8}=\frac{11}{24}.$
 Find $P(\frac{1}{4} \leq Y \leq \frac{3}{8})$: We can write
