Conditional probability : Exercises

Introduction

All the problems below require you to think about whether you are calculating conditional or absolute probabilities. As you do them rember that the conditional probability that the random variable $X=1$ given that the random variable $Y=9$ is calculated using: $$ P(X=1|Y=9) = \frac{P(X=1 \wedge Y=9)}{P(Y=9)} $$

Example problems

Click on the problems to reveal the solution

It is possible to show that Bob's logic is wrong here by using conditional probability. We can see how by considering the events that must occur for each person in the queue to win the prize. We can then work out probabilities and conditional probabilities for these events and thus show that everyone has an equal chance of winning the prize. Without further ado then lets begin by calculating the probability that the first person in the queue wins. This is straightforward: there are $n$ boxes, the prize is equally likely to be in any one of them so this probability is: $$ p_1 = \frac{1}{n} $$ Now lets move to the second one. It is tempting at this stage to say that the probability is $\frac{1}{n-1}$ as there are now only $n-1$ boxes remaining for this second person to choose from. This is wrong, however, as it neglects the fact that for the first person in the queue must loose before the second person even gets their turn. The probability for the second person to win is thus: $$ p_2 = p(\textrm{first person looses}) \times p(\textrm{second person wins}|\textrm{first person looses}) = \frac{n-1}{n} \frac{1}{n-1} = \frac{1}{n} $$ The key point is that the value $\frac{1}{n-1}$ is actually a conditional probability - it is the probability that person two wins given that person one looses . Lets now consider the third person. For him to win the first two people must loose and he must then pick the winning box. We thus have: $$ \begin{aligned} p_3 & = p(\textrm{first person looses}) \times p(\textrm{second person looses}|\textrm{first person looses}) \times p(\textrm{third person wins}|\textrm{first and second person loose}) \\ & = \frac{n-1}{n}\frac{n-2}{n-1}\frac{1}{n-2} = \frac{1}{n} \end{aligned} $$ Continuing in this vain and considering the fourth, fifth, ... person is rather boring so we will instead consider the $k$th person in the queue and deal with all these individuals in one fell swoop. For this $k$th person to win the first $k-1$ people in the queue must all loose and the $k$th person must win. We can write an expression for this using the product notation as follows: $$ p_k = p(k\textrm{th person wins}) \times \prod_{i=1}^{k-1} p(i\textrm{th person looses}|\textrm{all } i-1 \textrm{ people before him loose}) = \frac{1}{n-k} \prod_{i=1}^{k-1} \frac{n-i}{n-i+1} = \frac{1}{n-k} \frac{n-k}{n} = \frac{1}{n} $$ The value of $p_k$ is thus the same for all the people in the queue so Bob's reasoning is fallacious.
This is an example of the famous Monty Hall problem. The answer in short is that it is always better to change as this increases the likelihood that you will win the prize. Many people find this counter intuitive when they first encounter this result so it is worth taking some time to think about why this is the result. Lets begin by thinking of all the way the game can play out. We begin by introducing a Bernoulli random variable, $X$, that equals one if you select the door with the prize and zero otherwise. Now obviously we know that: $$ P(X=1)=\frac{1}{3} \qquad \qquad \textrm{and} \qquad \qquad P(X=0)=\frac{2}{3} $$ Lets now introduce a second random variable, $Y$, that describes which door the host opens. This is the critical part of the problem. The random variable $Y$ is not independent of the random variable $X$ . This is intuitively obvious - the host will not open the door that has the prize behind it and he/she will not open the door that you picked - consequently the value of $X$ affects the value of $Y$ so these variables are not independent. The reason people go wrong is connected to the fact that it is difficult to work out what implication this intuitively obvious realization has on the mathematics. To make the nomenclature simpler in what follows we note that $Y$ - the random variable that describes the door the host opens - can only take one of two values, $0$ or $1$. This is the case because the host cannot open the door the contestant selected - there are thus only two doors remaining for him/her to choose from. Now, given that $X$ and $Y$ are not independent we must work out values for the conditional probabilities: $P(Y=1|X=0)$, $P(Y=0|X=0)$, $P(Y=1|X=1)$ and $P(Y=0|X=1)$. These conditional probabilities are: $$ P(Y=1|X=0)=1 \qquad P(Y=0|X=0)=0 \qquad P(Y=1|X=1)=\frac{1}{2} \qquad P(Y=0|X=1)=\frac{1}{2} $$ The values of $P(Y=1|X=1)$ and $P(Y=0|X=1)$ are as we expect. There are two doors and the host is free to open either of them so the classical interpretation of probability tells us that the probability here is $\frac{1}{2}$. The host is only free to open either door, however, because $X=1$. That is to say the host is only free to open either door because prize is behind the door the contestant selected initially. When this is not the case (i.e. when $X=0$) the host is forced to open one particular door as doing otherwise would reveal the prize. This is why we have $P(Y=1|X=0)=1$ and $(Y=0|X=0)=0$. We are now in a position to work out absolute probabilities for all the various (mutually exclusive) ways the game could play out using the definition of conditional probabilty. This gives us the following: $$ \begin{aligned} P(Y=0 \wedge X=0 ) & = P(Y=0|X=0)P(X=0) = 0 \times \frac{2}{3} = 0 \\ P(Y=1 \wedge X=0 ) & = P(Y=1|X=0)P(X=0) = 1 \times \frac{2}{3} = \frac{2}{3} \\ P(Y=0 \wedge X=1 ) & = P(Y=0|X=1)P(X=1) = \frac{1}{2} \times \frac{1}{3} = \frac{1}{6} \\ P(Y=1 \wedge X=1 ) & = P(Y=1|X=1)P(X=1) = \frac{1}{2} \times \frac{1}{3} = \frac{1}{6} \end{aligned} $$ We are not quite there in terms of solving this problem. The next step we have to take is to recognise from the above probabilities what the probability of winning if we change our selection for the doors. I think the easiest way of solving this part is to work out how the game could transpire if we always change. If we chose to change we always win if the first door we selected does not have the prize behind it (i.e. if $X=0$). If by contrast $X=1$ we will loose when we change. We are thus two times more likely to win if we change. What the above explanation shows is that the Monty Hall problem is equivalent to the following question. You get through to the final round of a television game show. The host offers you three boxes one of which contains a fabulour prize. You are offered the opportunity to select one box or two boxes. If you pick one box you win if the prize is in it. If you pick two boxes you win if the prize is in either of the two boxes you selected. What is the best thing to do? The logic here is similar to the logic we used in the first worked example where we looked at the queue of people and the prize.

Contact Details

School of Mathematics and Physics,
Queen's University Belfast,
Belfast,
BT7 1NN

Email: g.tribello@qub.ac.uk
Website: mywebsite