## Analysis of Strategies for the n-Door Monty Hall Problem

In an earlier post (see comments also), I had put forth a question about the winning strategy for the famous n-Door Monty Hall problem. Let me pose it again here, this time in a general way.

Of the following strategies, which has the highest chance of winning in the n-door problem (n > 3)?

- Stick with your initial choice till the very end without switching
- Stick with your initial choice till the end and switch only at the last stage
- Switch your choice at the very beginning and stick with this new door till the very end without switching again
- Switch at every possible stage

For those who are already familiar with the 3-door problem, strategy 4 might intuitively seem to be the best strategy. However, that is not the case!

Consider n doors as follows: C, G_{1}, G_{2}, …, G_{n-1}

**Assertion 1:** The door we choose at the first stage is C (the “car door”) with probability 1/n, while it is a G_{x} (one of the “goat doors”) with probability (n – 1)/n.

**Strategy 1: ***Stick with your initial choice till the very end without switching*

This strategy is equivalent to simply picking a door uniformly at random. Hence, it is trivially true that the probability of picking C (i.e. probability of winning the car) is **1/n**.

**Strategy 2:** *Stick with your initial choice till the end and switch only at the last stage*

This strategy is interesting. At every stage except the last one, Monty Hall will go ahead and show us one of the goat doors. That is, out of a total of (n – 1) goat doors, we are shown (n – 2). Hence, the unopened door at the last stage and the door we chose at the first stage are the only two mystery doors to us! One of these contains the car, while the other contains a goat. As we can see, by waiting till the last stage, we maximized our own information content.

If the door we chose at the first stage is C, then according to this strategy, we definitely lose — because the other mystery door (to which we have to switch) then contains a goat.

However, if we chose a G_{x} at the first stage, then we *always* win! Because the other mystery door (to which we have to switch) then contains the car.

Therefore, the probability of winning with this strategy is *(probability of choosing a G _{x} at the first stage) * 1*. From Assertion 1, this equals

**(n – 1)/n**.

**Strategy 3:** *Switch your choice at the very beginning and stick with this new door till the very end without switching again*

According to this strategy, we choose a door at the first stage and switch our choice at the second stage. Thereafter, we stick to the door that we chose at the second stage, till the end of the game.

If the door we chose at the first stage is C, then we definitely lose — because we would switch to a goat door at the second stage and stick with it thereafter.

So, we could win only if we chose a G_{x} at the first stage. However, merely choosing a G_{x} at the first stage does not mean we always win. After the first stage, Monty shows us one of the goat doors. This still leaves (n – 2) other doors (excluding our initial choice) as a mystery to us. So, we will switch to one of the remaining (n – 2) doors uniformly at random. So, the probability of switching to C is 1/(n – 2).

Therefore, the probability of winning with this strategy is *(probability of choosing a G _{x} at the first stage) * 1/(n – 2)*. Hence, It follows (from Assertion 1) that the probability of winning with this strategy is (n – 1)/(n (n – 2)) or

**(n – 1)/(n**.

^{2}– 2n)**Strategy 4:** *Switch at every possible stage*

In this strategy, we keep hopping from one door to another door at every stage. In this approach, the only way to win is by switching to C at the (n – 1)th stage, no matter which doors we have switched to up until then. The only thing that matters is whether we are able to switch to C at the last stage. This can happen if and only if we are at a G_{x} at the (n – 2)th stage.

It is obvious that by the time we reach the last stage, Monty would have revealed all but one goat door. So, we’ll be left with two doors — one goat door (i.e. some G_{x}) and C. Hence, it is clear that we *will* win if we are at the solitary goat door at the end of the (n – 2)th stage.

Let us first see what is the probability (P) of making it to some G_{x} at the last-but-one stage, given that we start with C at the first stage. In other words, having started with C at the first stage, what is the probability that we will have reached some G_{x} after exactly (n – 3) transitions (or switches)?

From C, we will *always* make a transition to some goat door other than the one that Monty reveals at the end of the first stage. So, we can make a transition to one of the remaining (n – 2) goat doors with probability 1. That leaves us with exactly (n – 4) transitions after which to reach some goat door. From here on, Monty is going to unveil one goat door at each stage except the last. So, the number of possible transitions at each stage, no matter what door we are at, keeps decreasing by 1. Also, note that there is a transition from every goat door to C.

Therefore, the probability of transition to a goat door for the third stage is ((n – 3) – 1)/(n – 3); the probability of transition to a goat door for the fourth stage is (n – 5)/(n – 4); … ; the probability of transition to a goat door for the (n – 3)th stage is 2/3; the probability of transition to a goat door for the (n – 2)th stage is 1/2.

Therefore, with C as the initial choice, the probability that we reach some G_{x} after exactly (n – 2) stages is given by

P = 1 * (n – 4)/(n – 3) * (n – 5)/(n – 4) * … * 2/3 * 1/2.

This implies P = 1/(n – 3).

However, this seems to hold only if we *do not* make any transitions to C up to the end of (n – 2) stages. But what if we *do* switch to C at some stage? Then, we switch back to one of the remaining (n – m – 1) instances of G_{x} with probability 1, where m is the stage number that took us to C. Therefore, switching to C at some intermediate stage does not affect our calculation of P.

Now, let us see what is the probability (Q) of making it to some G_{x} at the last-but-one stage, given that we start with a G_{x} at the first stage. In other words, having started with some G_{x} at the first stage, what is the probability that we will have reached another G_{x} after exactly (n – 3) transitions?

From a G_{x}, we will make a transition to either some G_{x} other than the one that Monty reveals at the end of the first stage or C. So, for the second stage, the probability that we make a transition to one of the remaining (n – 3) goat doors is (n – 3)/(n – 2); for the third stage, the probability that we make a transition to one of the remaining (n – 4) goat doors is (n – 4)/(n – 3); … ; for the (n – 3)th stage, the probability that we make a transition to one of the remaining 2 goat doors is 2/3; for the (n – 2)th stage, the probability that we make a transition to the remaining 1 goat door is 1/2.

Therefore, with some G_{x} as the initial choice, the probability that we reach another G_{x} after (n – 2) stages is given by

Q = (n – 3)/(n – 2) * (n – 4)/(n – 3) * … * 2/3 * 1/2

This implies Q = 1/(n – 2).

Again, at any stage, if we make a transition to C, then we make a transition to a G_{x} at the next stage with probability 1. Therefore, switching to C at some intermediate stage does not affect our calculation of Q.

Thus, the probability of winning with the strategy of always switching is *(probability of choosing C at the first stage) * P + (probability of choosing a G _{x} at the first stage) * Q*. From Assertion 1, it follows that the probability of winning with this strategy is given by 1/(n * (n – 3)) + (n – 1)/(n * (n – 2)). This equals

**(n**.

^{2}– 3n + 1)/(n^{3}– 5n^{2}+ 6n)In the order of probability of winning, the above four strategies compare as follows:

*Strategy 2 > Strategy 4 > Strategy 3 > Strategy 1*.

There are many other strategies for playing this game, of course. For ex., you could switch and stick alternately (or with any other pattern, for that matter). However, intuitively, it seems that it would pretty much be impossible to beat Strategy 2 — as n increases, the probability of winning approaches 1. Perhaps, there exists a formal proof of the supremacy of Strategy 2. But I’ve not been able to find it on the Web. If you come across such a proof, please leave a comment.

**PS: If you find any discrepancies in this article, please let me know. I am not too sure about the correctness of the proof for strategy 4.
**

## The Birthday Problem

The well-known birthday problem:

How many people do you need to assemble before the probability that some two of them have the same birthday is greater than 0.5?

**Assumptions:** (1) A year has 365 days (no leap year), and (2) By “same birthday”, we only mean the same day and month (not necessarily the same year).

My first intuition was 183 — the smallest number that is more than half the number of days in a year. But as it turns out, 183 is the number of people you need to assemble before the probability that someone has the same birthday as *you* — a specific person — is greater than 0.5!

Look closely. The question is not about someone matching a particular person’s birthday. It is about the birthdays of *some two people* matching. Enough said. What is the right answer then, and why? How do we generalize this to matching the birthdays of some *N* people?

If you are guessing or have worked out a solution now, please leave comments.

The point of asking such questions (even though they might seem trivial to some) is to further our own understanding, and more importantly, to *enjoy* the process of understanding! So, if you already know the answer, please defer commenting.

## The Multi-Stage Monty Hall Problem

Some time back, Sids had a post on the Monty Hall problem/game, which is as follows (Source: Wikipedia).

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?

In this case, there are three doors. So, the game is played in two stages — Stage 1: Choose a door; Stage 2: Switch or stick with your choice. Here, the probability that you win the car is 2/3 if you switch your choice. So, yes. It *is* to your advantage to switch. See this page for details.

Let us now generalize this game to *N* doors. That means, the game is played in (*N *– 1) stages.

Stage 1: Choose a door

For stages *X* = 2 through (*N* – 1):

Monty Hall shows you one of the “goat doors”. Then, you either switch to one of the remaining (*N *– *X*) doors or stick with your choice

Questions:

- What strategy has the highest probability of winning in this scenario?
- Why is this the best strategy?
- What is the probability of winning with this strategy?

For simplicity, let us consider *N* = 4. You get to choose a door at the first stage, and for the next two stages, you can either switch or stick. So the various permutations are:

- Choose, Stick, Stick
- Choose, Stick, Switch
- Choose, Switch, Stick
- Choose, Switch, Switch

Which of these four strategies wins most probably? And why? Once this is figured out, try looking at the generalized problem with *N* doors.

PS: If you already know the answer (or have found a link to it), kindly procrastinate on writing a comment about it. 😀

## Kisi Aur Koi Bhi

Google has come up with a new English to Hindi translation service. In my opinion, it is a decent effort. Although, the quality of translation is not very impressive, yet. Indeed, it is not easy to make a computer understand and interpret natural language correctly.

Well, I was just looking for something fun to indulge myself in, and thought of translating this blog in Hindi using the above service. This is what resulted. Much fun was had.

Notice what the name of this blog appears as. Try reading some of the posts, especially the math ones. 😀

Oh, and don’t miss the names of the blogs on my blogroll. I particularly loved *pehlaa siddhaanton*, *achche maTh, kharaab maTh* and *mEraa sikkaa pakshapaati*! Go, figure out the last two. Lol! 😀

PS: Wah! *mEraa sikkaa pakshapaati*! Sounds like a super-hit Hindi movie!

## On Domain Stretching, Conditional Convergence and Absolute Convergence

Sometimes, an infinite series may not be as expressive as (or carry as much information as) the function it represents. In this post, we’ll mainly discuss this concept (and also look at conditional and absolute convergence briefly).

Consider the following infinite series:* f(x) = 1 + x + x ^{2 }+ x^{3} + x^{4} + x^{5} + …*. Does this series ever converge? Try substituting

*1/2*for

*x*and see what happens. It converges, as we saw here. So, we write this as

*f(1/2) ~ 2*. The twiddle or tilde sign here indicates that

*f(x) asymptotically tends to 2 at x = 1/2*. Similarly, it is possible to prove the following:

*f(-1/2) ~ 2/3*;

*f(1/3) ~ 3/2*;

*f(-1/3) ~ 3/4*and so on. It is trivially true that

*f(0) = 1*.

Let us now substitute *1* for *x*. We get *f(1) = 1 + 1 + 1 + 1 + …*. The series diverges at *x = 1*. It is obvious that the series diverges for *x = 2, 3, 4, 5, …* too. Observe the behaviour of *f(x)* when *x = -1*. We get *f(-1) = 1 – 1 + 1 – 1 + 1 – 1 + …*. If you take an even number of terms, then *f(-1) = 0*, and if you take an odd number of terms, then *f(-1) = 1*. We see that the partial sum of this series is definitely not becoming infinitely large. However, it is not converging either. This is considered a form of divergence. We can verify that *f(-2), f(-3), f(-4), …* also diverge. Loosely speaking, they seem to oscillate and go off to positive infinity and negative infinity at once.

We see that *f(x)* seems to have values only when *x* is between *-1* and *1*, exclusive. In other words, we have:

**Observation 1:** *The domain of the function f(x) is from **-1 to **1, exclusive.*

Now, let us rewrite *f(x)* here and simplify it a bit.

*f(x) = 1 + x + x ^{2 }+ x^{3} + x^{4} + x^{5} + …*

That is, *f(x) = 1 + x (**1 + x + x ^{2 }+ x^{3} + x^{4} + … )*

This implies *f(x) = 1 + x f(x)*

Therefore, we have *f(x) = 1 / (1-x)*

On simplification, we have:

**Equation 1:** *1 / (1-x) = 1 + x + x ^{2 }+ x^{3} + x^{4} + x^{5} + …*

Now, the question we ask is: *Are the LHS and the RHS of this equation one and the same?* Earlier in this post, we had discussed the value of the RHS for various values of *x*, viz. *-1/2*, *-1/3*, *0*, *1/3*, *1/2*. You will see that the LHS concurs. However, they are *not* one and the same thing! *They have different domains.*

We can see that *1 / (1-x)* has values everywhere except at *x = 1*. When we see this in contrast to Observation 1, we see that the domain of *1 / (1-x)* is “stretched”. It includes the domain of the infinite series and more. This indicates that an infinite series sometimes defines only a part of a function. More appropriately, *an infinite series might define a function over only a part of the function’s domain*.

So, that was about “domain stretching” to uncover hidden properties of a function. I was sorely tempted to discuss this beautiful concept here. So, I *had* to make some room for it. 🙂

————————-

At this point, you are free to jump to Equation 2 below, from where our actual discussion of conditional and absolute convergence begins. Or, you can just stay on and see *why* Equation 2 is true.

On integrating Equation 1, we get:

*-log(1 – x) = x + x ^{2}/2 + x^{3}/3 + x^{4}/4 + x^{5}/5 + …*

Therefore, *log(1 – x) = – x – x ^{2}/2 – x^{3}/3 – x^{4}/4 – x^{5}/5 – …*

At *x = -1*, we get:

**Equation 2:*** 1 – 1/2 + 1/3 – 1/4 + 1/5 – 1/6 + … = log 2*

Let us denote this series (the LHS of Equation 2) as *S*. So, *S* converges to *log 2*. However, for *S* to converge to *log 2*, there is a *condition* that needs to be satisfied: *the terms have to be added in that order*. If you add the terms in a different order, the series might either converge to a different quantity or diverge. For example, let us rearrange the terms in this series as follows:

*1 – 1/2 – 1/4 + 1/3 – 1/6 – 1/8 + 1/5 – 1/10 – …*

Or *(1 – 1/2) – 1/4 + (1/3 – 1/6) – 1/8 + (1/5 – 1/10) – …*

This is equivalent to *1/2 – 1/4 + 1/6 – 1/8 + 1/10 – …*

This simplifies to *1/2 (1 – 1/2 + 1/3 – 1/4 + 1/5 – …)* or *1/2 (S)*

The rearranged series sums up to half of *S*!

Such series, whose limit depends on the order in which their terms are arranged, are said to be *conditionally convergent*. Those series that converge to the same quantity, *no matter what order they are summed in*, are said to be *absolutely convergent*.

————————-

**Other articles in this series:** On Convergence, On Divergence

## On Divergence

My earlier plan was to write a bit about the various types of convergence in this article. However, I think we would do better to understand *divergence* first. So, here goes. In the previous post, we saw an infinite series that *converged*. In other words, it exhibited limiting behaviour. (This infinite series was a *geometric series* with *1* as the first term and *1/2* as the common ratio. As a matter of fact, *any* geometric series, with a first term *a* and a common ratio *r,* converges. That is, the sequence of its partial sums has a limit. As we saw, for the geometric series in the previous post, the limit of the sequence of its partial sums is *2*.) But, what of those infinite series that do not exhibit limiting behaviour towards any quantity? Such series (i.e. ones that are *not* convergent) are said to be *divergent*. The partial sums of a divergent series go on increasing *without limit*. Loosely speaking, the sequence of partial sums of a divergent series tends to infinity.

From the example infinite geometric series in the previous post, we can make the following observation:

**Observation 1:** *If a series converges, then the individual terms of the series must tend to zero*.

In that series, the tenth term is *0.001953125*, the twentieth term is *0.0000019073486328125*, the fiftieth term is (approx.) *0.00000000000000177636*, and so on. Notice how the *N*th term is tending to zero as *N* increases. So, Observation 1 seems true enough. And therefore, we can conclude that if the individual terms in a series *do not* approach zero, then the series *diverges*. However, the converse of Observation 1 is *not true*. If the individual terms of a series tend to zero, the series does not necessarily converge — it may diverge. A very good example of this is the following *harmonic series*: *1 + 1/2 + 1/3 + 1/4 + 1/5 + …*.

In this harmonic series, the tenth term is *0.1*, the hundredth term is *0.01*, the millionth term is *0.000001*, and so on. It is clear that as *N* increases, the *N*th term in this series tends to zero. However, this series is known to diverge. And there happens to be a rather old but elegant proof of its divergence by Nicole d’Oresme, a French scholar (*c.* 1323 – 1382).

d’Oresme observed that *(1/3 + 1/4)* is greater than *1/2*. Similarly, *(1/5 + 1/6 + 1/7 + 1/8 )* is greater than *1/2*. So is *(1/9 + 1/10 + 1/11 + 1/12 + 1/13 + 1/14 + 1/15 + 1/16)*. And so on. By first taking two terms, then four terms, then eight terms, then sixteen terms, and so on, it is possible to group the series into infinitely many “blocks”, where each block adds up to a value greater than *1/2*. No matter how many such blocks we consider, it is always possible to come up with the next, well-defined block. That is, there is always a value *x > 1/2* waiting to be added, no matter how many blocks we have already added up. Loosely speaking, the sum of the entire series must therefore be infinite. That is, the sum of the series increases without limit. The series diverges. *Quod Erat Demonstrandum*.

This elegant proof by d’Oresme seemed to have been lost on the world for several centuries. Pietro Mengoli proved this result all over again in 1647, using a different approach. Forty years later, Johann Bernoulli proved it with yet another approach. Shortly after, Jakob Bernoulli came up with yet another proof! Neither Mengoli nor the Bernoulli brothers seemed to have known about d’Oresme’s fourteenth century proof. John Derbyshire asserts that d’Oresme’s proof remains the most elegant of all the proofs for this result, and is the one given in textbooks today.

**PS:** Johann Bernoulli was the father of Daniel Bernoulli (of *Bernoulli’s Principle* fame). Jakob Bernoulli (of *Bernoulli Trial* and *Bernoulli Numbers* fame) was Johann Bernoulli’s elder brother. That is one super-cool family, eh? 😀

————————-

**Other articles in this series:** On Convergence, On Domain Stretching, Conditional Convergence and Absolute Convergence