Post · 12 min read· pp. 313–321

5.1.6 Solved Problems


Problem Consider two random variables XX and YY with joint PMF given in Table 5.3.

  1. Find P(X≤2,Y≤4)P(X \leq 2, Y \leq 4).
  2. Find the marginal PMFs of XX and YY.
  3. Find P(Y=2∣X=1)P(Y=2 | X=1).
  4. Are XX and YY independent?
Y=2Y = 2Y=4Y = 4Y=5Y = 5
X=1X = 1112\frac{1}{12}124\frac{1}{24}124\frac{1}{24}
X=2X = 216\frac{1}{6}112\frac{1}{12}18\frac{1}{8}
X=3X = 314\frac{1}{4}18\frac{1}{8}112\frac{1}{12}
  • Solution
      1. To find P(X≤2,Y≤4)P(X \leq 2, Y \leq 4), we can write \begin{align}%\label{} \nonumber P(X \leq 2, Y \leq 4) &=P_{XY}(1,2)+ P_{XY}(1,4)+P_{XY}(2,2)+ P_{XY}(2,4)\ \nonumber &=\frac{1}{12}+\frac{1}{24}+\frac{1}{6}+\frac{1}{12}=\frac{3}{8}. \end{align}
      2. Note from the table that \begin{align}%\label{} \nonumber R_X={1,2,3} \textrm{ and } R_Y={2,4,5}. \end{align} Now we can use Equation 5.1 to find the marginal PMFs: \begin{equation}

\nonumber P_X(x) = \left{ \begin{array}{l l} \frac{1}{6} & \quad x=1 \ & \quad \ \frac{3}{8} & \quad x=2 \ & \quad \ \frac{11}{24} & \quad x=3 \ & \quad \ 0 & \quad \text{otherwise} \end{array} \right. \end{equation} \begin{equation} \nonumber P_Y(y) = \left{ \begin{array}{l l} \frac{1}{2} & \quad y=2 \ & \quad \ \frac{1}{4} & \quad y=4 \ & \quad \ \frac{1}{4} & \quad y=5 \ & \quad \ 0 & \quad \text{otherwise} \end{array} \right. \end{equation} 3. Using the formula for conditional probability, we have \begin{align}%\label{} \nonumber P(Y=2 | X=1)&=\frac{P(X=1, Y=2)}{P(X=1)}\ \nonumber &=\frac{P_{XY}(1,2)}{P_X(1)}\ \nonumber &=\frac{\frac{1}{12}}{\frac{1}{6}}=\frac{1}{2}. \end{align} 4. Are XX and YY independent? To check whether XX and YY are independent, we need to check that P(X=xi,Y=yj)=P(X=xi)P(Y=yj)P(X=x_i,Y=y_j)=P(X=x_i)P(Y=y_j), for all xi∈RXx_i \in R_X and all yj∈RYy_j \in R_Y. Looking at the table and the results from previous parts, we find \begin{align}%\label{} \nonumber P(X=2,Y=2)=\frac{1}{6} \neq P(X=2)P(Y=2)=\frac{3}{16}. \end{align} Thus, we conclude that XX and YY are not independent.


Problem I have a bag containing $40$ blue marbles and $60$ red marbles. I choose $10$ marbles (without replacement) at random. Let XX be the number of blue marbles and yy be the number of red marbles. Find the joint PMF of XX and YY.

  • Solution
    • This is, in fact, a hypergeometric distribution. First, note that we must have X+Y=10X+Y=10, so \begin{align}%\label{} \nonumber R_{XY}&={(i,j) | i+j=10, i,j \in \mathbb{Z}, i,j \geq 0}\ \nonumber &={(0,10),(1,9),(2,8),...,(10,0)}. \end{align} Then, we can write \begin{equation} \nonumber P_{XY}(i,j)= \left{ \begin{array}{l l} \frac{{40 \choose i} {60 \choose j}}{{100 \choose 10}} & \quad i+j=10, i,j \in \mathbb{Z}, i,j \geq 0 \ 0 & \quad \text{otherwise} \end{array} \right. \end{equation}

Problem Let XX and YY be two independent discrete random variables with the same CDFs FXF_{X} and FYF_Y . Define \begin{align}%\label{} \nonumber Z=\max (X,Y), \ \nonumber W=\min(X,Y). \end{align} Find the CDFs of ZZ and WW.

  • Solution
    • To find the CDF of ZZ, we can write \begin{align}%\label{} \nonumber F_Z(z)&=P(Z \leq z) \ \nonumber &=P(\max(X,Y) \leq z)\ \nonumber &=P\bigg((X \leq z) \textrm{ and } (Y \leq z)\bigg)\ \nonumber &=P(X \leq z) P(Y \leq z) &(\textrm{ since }X \textrm{ and }Y \textrm{ are independent})\ \nonumber &=F_X(z)F_Y(z). \end{align} To find the CDF of WW, we can write \begin{align}%\label{} \nonumber F_W(w)&=P(W \leq w) \ \nonumber &=P(\min(X,Y) \leq w)\ \nonumber &=1-P(\min(X,Y) > w)\ \nonumber &=1-P\bigg((X > w) \textrm{ and } (Y > w)\bigg)\ \nonumber &=1-P(X > w) P(Y > w) &(\textrm{ since }X \textrm{ and }Y \textrm{ are independent})\ \nonumber &=1-(1-F_X(w))(1-F_Y(w))\ \nonumber &=F_X(w)+F_Y(w)-F_X(w)F_Y(w). \end{align}

Problem Let XX and YY be two discrete random variables, with range \begin{align}%\label{} \nonumber R_{XY}={(i,j) \in \mathbb{Z}^2|i,j \geq 0, |i-j|\leq 1}, \end{align} and joint PMF given by \begin{align}%\label{} \nonumber P_{XY}(i,j)=\frac{1}{6 \cdot 2^{\min(i,j)}}, \hspace{10pt} \textrm{ for }(i,j) \in R_{XY}. \end{align}

  1. Pictorially show RXYR_{XY} in the x−yx-y plane.
  2. Find the marginal PMFs PX(i)P_X(i), PY(j)P_Y(j).
  3. Find P(X=Y∣X<2)P(X=Y|X<2).
  4. Find P(1≤X2+Y2≤5)P(1 \leq X^2+Y^2 \leq 5).
  5. Find P(X=Y)P(X=Y).
  6. Find E[X∣Y=2]E[X|Y=2].
  7. Find Var(X∣Y=2)(X|Y=2).
  • Solution
      1. Figure 5.5 shows the RXYR_{XY} in the x−yx-y plane.

        Figure 5.5: Figure shows RXYR_{XY} for XX and YY in problem 4.

      2. First, by symmetry we note that XX and YY have the same PMF. Next, we can write \begin{align}\label{} \nonumber &P_X(0)=P_{XY}(0,0)+P_{XY}(0,1)=\frac{1}{6}+\frac{1}{6}=\frac{1}{3},\ \nonumber &P_X(1)=P_{XY}(1,0)+P_{XY}(1,1)+P_{XY}(1,2)=\frac{1}{6}\left(1+\frac{1}{2}+\frac{1}{2}\right)=\frac{1}{3},\ \nonumber &P_X(2)=P_{XY}(2,1)+P_{XY}(2,2)+P_{XY}(2,3)=\frac{1}{6}\left(\frac{1}{2}+\frac{1}{4}+\frac{1}{4}\right)=\frac{1}{6},\ \nonumber &P_X(3)=P_{XY}(3,2)+P_{XY}(3,3)+P_{XY}(3,4)=\frac{1}{6}\left(\frac{1}{4}+\frac{1}{8}+\frac{1}{8}\right)=\frac{1}{12}. \end{align} In general, we obtain \begin{equation}

    \nonumber P_X(k) = P_Y(k)=\left{ \begin{array}{l l} \frac{1}{3} & \quad k=0 \ & \quad \ \frac{1}{3 \cdot 2^{k-1}} & \quad k=1,2,3,... \ & \quad \ 0 & \quad \text{otherwise} \end{array} \right. \end{equation} 3. Find P(X=Y∣X<2)P(X=Y|X<2): We have \begin{align}\label{} \nonumber P(X=Y|X<2)&=\frac{P(X=Y,X<2)}{P(X<2)}\ \nonumber &=\frac{P_{XY}(0,0)+P_{XY}(1,1)}{P_X(0)+P_X(1)}\ \nonumber &=\frac{\frac{1}{6}+\frac{1}{12}}{\frac{1}{3}+\frac{1}{3}}\ \nonumber &=\frac{3}{8}. \end{align} 4. Find P(1≤X2+Y2≤5)P(1 \leq X^2+Y^2 \leq 5): We have \begin{align}\label{} \nonumber P(1 \leq X^2+Y^2 \leq 5)&=P_{XY}(0,1)+P_{XY}(1,0)+P_{XY}(1,1)+P_{XY}(1,2)+P_{XY}(2,1)\ \nonumber &=\frac{1}{6}+\frac{1}{6}+\frac{1}{12}+\frac{1}{12}+\frac{1}{12}\ \nonumber &=\frac{7}{12}. \end{align} 5. By symmetry, we can argue that P(X=Y)=13P(X=Y)=\frac{1}{3}. The reason is that RXYR_{XY} consists of three lines with points with the same probabilities. We can also find P(X=Y)P(X=Y) by \begin{align}\label{} \nonumber P(X=Y)&=\sum_{i=0}^{\infty} P_{XY}(i,i)\ \nonumber &=\sum_{i=0}^{\infty} \frac{1}{6. 2^i}\ \nonumber &=\frac{1}{3}. \end{align} 6. To find E[X∣Y=2]E[X|Y=2], we first need the conditional PMF of XX given Y=2Y=2. We have \begin{align}\label{} \nonumber P_{X|Y}(k|2) &=\frac{P_{XY}(k,2)}{P(Y=2)}\ \nonumber &=6P_{XY}(k,2), \end{align} so we obtain \begin{equation} \nonumber P_{X|Y}(k|2)=\left{ \begin{array}{l l} \frac{1}{2} & \quad k=1 \ & \quad \ \frac{1}{4} & \quad k=2,3 \ & \quad \ 0 & \quad \text{otherwise} \end{array} \right. \end{equation} Thus, \begin{align}\label{} \nonumber E[X|Y=2]&=1 \cdot \frac{1}{2}+2 \cdot \frac{1}{4}+3 \cdot \frac{1}{4}\ \nonumber &=\frac{7}{4}. \end{align} 7. Find Var(X∣Y=2)(X|Y=2): we have \begin{align}\label{} \nonumber E[X^2|Y=2]&=1 \cdot \frac{1}{2}+4 \cdot \frac{1}{4}+9 \cdot \frac{1}{4}\ \nonumber &=\frac{15}{4}. \end{align} Thus, \begin{align}\label{} \nonumber \textrm{Var}(X)&=E[X^2|Y=2]-\big(E[X|Y=2]\big)^2\ \nonumber &=\frac{15}{4}-\frac{49}{16}\ \nonumber &=\frac{11}{16}. \end{align}


Problem Suppose that the number of customers visiting a fast food restaurant in a given day is N∼Poisson(λ)N \sim Poisson(\lambda). Assume that each customer purchases a drink with probability pp, independently from other customers, and independently from the value of NN. Let XX be the number of customers who purchase drinks. Let YY be the number of customers that do not purchase drinks; so X+Y=NX+Y=N.

  1. Find the marginal PMFs of XX and YY.
  2. Find the joint PMF of XX and YY.
  3. Are XX and YY independent?
  4. Find E[X2Y2]E[X^2Y^2].
  • Solution
      1. First note that RX=RY={0,1,2,...}R_X=R_Y=\{0,1,2,...\}. Also, given N=nN=n, XX is a sum of nn independent Bernoulli(p)Bernoulli(p) random variables. Thus, given N=nN=n, XX has a binomial distribution with parameters nn and pp, so \begin{align}\label{} \nonumber &X|N=n \hspace{10pt} \sim \hspace{10pt} Binomial(n,p),\ \nonumber &Y|N=n \hspace{10pt} \sim \hspace{10pt} Binomial(n,q=1-p). \end{align} We have \begin{align}\label{} \nonumber P_X(k)&=\sum_{n=0}^{\infty} P(X=k|N=n)P_N(n) & (\textrm{law of total probability})\ \nonumber &=\sum_{n=k}^{\infty} {n \choose k} p^k q^{n-k} exp(-\lambda) \frac{\lambda^n}{n!}\ \nonumber &=\sum_{n=k}^{\infty} \frac{p^k q^{n-k} exp(-\lambda) \lambda^n}{k! (n-k)!} \ \nonumber &=\frac{exp(-\lambda) (\lambda p)^k}{k!} \sum_{n=k}^{\infty} \frac{(\lambda q)^{n-k}}{(n-k)!} \ \nonumber &=\frac{exp(-\lambda) (\lambda p)^k}{k!} exp(\lambda q) & (\textrm{Taylor series for } e^x)\ \nonumber &=\frac{exp(-\lambda p) (\lambda p)^k}{k!}, \hspace{40pt} \textrm{ for }k=0,1,2,... \end{align} Thus, we conclude that \begin{align}\label{} \nonumber &X \hspace{10pt} \sim \hspace{10pt} Poisson(\lambda p),\ \nonumber &Y \hspace{10pt} \sim \hspace{10pt} Poisson(\lambda q). \end{align}
      2. To find the joint PMF of XX and YY, we can also use the law of total probability: \begin{align}\label{} \nonumber P_{XY}(i,j)&=\sum_{n=0}^{\infty} P(X=i, Y=j|N=n)P_N(n) & (\textrm{law of total probability}). \end{align} But note that P(X=i,Y=j∣N=n)=0P(X=i, Y=j|N=n)=0 if N≠i+jN \neq i+j, thus \begin{align}\label{} \nonumber P_{XY}(i,j)&=P(X=i, Y=j|N=i+j)P_N(i+j)\ \nonumber &=P(X=i|N=i+j)P_N(i+j)\ \nonumber &={i+j \choose i} p^i q^j exp(-\lambda) \frac{\lambda^{i+j}}{(i+j)!}\ \nonumber &=\frac{exp(-\lambda) (\lambda p)^i (\lambda q)^j}{i! j!}\ \nonumber &=\frac{exp(-\lambda p) (\lambda p)^i}{i!}. \frac{exp(-\lambda q) (\lambda q)^j}{j!}\ \nonumber &=P_X(i)P_Y(j). \end{align}
      3. XX and YY are independent, since as we saw above \begin{align}\label{} \nonumber P_{XY}(i,j)=P_X(i)P_Y(j). \end{align}
      4. Since XX and YY are independent, we have \begin{align}\label{} \nonumber E[X^2Y^2]=E[X^2]E[Y^2]. \end{align} Also, note that for a Poisson random variable WW with parameter λ\lambda, \begin{align}\label{} \nonumber E[W^2]=\textrm{Var}(W)+(EW)^2=\lambda+\lambda^2. \end{align} Thus, \begin{align}\label{} \nonumber E[X^2Y^2]&=E[X^2]E[Y^2]\ \nonumber &=(\lambda p+ \lambda^2 p^2)(\lambda q+ \lambda^2 q^2)\ \nonumber &=\lambda^2 pq(\lambda^2 pq+ \lambda+1). \end{align}

Problem I have a coin with P(H)=pP(H)=p. I toss the coin repeatedly until I observe two consecutive heads. Let XX be the total number of coin tosses. Find EXEX.

  • Solution
    • We solve this problem using a similar approach as in Example 5.6. Let μ=EX\mu=EX. We first condition on the result of the first coin toss. Specifically, \begin{align} \nonumber \mu=EX&=E[X|H]P(H)+E[X|T]P(T)\ \nonumber &=E[X|H]p+(1+\mu)(1-p). \end{align} In this equation, E[X∣T]=1+EXE[X|T]=1+EX, because the tosses are independent, so if the first toss is tails, it is like starting over on the second toss. Thus, \begin{align}\label{alhh} p\mu=pE[X|H]+(1-p) \hspace{100pt} (5.14) \end{align} We still need to find E[X∣H]E[X|H] so we condition on the second coin toss \begin{align} \nonumber E[X|H]&=E[X|HH]p+EX|HT\ \nonumber &=2p+(2+\mu)(1-p)\ \nonumber &=2+(1-p)\mu. \end{align} Here, E[X∣HT]=2+EXE[X|HT]=2+EX because, if the first two tosses are HTHT, we have wasted two coin tosses and we start over at the third toss. By letting E[X∣H]=2+(1−p)μE[X|H]=2+(1-p)\mu in Equation 5.14, we obtain \begin{align} \nonumber \mu=EX=\frac{1+p}{p^2}. \end{align}

Problem Let X,Y∼Geometric(p)X,Y \sim Geometric(p) be independent, and let Z=XYZ=\frac{X}{Y}.

  1. Find the range of ZZ.
  2. Find the PMF of ZZ.
  3. Find EZEZ.
  • Solution
      1. The range of ZZ is given by \begin{align}%\label{} \nonumber R_Z=\left{\frac{m}{n}|m,n \in \mathbb{N}\right}, \end{align} which is the set of all positive rational numbers.
      2. To find PMF of ZZ, let m,n∈Nm,n \in \mathbb{N} such that (m,n)=1(m,n)=1, where (m,n)(m,n) is the largest divisor of mm and nn. Then \begin{align}%\label{} \nonumber P_Z\left(\frac{m}{n}\right) &= \sum_{k=1}^{\infty} P(X=mk, Y=nk)\ \nonumber &= \sum_{k=1}^{\infty} P(X=mk)P(Y=nk) \hspace{30pt} (\textrm{since }X \textrm{ and } Y \textrm{are independent})\ \nonumber &= \sum_{k=1}^{\infty} pq^{mk-1}pq^{nk-1} \hspace{40pt} (\textrm{where }q=1-p)\ \nonumber &= p^2q^{-2}\sum_{k=1}^{\infty} q^{(m+n)k}\ \nonumber &= \frac{p^2q^{m+n-2}}{1-q^{m+n}}\ \nonumber &=\frac{p^2(1-p)^{m+n-2}}{1-(1-p)^{m+n}}. \end{align}
      3. Find EZEZ: We can use LOTUS to find EZEZ. Let us first remember the following useful identities: \begin{align}%\label{} \nonumber \sum_{k=1}^{\infty} kx^{k-1}= \frac{1}{(1-x)^2}, \hspace{40pt} \textrm{ for }|x|<1, \end{align} \begin{align}%\label{} \nonumber -\ln (1-x)=\sum_{k=1}^{\infty} \frac{x^{k}}{k}, \hspace{40pt} \textrm{ for }|x|<1. \end{align} The first one is obtained by taking derivative of the geometric sum formula, and the second one is a Taylor series. Now, let's apply LOTUS. \begin{align}%\label{} \nonumber E\bigg[\frac{X}{Y}\bigg]&= \sum_{n=1}^{\infty}\sum_{m=1}^{\infty} \frac{m}{n}P(X=m, Y=n)\ \nonumber &= \sum_{n=1}^{\infty}\sum_{m=1}^{\infty} \frac{m}{n}p^2q^{m-1}q^{n-1}\ \nonumber &= \sum_{n=1}^{\infty} \frac{1}{n} p^2q^{n-1}\sum_{m=1}^{\infty} mq^{m-1}\ \nonumber &= \sum_{n=1}^{\infty} \frac{1}{n} p^2q^{n-1}\frac{1}{(1-q)^2}\ \nonumber &= \sum_{n=1}^{\infty} \frac{1}{n} q^{n-1}\ \nonumber &=\frac{1}{q}\sum_{n=1}^{\infty} \frac{ q^{n}}{n}\ \nonumber &=\frac{1}{1-p}\ln \frac{1}{p}. \end{align}