## The Monty Hall problem

The Monty Hall problem is inspired by an American television game show. There are three doors, and behind one of them, the host of the show, Monty, hides a car. Each of the other two doors hides a goat.

The contestant is asked to pick a door, so that if she finds the car, she wins the game (and the car). Since there are three doors, chances are $1/3$ that she picked the door behind which is the car. But Monty doesn't open yet the door, but he opens one of the remaining doors, revealing a goat. He then asks the contestant either to keep her original choice, or to switch to the other unopened door. The problem is, what should the contestant do?

The first instinct of anybody may be to think that since there are only two remaining doors, it doesn't matter if you switch the door or not, because the chances are $1/2$ in both ways. However, Marilyn vos Savant explained that if the contestant switches the doors, the chances are $2/3$. while if she doesn't switch them, the chances are $1/3$. This is counterintuitive, and the legend says that not even Paul Erdős understood it. You can find on Wikipedia some solutions of this puzzle.

## An equivalent puzzle

I will present another, simpler puzzle, and show that it is equivalent to the Monty Hall problem.

Consider again three doors, one hiding a car. The contestant is asked to pick either one of the three doors, or two of them. What is the best choice?

Obviously, the contestant should better choose two doors, rather than one. Since if she thinks that the car is behind door number three, choosing also door number one will only double the chances to win.

But how is this related to the Monty Hall problem? Well, it is, because if you play the Monty Hall problem, you can pick two doors, but don't tell Monty, you just tell you picked the remaining one. When Monty asks if you want to switch, then you switch to the other two doors, and since one is already open, you choose the remaining one. This means that choosing a door and switching is equivalent to choosing the other two doors.

So the Monty Hall problem is actually equivalent to having to choose one or two doors. Not switching is equivalent to choosing one door, and switching is equivalent to choosing two doors. So switching gives indeed probability $2/3$.

## Saturday, March 14, 2015

### Round squares exist

Bertrand Russell said that there are no round squares. But there are. Here are two solutions.

## A circle-square

This is a square that is circle:

To make it, first make a paper circle and  a paper square, with equal perimeters:

Fold them a bit:

Then glue their edges together:

The common boundary forms a square that is circle. It is a square, because in the blue surface it has right angles and equal straight edges. It is a circle, because in the red surface its points are at equal distance from a point. In fact, its points are at equal distance from the center even in space, because the red surface is ruled, and all the lines pass through the same point. So the common boundary is also a line on the surface of a sphere.

## Round squares in non-Euclidean geometry

Consider for example the geometry on a sphere. On a sphere, polygons are made of the straightest lines on the sphere, which are arcs of the big circles. So, there are squares on a sphere Image from Wikipedia
This is a square, since its edges are the shortest and straightest lines on the sphere, they have equal lengths, and its angles are all equal. If one gradually increases the size of the square, the angles increase too. At some point, the angles become $180^\circ$, and the edges become aligned, forming one single big circle: Image from Wikipedia

So, is it a circle? Is it a square? It's a circle and a a square!

## The problem

In how many ways you can arrange $p$ coins in a sequence of towers? (it doesn't matter whether the coins can be flipped or rotated, and we assume that there are no empty towers).

For example, here is one way to arrange $12$ coins into a sequence of $5$ towers. The problem asks to count all these ways.

## Motivation

I arrived at this problem by being inspired by my yesterday's post, A combinatorial problem with balls and boxes. The problem was to count the number of ways you can place $k$ balls in $n$ boxes. The answer is $n-1+k$ choose $k$, which is $\displaystyle{\frac{(n-1+k)!}{(n-1)!k!}}$.

So I asked myself, since the result is of the form "$p$ choose $q$",  couldn't I modify the problem so that the result will be the sum over $q$, which is known to be $2^p$? But to do this, boxes and balls should be replaced with objects of the same nature, and playing the role of a box or a ball to be determined by the configuration.

I will tell you a solution by reducing to the problem with boxes and balls, and then a simpler, direct solution.

## Solution based on the balls and boxes problem

Let's  identify two distinct roles in a sequence of towers of coins. We color each coin that starts a tower with blue, and the others with red, as below.

We can now consider that the blue coins are boxes, and the red coins are balls, and reduce to the previous problem. The number of possible ways to put $k$ balls in $n$ boxes is $n-1+k$ choose $k$, which is also $n-1+k$ choose $n-1$. In our case, the number of boxes equals the number of towers, so it is $n$, and the number of balls is $p-n$. So, the number of possible ways to arrange $p$ coins in $n$ towers is $n-1+(p-n)=p-1$ choose $n-1$. Since we can have any number of towers, from $n=1$ to $n=p$, we have to sum accordingly, and the total number is $\sum_{n=1}^p \left( \begin{array}{c} p-1\\n-1 \end{array} \right)=\sum_{q=0}^{p-1} \left( \begin{array}{c} p-1\\q \end{array} \right)=2^{p-1}.$

This solution is based on the problem of balls in boxes, which inspired the very problem. But since we've got $2^{p-1}$, shouldn't be a simpler and direct way to count all possible configurations?

## Simpler solution

Rather than coloring the coins as previously, let's color the even towers with red, and the odd towers with blue.

We see now that any sequence of colors of the $p$ coins starting with blue corresponds to a way to arrange them in towers, and conversely. For example, the above arrangement corresponds to the sequence BBRRRRBBBRBB. The first coin has to be blue, but each of the other $p-1$ can be chosen in two ways. Hence, the number of all such sequences is $2^{p-1}$.

## The problem

Combinatorial problems can be simply to state, and difficult to solve. But this one has a surprisingly simple solution, if you reframe it a bit.

The problem is: in how many ways you can place $k$ identical balls in $n$ distinct boxes? We assume that each box is large enough so that you can place all balls in it, so we have to count also the cases with empty boxes. You have to place all balls in boxes.

Yesterday, a friend and fellow physicist told me the problem, he needed to solve it in order to count some quantum states, but this is not relevant here. He solved it before, but forgot how. He found an ingenious way to see what happens if we add a new box or a ball. This would lead to some recurrence formula, which involved summing both over the number of balls, and the number of boxes. So he asked me to help him with these calculations. This is a problem of induction, which anyone should be able to resolve in high school, but I considered that all these calculations were too tedious for me, especially since I wanted to have lunch. So I replied that I would rather prefer to find a direct way to the solution, by framing it differently.

Before reading the solution, I would like to ask you to solve it yourself.

## The solution

We can reframe the problem like this. We can arrange the boxes one next to another, like the carts of a train. Then we get something like this:

Now we can invent a notation for each configuration: we denote every space between boxes with a square, and every ball with a circle. Here's what we get:

The sequence starts with a separator, because the first box is empty. Then there are four balls in the second box. There are two successive separators because the third box is empty. Then there's a box with two balls, and the last contains only one ball.

It is easy to see now that we have $n-1+k$ objects, $k$ of them being the balls, and $n-1$ of them being the separators. Since the conditions of the problem allow to place them in any order, the problem becomes equivalent with choosing $k$ out of $n-1+k$. So the result is $n-1+k$ choose $k$, which is $\displaystyle{\frac{(n-1+k)!}{(n-1)!k!}}$.

You may try to solve it by double induction, and at the end the result may look more complicated, unless you are able to apply some formulas to bring it in this simple form.