Tag Archives: probability

The Monty Hall Problem

It’s probability time again!

The discussions about the Tuesday’s Child problem were intense, so a break from probability puzzles was in order. But now that your brains are well rested, it is time to move on to the next puzzle from the Probability Paradoxes post: the Monty Hall problem. If you thought that the first puzzle was controversial, you ain’t seen nothing yet! Monty Hall has generated so much discussion (and, at times, acrimony), that there was enough material for someone to write a book on the subject.

In a possibly futile attempt to avoid some of that controversy, I will be taking a different approach to the discussion this time. I tried to come up with the “best” or “most reasonable” assumptions needed to solve the Tuesday’s Child puzzle, but in the case of Monty Hall I will side-step those sorts of questions and simply provide a framework for calculating solutions for a range of possible assumptions.

So here we go. Remember that the scenario we are presented with is as follows.

Suppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what’s behind the doors, opens another door, say No. 3, which has a goat. He then says to you, “Do you want to pick door No. 2?” Is it to your advantage to switch your choice?

I am going to jump right into the mathematics of conditional probability again. I will use “Car” to denote the possibility that door No. 1 (your door) has a car behind it and “Goat” to denote the possibility that it has a goat behind it. Without necessarily assuming Monty opens door No. 3, I will denote by R (for “reveal”) the possibility that Monty opens a door other than the one you have chosen and thereby reveals a goat.

With all of that in mind, I will compute the probabilities P(Car |  R) and P(Goat | R), that is the probability that you have picked a car or a goat respectively, given that Monty has shown you a goat behind another door. Even allowing for the goat being as good-looking as the one pictured here, I will also assume that you really want to win a car not a goat. On that basis, you should switch doors if P(Goat | R) is greater than P(Car | R) and stick with your original choice if P(Goat | R) is less than P(Car | R). If the two probabilities are the same, there is no advantage or disadvantage in switching.

Despite being a very easy theorem to prove, Bayes’ Theorem is one of the most fundamental results in probability and I will make use of it here.

P(\hbox{Car}| R) = \frac{P(\hbox{Car}) P(R | \hbox{Car})}{P(R)}.

The probability P(R) can be broken down in terms of the two mutually exclusive possibilities ‘Car’ and ‘Goat’:

P(R) = P(R | \hbox{Car}) P(\hbox{Car}) + P(R | \hbox{Goat}) P(\hbox{Goat})

Combining this with Bayes’ Theorem and the (fairly uncontroversial) facts P(Car) = 1/3 and P(Goat) = 2/3, we can conclude that

P(\hbox{Car}| R) = \frac{\frac{1}{3}P(R |  \hbox{Car})}{P(R | \hbox{Car}) \frac{1}{3} + P(R | \hbox{Goat}) \frac{2}{3}}.

Tidying this up a bit gives us a formula that will be able to deal with many (but by no means all) possible assumptions for the problem.

P(\hbox{Car}| R) = \frac{P(R |  \hbox{Car})}{P(R |  \hbox{Car}) + 2 P(R | \hbox{Goat})}

Of course, once we have this, we also know P(Goat | R) as it is 1 – P(Car | R).

All we need to do to use this formula is come up with assumptions that can be formulated in terms of P(R | Car) and P(R | Goat). Here are some examples of what we can do.

Case 1 (Classical)

Here we assume that Monty knows everything in advance about where the goats and the car are and that he can and always will show you a goat behind another door. This means that

P(R | Car) = P(R | Goat) = 1

Plugging this into the formula gives P(Car | R) = 1/3 and P(Goat | R) = 2/3, which means that we are better off switching. This is the standard solution to the Monty Hall problem and may come as a surprise to many people as the most common response, even with the assumption of an omniscient Monty, is that it doesn’t matter whether you switch or not.

Case 2 (Nice Monty)

This time we will still assume that Monty knows everything, but now he really wants you to win the car. So, he will only open a door to show you a goat if you have made the wrong initial choice. If you picked the car in the first place, he will simply open your door and congratulate you on your win. This means that

P(R | Car) = 0 and P(R | Goat) = 1 and so P(Car | R) = 0 and P(Goat | R) = 1. Once again you should switch. This time this conclusion should be obvious.

Case 3 (Nasty Monty)

Now Monty still has all the facts, but would prefer you to pick a goat. Perhaps Monty loves goats or perhaps the show is losing money and he doesn’t want to fork out for another car. Either way, these assumptions mean that

P(R | Car) = 1 and P(R | Goat) = 0 and so P(Car | R) = 1 and P(Goat | R) = 0. Now you should stick to your guns. Again, this conclusion should be obvious.

Case 4 (Lucky Monty)

Now we will stop assuming that Monty knows everything. When he opens the second door, he has no idea whether he’s going to spoil everything by revealing the car. If he does that, the show’s segment would, of course, end a little sooner than he had hoped. If you have picked the car, he will be fine, but if you picked a goat, he has a 50/50 chance of revealing the car instead of a goat. Translating all of this into mathematics gives:

P(R | Car) = 1 and P(R | Goat) = 1/2 and this time P(Car | R) = 1/2 and P(Goat | R) = 1/2. So, if Monty just happened to be lucky and show you a goat, it will not make any difference if you switch or not. Your odds will be the same either way.

Many other possible assumptions about what Monty does or does not know or do can also be cast in terms of P(R | Car) and P(R | Goat) and for each of these possibilities, it is therefore straightforward to decide whether to stick or switch.

In the debate over the Monty Hall problem, some have argued that Case 4 is a “better” interpretation of the puzzle than Case 1. While I won’t comment on that, I am sure that my attempt to evade the issue will not be enough to keep everybody happy with this solution. It seems that the Monty Hall controversy will not die.

Update: for anyone not convinced by the formula for the classical case, this spreadsheet may help.

Eliminating the irrelevant

After going to all the trouble of explaining the “classical” analysis of the Tuesday’s Child problem, here I will explain why I think that analysis ends up with the wrong answer.

This will get into the nuts and bolts of the mathematics of probability again, but I will start with some of the questions which led me to rethink this problem.

In her Math Blog, Tanya Khovanova approaches the problem in a very interesting way. Paraphrasing Tanya, if Mr Smith tells you that one of his two children is a boy born on Tuesday, you will (if you accept the classical reasoning) revise the probability of two boys from 1/4 to 13/27. But, you would do the same if he said the boy was born on Wednesday, or indeed any day of the week. So if he said he had a boy born on *$$*@day (his voice was muffled and you couldn’t quite catch which day he said), wouldn’t you then revise your probability to 13/27 too? After all, you’d make that revision regardless of what day he actually said! If so, couldn’t you then revise the probability to 13/27 even if he doesn’t mention a day of the week and just said he had a boy? This clearly makes no sense and suggests there is a problem with the classical analysis.

The crux of the problem is that if Mr Smith is volunteering information, he could just as easily have spoken of a day other than Tuesday. Indeed, he may have said ‘I have two girls’, ‘Anyone for tennis?’ or ‘The UK doesn’t have a solvency problem the way Greece does’. The situation is very different if you are asking the questions of Mr Smith. If you ask him whether he has a boy born on Tuesday, he is restricted to saying ‘yes’ or ‘no’. At least, that’s the case if you allow the one big assumption I am making here, namely that whatever Mr Smith says, he is telling the truth (even about macroeconomics).

So, exactly how the information is revealed makes a difference. That in itself is well understood, but at this point many people will simply give up saying that there are too many options open to Mr Smith so it is impossible to come to any sensible conclusions. So, they will either give up on the problem or rephrase it to one that can be answered, such as where you ask the questions of Mr Smith, as I did in the Tuesday’s Child post. But, if you rephrase the problem, you are solving a different problem and giving up on the original one. What I will argue here is that all those options open to Mr Smith do not matter at all. Mathematically we can eliminate “irrelevant” options and come up with a perfectly defensible solution to the problem.

To ease into the mathematics, I will go back to Gardner’s simpler two boys problem:

Mr Smith says, ‘I have two children and at least one of them is a boy.’ What is the probability that the other child is a boy?

Before trying to answer that, I will instead ask if Mr Smith had two boys, what is the probability that he would say ‘I have two children and at least one of them is a boy’. It is impossible to say: there are so many other things he could have said instead. But what if I asked about the probability that Mr Smith would say ‘I have two children and at least one of them is a boy’. Again it’s impossible to say, so instead I will ask how does that probability compare to the probability of him saying ‘I have two children and at least one of them is a girl’? I would argue that, by symmetry, these two probabilities have to be the same (whatever they may be). As soon as you accept that, the classical solution falls apart.

Now for the mathematics. To save a bit of space I’ll use X to denote the event “Mr Smith says, ‘I have two children and at least one of them is a boy’.” and I will write Y for “Mr Smith says, ‘I have two children and at least one of them is a girl’.” In mathematical terms, my symmetry argument is that P(X | BG) = P(Y | BG), even though we don’t know what either of these probabilities are. This is the sort of reasoning I will use to calculate the conditional probability:

P(BB | X) = P(BB)\frac{P(X | BB)}{P(X)}

Even though I will not be able to calculate either the top or the bottom term of this fraction, I will be able to calculate the ratio. To do this, I will use an equation I call “eliminating the irrelevant”. For any events A, B and Z, if A is a subset of Z and Z is independent of B then a bit of algebra will show that.

\frac{P(A | B)}{P(A)} = \frac{P(A | B\cap Z)}{P(A|Z)}.

I can apply that to the current problem by setting Z = X\cup Y as long as Z is independent of BB. While we have not been told that is the case, it would seem to be an extremely reasonable assumption. If you think of all the other things Mr Smith might have said, is there any reason to assume that he would be more likely to say something other than X or Y simply because he had two boys rather than two girls? I don’t think so. It’s certainly possible that there could be a link, in much the same way that a coin could be biased, but in the absence of any other information we would start by assuming heads and tails are equally likely.

Note that Y by itself is not independent of BB, nor is X. What I am arguing is that the fact that Mr Smith has two boys (BB) does not affect the likelihood that he will say either X or Y as opposed to something else entirely.

The formula above thus allows us to calculate the conditional probability we are after as follows:

P(BB | X) = P(BB)\frac{P(X | BB\cap Z)}{P(X | Z)}.

In one fell swoop, we have eliminated the irrelevant alternatives for Mr Smith and now have something we can work with, even though we will never know what the probability of X actually is!

The top line of the fraction is straightforward. If Mr Smith is restricted to X or Y and has two boys, only X is possible, so P(X | BB\cap Z) = 1. The bottom line requires a bit more work. As in the last post, we can break it up into disjoint alternatives:

P(X | Z) = P(X | Z\cap BB) P(BB) + P(X | Z\cap BG) P(BG) +P(X | Z\cap GB) P(GB).

Note that I have taken the liberty of dropping one term here as I know that P(X | Z\cap GG)=0. By symmetry, since Mr Smith is restricted to X and Y, P(X | Z\cap BG)=\frac{1}{2} and the same applies for the GB term. So, we now have

P(X | Z) = 1\times\frac{1}{4}+ \frac{1}{2}\times\frac{1}{4} + \frac{1}{2}\times\frac{1}{4} = \frac{1}{2}.

Now we’ve got everything we need and so

P(BB | X) = \frac{1}{4}\times\frac{1}{\frac{1}{2}} = \frac{1}{2}.

So instead of the classical conclusion that the probability that Mr Smith has two boys is 1/3, we have arrived at a figure of 1/2. The key to this result is that when we ask Mr Smith whether he has at least one boy, the probability that he says ‘yes’ is the same whether he has BB, BG or GB. When he makes an utterance of his own accord, although we don’t know what the probability values P(X | BB), P(X | BG) or P(X | GB) are, I am contending that P(X | BB) is double the other two (because in those cases he could have volunteered information about a girl). So, when Mr Smith volunteers that he has at least one boy, he is giving more information to us than if he simply answers ‘yes’ to our question.

The same reasoning will also give a probability of 1/2 for two boys in the Tuesday’s child case (there you would set Z to cover the 14 options for Mr Smith of saying one of boy/girl and one of Monday/Tuesday/Wednesday, etc).

To sum up, if Mr Smith volunteers ‘I have two children and at least one is a boy,’ then the probability that he has two boys is 1/2, whereas if you ask him ‘do you have two children and at least one boy’ and he answers ‘yes’, the probability that he has two boys is 1/3. Likewise, if he volunteers that he has a boy born on a Tuesday, the probability that he has two boys is 1/2 but if you ask him whether he does and he says yes, the probability of two boys is 13/27.

This gives the satisfying (and, I think, intuitive) result that the day of the week does not matter and Tanya’s paradox of a muffled word changing the probabilities is resolved.

Tuesday’s Child

Following on from the teasers in the probability paradoxes post, here is a closer look at “Tuesday’s child”. While it may not strictly be a paradox, it still has the rich potential for generating controversy. In fact, I don’t agree with what could be called the “classical” analysis of the problem. Here I will look at this classical approach and save my own interpretation for a later post.

A warning: this will be the most mathematical post on the blog to date, so it is not for the faint-hearted!

All of these probability paradoxes hinge on the notation of conditional probability. Conditional probability is the probability of one event given that another event has occurred. As a simple example, imagine roll a dice and A denotes “rolling a six” and B denotes “rolling an even number”. Then the probability of rolling a six is 1/6, but the probability of rolling a 6 given that I roll an even number is 1/3.

Now, before getting onto Tuesday’s child, I will go back to the simpler paradox, which I introduced in the Martin Gardner post. Note that throughout this post I will assume that girls and boys are equally likely and I will ignore identical twins (no offence to identical twins, of course!). I’ll quote from Gardner’s “Mathematical Puzzles and Diversions”:

Mr Smith says, ‘I have two children and at least one of them is a boy.’ What is the probability that the other child is a boy? One is tempted to say 1/2 until he lists the three possible combinations of equally probable possibilities – BB, BG, GB. Only one is BB, hence the probability is 1/3. Had Smith said that his oldest (or tallest, heaviest, etc.) child is a boy, then the situation is entirely different. Now the combinations are restricted to BB and BG, and the probability that the other child is male jumps to 1/2.

Without going into my reasons in this post, I don’t agree with Gardner’s solution to the problem as he posed it. But, with a little tweak, I would agree. If instead you ask Mr Smith whether he has at least one boy among his two children and he says ‘yes’ (as opposed to having him volunteer the details), then the probability that he has two boys is 1/3.

I’ll tweak the Tuesday’s child problem in the same way for now. Imagine the problem is now as follows:

Mr Smith has two children. You ask whether he has at least one boy born on a Tuesday. He says ‘yes’. A lucky guess perhaps, but now you wonder what the chances are that Mr Smith’s other child is also a boy.

At this point, we could enumerate all the possible combinations of children and weekdays of birth. All up there are 2\times 7\times 2\times 7 = 196 possibilities. Looking through that list, we would then scratch all of those that do not have at least one boy born on a Tuesday. In the list that remains, look at the proportion made up by families with two boys. Try it and you’ll find your revised list has 27 combinations in it and 13 of them have two boys, so the probability we are after is 13/27.

For me, that looks a bit much like hard work, so instead I would call on a bit more of the mathematics of conditional probability. Feel free to stop reading now if you don’t have the stomach for even more mathematics!

Mathematically, conditional probability is defined as follows:

P(A | B) = \frac{P(A \cap B)}{P(B)}
where the left hand term denotes the “probability of A given B” (and P denotes “probability of”). The top term on the fraction is “A intersection B”, which simply means that both A and B occur.

I will denote by X the “event” that Mr Smith said ‘yes’ to the at least one boy born on Tuesday question (the inverted commas are there because “event” is actually a technical term in probability). The probability we want to calculate is

P(BB | X) = P(BB) \frac{P(X | BB)}{P(X)}

Starting with the conditional probability on the top of this fraction, if we have a two-boy family, the answer to “do you have a boy” will certainly be “yes”, so we need to know the probability of at least one of the boys having a Tuesday birth date. There are 7 possible birthdates for each child, giving 49 possibilities. Of these, 7 have a Tuesday for the elder child and 7 for the younger, but this double-counts the case where both were born on a Tuesday, so we have:

P(X|BB) = \frac{13}{49}.

One way to calculate the probability of X itself is to break it down into different possible gender combinations:

P(X) = P(X \cap BB)+P(X\cap GG)+P(X\cap BG)+P(X\cap GB).

Here I am using the fact that probabilities of “disjoint” (non-overlapping) events add up, i.e. P(A \cup B) = P(A) + P(B) if A and B are disjoint. Using the conditional probability formula, this gives:

P(X) = P(X | BB) P(BB)+P(X | GG) P(GG) +P(X | BG) P(BG)+P(X | GB) P(GB).

Now the probability of the boy in a mixed gender family being born on a Tuesday is 1/7 and the probability of having boy-girl or girl-boy are both genders is 1/4. Combining this with the fact that the probability of a boy born on Tuesday is zero in a two-girl family and what we already know about a boy-boy family know gives us

P(X) = \frac{13}{49}\times \frac{1}{4} + 0 + \frac{1}{7}\times\frac{1}{4} + \frac{1}{7}\times\frac{1}{4}= \frac{13 + 2\times 7}{49}\times\frac{1}{4} = \frac{27}{49}\times\frac{1}{4}

Putting this all together, we have

P(BB | X) = \frac{1}{4}\times\frac{13}{49}/(\frac{27}{49}\times\frac{1}{4}) = \frac{13}{27}.

While you are waiting for the next post with an alternative interpretation, you might want to think about Gardner’s two boy problem a bit more. In order to get to the classical conclusion that there is a 1/3 chance Mr Smith has two boys then you effectively have to assume that if he had one boy and one girl, he would definitely say ‘I have two children and at least one of them is a boy’ and not ‘I have two children and at least one of them is a girl’. Does that really make sense?

UPDATE: Here is a spreadsheet which simulates the classic version of the Gardner problem (i.e. assuming that you ask Mr Smith the question), and here is an alternative analysis.