Post · 5 min read· pp. 271–274

4.3.3 Solved Problems: Mixed Random Variables


Video Available Video Available

Problem

Here is one way to think about a mixed random variable. Suppose that we have a discrete random variable XdX_d with (generalized) PDF and CDF fd(x)f_d(x) and Fd(x)F_d(x), and a continuous random variable XcX_c with PDF and CDF fc(x)f_{c}(x) and Fc(x)F_c(x). Now we create a new random variable XX in the following way. We have a coin with P(H)=pP(H)=p. We toss the coin once. If it lands heads, then the value of XX is determined according to the probability distribution of XdX_d. If the coin lands tails, the value of XX is determined according to the probability distribution of XcX_c.

  1. Find the CDF of X,FX(x)X, F_X(x).
  2. Find the PDF of X,fX(x)X, f_X(x).
  3. Find EXEX.
  4. Find Var(X)(X).
  • Solution
      1. Find the CDF of X,FX(x)X, F_X(x): We can write

        FX(x)F_X(x)=P(X≤x)=P(X \leq x)
        =P(X≤x∣H)P(H)+P(X≤x∣T)P(T)(law of total probability)=P(X \leq x |H) P(H)+P(X \leq x |T) P(T) \textrm{(law of total probability)}
        =pP(Xd≤x)+(1−p)P(Xc≤x)=p P(X_d \leq x)+(1-p)P(X_c \leq x)
        =pFd(x)+(1−p)Fc(x)=p F_d(x)+(1-p)F_c(x).
      2. Find the PDF of X,fX(x)X, f_X(x): By differentiating FX(x)F_X(x), we obtain

        fX(x)f_X(x)=dFX(x)dx=\frac{dF_X(x)}{dx}
        =pfd(x)+(1−p)fc(x)=p f_d(x)+(1-p)f_c(x).
      3. Find EXEX: We have

        EXEX=∫−∞∞xfX(x)dx=\int_{-\infty}^{\infty} xf_X(x)dx
        =p∫−∞∞xfd(x)dx+(1−p)∫−∞∞xfc(x)dx=p \int_{-\infty}^{\infty} xf_d(x)dx+(1-p)\int_{-\infty}^{\infty} xf_c(x)dx
        =pEXd+(1−p)EXc=pEX_d+(1-p)EX_c.
      4. Find Var(X)(X):

        EX2EX^2=∫−∞∞x2fX(x)dx=\int_{-\infty}^{\infty} x^2f_X(x)dx
        =p∫−∞∞x2fd(x)dx+(1−p)∫−∞∞x2fc(x)dx=p \int_{-\infty}^{\infty} x^2f_d(x)dx+(1-p)\int_{-\infty}^{\infty} x^2f_c(x)dx
        =pEXd2+(1−p)EXc2=pEX^2_d+(1-p)EX^2_c.

        Thus,

        Var(X)\textrm{Var}(X)=EX2−(EX)2=EX^2-(EX)^2
        =pEXd2+(1−p)EXc2−(pEXd+(1−p)EXc)2=pEX^2_d+(1-p)EX^2_c- (pEX_d+(1-p)EX_c)^2
        =pEXd2+(1−p)EXc2−p2(EXd)2−(1−p)2(EXc)2−2p(1−p)EXdEXc=pEX^2_d+(1-p)EX^2_c-p^2(EX_d)^2-(1-p)^2 (EX_c)^2-2p(1-p)EX_d EX_c
        =p(EXd2−(EXd)2)+(1−p)(EXc2−(EXc)2)+p(1−p)(EXd−EXc)2=p(EX^2_d-(EX_d)^2)+(1-p)(EX^2_c-(EX_c)^2)+p(1-p)(EX_d-EX_c)^2
        =pVar(Xd)+(1−p)Var(Xc)+p(1−p)(EXd−EXc)2=p\textrm{Var}(X_d)+(1-p)\textrm{Var}(X_c)+p(1-p)\big(EX_d-EX_c\big)^2.

Problem

Let XX be a random variable with CDF \begin{equation} \nonumber F_X(x) = \left{ \begin{array}{l l} 1 & \quad x \geq 1 \ \frac{1}{2}+\frac{x}{2} & \quad 0 \leq x < 1 \ 0 & \quad x < 0 \end{array} \right. \end{equation}

  1. What kind of random variable is X: discrete, continuous, or mixed?
  2. Find the PDF of X, fX(x)f_X (x).
  3. Find E(eX)E(e^X).
  4. Find P(X=0∣X≤0.5)P(X=0|X \leq 0.5).
  • Solution
      1. What kind of random variable is X: discrete, continuous, or mixed? We note that the CDF has a discontinuity at x=0x=0, and it is continuous at other points. Since FX(x)F_X(x) is not flat in other locations, we conclude XX is a mixed random variable. Indeed, we can write

        FX(x)=12u(x)+12FY(x),F_X(x)=\frac{1}{2} u(x)+ \frac{1}{2} F_Y(x),
        where YY is a Uniform(0,1)Uniform(0,1) random variable. If we use the interpretation of Problem 1, we can say the following. We toss a fair coin. If it lands heads then X=0X=0, otherwise XX is obtained according the a Uniform(0,1)Uniform(0,1) distribution.

      2. Find the PDF of X, fX(x)f_X (x): By differentiating the CDF, we obtain

        fX(x)=12δ(x)+12fY(x),f_X(x)=\frac{1}{2} \delta(x)+ \frac{1}{2} f_Y(x),
        where fY(x)f_Y(x) is the PDF of Uniform(0,1)Uniform(0,1), i.e., \begin{equation} \nonumber f_Y(x) = \left{ \begin{array}{l l} 1 & \quad 0 < x < 1 \ 0 & \quad \text{otherwise} \end{array} \right. \end{equation}

      3. Find E(eX)E(e^X): We can use LOTUS to write

        E(eX)E(e^X)=∫−∞∞exfX(x)dx=\int_{-\infty}^{\infty} e^xf_X(x)dx
        =12∫−∞∞exδ(x)dx+12∫−∞∞exfY(x)dx=\frac{1}{2} \int_{-\infty}^{\infty} e^x \delta(x)dx+ \frac{1}{2} \int_{-\infty}^{\infty} e^x f_Y(x)dx
        =12e0+12∫01exdx=\frac{1}{2} e^0+\frac{1}{2} \int_{0}^{1} e^x dx
        =12+12(e−1)=\frac{1}{2}+\frac{1}{2}(e-1)
        =12e=\frac{1}{2}e.

        Here is another way to think about this part: similar to part (c) of Problem 1, we can write

        E(eX)E(e^X)=12×e0+12E[eY]=\frac{1}{2} \times e^{0} + \frac{1}{2} E[e^Y]
        =12+12∫01eydy=\frac{1}{2} +\frac{1}{2} \int_{0}^{1} e^y dy
        =12e=\frac{1}{2}e.
      4. Find P(X=0∣X≤0.5)P(X=0|X \leq 0.5): We have

        P(X=0∣X≤0.5)P(X=0|X \leq 0.5)=P(X=0,X≤0.5)P(X≤0.5)=\frac{P(X=0, X \leq 0.5)}{P(X \leq 0.5)}
        =P(X=0)P(X≤0.5)=\frac{P(X=0)}{P(X \leq 0.5)}
        =0.5∫00.5fX(x)dx=\frac{0.5}{\int_{0}^{0.5}f_X(x)dx}
        =0.50.75=23=\frac{0.5}{0.75}=\frac{2}{3}.

Problem

Let XX be a Uniform(−2,2)Uniform(-2,2) continuous random variable. We define Y=g(X)Y=g(X), where the function g(x)g(x) is defined as \begin{equation} \nonumber g(x)=\left{ \begin{array}{l l} 1 & \quad x > 1 \ x & \quad 0 \leq x \leq 1\ 0 & \quad \text{otherwise} \end{array} \right. \end{equation} Find the CDF and PDF of YY.

  • Solution
    • Note that RY=[0,1]R_Y=[0,1]. Therefore,
      FY(y)=0,fory<0,F_Y(y)=0, \quad \textrm{for} \quad y<0,
      FY(y)=1,fory≥1.F_Y(y)=1, \quad \textrm{for} \quad y \geq 1.
      We also note that
      P(Y=0)=P(X<0)=12,P(Y=0)=P(X < 0)=\frac{1}{2},
      P(Y=1)=P(X>1)=14.P(Y=1)=P(X > 1)=\frac{1}{4}.
      Also for $0 < y < 1$,
      FY(y)=P(Y≤y)=P(X≤y)=FX(y)=y+24.F_Y(y)=P(Y \leq y)= P(X \leq y)=F_X(y)=\frac{y+2}{4}.
      Thus, the CDF of YY is given by \begin{equation} \nonumber F_Y(y)=\left{ \begin{array}{l l} 1 & \quad y \geq 1 \ \frac{y+2}{4} & \quad 0 \leq y < 1\ 0 & \quad \text{otherwise} \end{array} \right. \end{equation} In particular, we note that there are two jumps in the CDF, one at y=0y=0 and another at y=1y=1. We can find the generalized PDF of YY by differentiating FY(y)F_Y(y):
      fY(y)=12δ(y)+14δ(y−1)+14(u(y)−u(y−1)).f_Y(y)=\frac{1}{2} \delta(y)+\frac{1}{4} \delta(y-1)+\frac{1}{4} (u(y)-u(y-1)).