# Stuck in jail?

In an earlier post, Get out of jail,  I set the following problem:

If I roll a standard dice until I get a 6, how many rolls of the dice will I need on average?

A summary of the 8 answers I received is given in the figure below:.

So, 3 people got the answer right, perhaps because they know the general theory which leads to this answer. All other respondents under-estimated the answer, perhaps not taking into account that the number of throws needed could be 10, 20 or, in theory, even more.

But maybe I wasn’t fair in the question, since ‘average’ can have different meanings. The usual interpretation is the ‘mean’, and it’s the mean which takes the value 6. But another choice is the median, which for this problem is 4: on roughly 50% of occasions you’d need 4 throws or less to get a 6, and on a similar amount of occasions you’d need 5 throws or more. So, if you interpreted my question as asking for the median, you were right if your answer was 4, and close if your answer was 3. So again, everyone did really well by one interpretation of the problem. (Of course, if your answer was 3 because you divided 6 by 2 you were close, but for the wrong reason).

The reason why the mean and the median are so different in this problem can be seen in the following figure, which shows the probability for every possible number of throws from 1 to 25. Beyond 25, the probabilities are all very close to zero.

If you imagine the lines showing the probabilities as being made of strips of metal lying flat on a piece of paper, then the mean is the line of equilibrium – i.e. if I place my finger vertically at the mean – so, 6 in this case – the figure would balance perfectly. (Or at least it would if I hadn’t truncated the graph at 25 – in reality the vertical lines stretch out to infinity, but with smaller and smaller heights).

In contrast, the median is the vertical line at which the total lengths of the bars are equally balanced on each side. We can’t get this perfectly, because of the jumps in the lengths from one bar to the next, but very roughly the sum of the lengths of the bars up to the fourth one is equal to the sum of the lengths from the fifth one onwards, so the median is 4.

Consequently, the mean and median are points of equilibrium by different physical rules – by weight for the mean and by total length for the median –  and when probability distributions are very asymmetric, as in the figure above, the values can be quite different.

Anyway, I’d intended to ask for the mean number of throws required, and the answer to that is 6. But why?

It’s not a proper proof, but suppose I rolled the dice 6 million times. Because of the symmetry of the dice, you’d expect around 1 million of those throws to come up 6. And those 1 million 6’s will be randomly spread among the 6 million throws. So, on average, the 6’s will be 6 throws apart. In other words: you have to wait an average of 6 throws after rolling a 6 to throw another 6. And by similar reasoning, you’d have to wait an average of 6 throws before getting the first 6.

Obviously, there’s nothing special about the number 6 here. Or about dice. In general, if I repeat an experiment where there are $N$ different possible outcomes, each of which is equally likely, the average number of times I’ll have to repeat the experiment before having a success is $N$. For example, if cereal packs contain a gift, and there are 10 different available gifts, I’ll need an average of 10 cereal packs to get any particular gift that I’m hoping for.

Just for completeness, and it’s entirely optional, here’s a formal mathematical proof.

Let the average number of throws required be $A$.

On the first throw of the dice there are 2 possibilities:

• I get a 6.
• I don’t get a 6.

These possibilities occur with probability 1/6 and 5/6 respectively. In the first case, I’ve achieved the objective of rolling a 6, and so the total number of throws needed was 1. In the second case, I haven’t achieved the objective, and so still have to make $A$ throws on average to get a 6, on top of the throw that I’ve already made. In other words, in this case I will have to make a total of $A+1$ throws on average. So, with probability 1/6 I just need 1 throw, but with probability 5/6 I need an average of $A+1$ throws. But we also know that the average number of throws overall is $A$. So

$A =1/6 \times 1 +(5/6)\times (A+1)$

This gives an equation to solve for $A$, and you can easily check that it works with $A=6$.

One more quick aside based on the responses to the original post: it’s obviously difficult to draw many conclusions from just 8 responses, though I’m grateful to those of you who did respond. Clearly this type of post isn’t generating much interest, and maybe that’s true of the blog as a whole. I’m planning to give the blog a bit of a break over Christmas anyway, but before then I’ll include a post inviting feedback so that I can try to push the blog in a different direction if that’s preferred. Or maybe just wind things up if that seems more appropriate.