An almighty coincidence

Rob Eastaway and John Haigh Share this page
sun behind a cloud

An almighty coincidence

Rob Eastaway
John Haigh
December 2007

Coincidences can crop up in the strangest places. While Peter Hughes, an accountant from Birkenhead, was at a church service, his eye fell on the board showing the list of hymn numbers for the service. They were 16, 37, 428 and 590.

Mathematicians naturally look on numbers as a goldmine for distraction, maybe seeking to combine them to form an equation, or noting how many are primes. In this case, Peter observed something particularly curious: all ten digits appear exactly once! How likely is that, he wondered? His initial back-of-the-envelope estimate indicated that the chance might be about 1 in 6,000. He then sought our comments.

Working out the odds: start with common sense

This is a nice example of a coincidence from everyday life. Whenever you attempt to work out the chance of such a coincidence, it's necessary to make a number of common sense assumptions, and then to build a mathematical model to come up with a sensible answer. Here, the chance will depend on how many hymns are available, how many are chosen, and what the selection process is. Hymns are generally numbered consecutively from $1$ to $N$. Let's suppose for simplicity that $N$ was about 1,000; in fact it helps the calculations below if we take $N=999$, and we know that, on this occasion, exactly four hymns were chosen for the service.

That latter condition is central: fewer than four hymns makes Peter's observation impossible if $N<1000$, while more than four hymns would make it overwhelmingly likely that they would contain more than ten digits. So it was fortunate that Peter was at a four-hymn service, or he might never have happened upon this coincidence at all — though as we'll see, what he witnessed was still exceptionally unusual.

Do the calculations

The hymn lottery &mdash; what are the odds?

The hymn lottery — what are the odds?

Now for the calculations. First, we need to estimate the chance that the four hymn numbers contain exactly ten digits. Then we need to work out the chance that every digit is different.

In our book of 999 hymns, every number will have either one, two or three digits. The only combinations that give a total of ten digits are $\{1,3,3,3\}$ and $\{2,2,3,3\}$. If the hymns are chosen at random, the chances of a hymn number having 1, 2 or 3 digits will be 9/999, 90/999 and 900/999 respectively. Swallow hard, assume all four selections are made independently, and it emerges that the two combinations noted have respective chances 0.0263 and 0.0395, meaning that the overall chance of exactly ten digits is around 0.066, about 1 in 15. (Got stuck? Find out how this was worked out).

Given the hymns have ten digits in total, what is the chance they are all different? If all digits were equally likely, the chance of them all being different would be $10!/10^{10}$, where $10!$ stands for $10 \times 9 \times ... \times 1$. This is approximately equal to 0.00036. (Stuck again? Here's the answer.) We'll call this quantity $D$, so $D = 0.00036$. Putting the two calculations together, our first estimate for the overall chance is $0.066 \times D$, in round figures $1$ in $40,000$. So Peter's back-of-the-envelope figure looks like a substantial underestimate!

Refining the model

Our simple model has obvious deficiencies. For example:

  1. The number zero will arise less frequently than other digits, maybe 2/3 as often;
  2. Some hymns are far more, or less, popular than others;
  3. Christmas carols, doubtless numbered consecutively in a hymnbook, will never be selected for most of the year. Other blocks of hymns will be used only at baptisms, Easter, Harvest etc.;
  4. For hymnbooks in which $N \neq 999$, the frequencies of 1, 2 or 3 digit numbers will be different from those assumed;
  5. The numbers chosen can't be completely independent, as they are drawn from a finite population without replacement — and other factors may affect the independence assumption too.

Point 3 is a reminder that we should explicitly assume that the service in question is a standard Sunday service, and not at Christmas, for example.

The impacts of these refinements do not all work in the same direction! Whenever the digits are not all equally likely, that reduces the chance that they are all different. For example, as well as there being fewer zeros, if the carols are numbered (say) 425 to 488, then removing them from the selection available to the vicar would dramatically decrease the frequency of digit 4. On the other hand, if there are fewer than 999 hymns, or if that block of carol numbers is cast aside, the frequency of three-digit numbers will decrease, making it more likely that four hymns will have exactly ten digits. Selecting all the hymns from one short section of the book would make Peter's observation virtually impossible, but deliberately spreading them uniformly over the book would increase the chance.

So suppose the true frequency that digit $i$ is selected is $p_i$. Then each number $p_i$ lies between 0 and 1, and the $p_i$ sum to 1. To make our calculations easier, we write $p_i=0.1(1+x_i)$, where the numbers $x_i$ sum to $0$.

Now, selecting ten digits independently, the chance they are all different is $$10!\times (p_0\times p_2\times ... \times p_{9}) = D\times \left((1+x_0)\times (1+x_1)\times ... \times (1+x_{9})\right),$$ which we write as $$D\prod (1+x_i).$$ After a bit of manipulation this approximates well to $$D(1-0.5(x_0^2+x_1^2+ ... +x_{9}^2)),$$ which we will write as $$D(1-0.5 \sum x_i^2).$$

How much does it affect the answer if the ten digits are not equally likely? Take $N=999$ and assume hymn numbers are chosen at random. For each digit, calculate its frequency among numbers with one, two or three digits respectively, and weight these appropriately: for all digits except zero, the frequency is $$p_i=\left( \frac{9}{999} \times \frac{1}{9} \right) + \left( \frac{90}{999} \times \frac{19}{180}\right) + \left( \frac{900}{999} \times \frac{280}{2700} \right)=\frac{623}{5994},$$ while for zero we have $$p_0=\left( \frac{90}{999}\times \frac{9}{180} \right) + \left( \frac{900}{999}\times \frac{180}{2700} \right) = \frac{387}{5994}.$$ (Here is some help on this.) Thus $x_0=-2124/5994$, and $x_i=236/5994$ for $i\neq 0$, so that $1-0.5\sum x_i^2\approx 0.93$, reducing the estimate of the chance we seek by some $7\%$. The impact of zero being less frequent than the other digits is much less than you might suppose!

What's Christmas times Easter minus baptism?

What's Christmas times Easter minus baptism?

Now suppose that 100 of the three-digit numbers are eliminated, either because they are carols or hymns for other special occasions like Easter or baptism, or because the book has fewer than 999 hymns. The chances of the hymn numbers having 1, 2 or 3 digits are then $9/899$, $90/899$ and $800/899,$ which leads to the chances of the two combinations having exactly ten digits, on the same assumptions as before, being increased to $0.0282$ and $0.0476$. The overall chance of four hymns having ten digits is estimated as $0.076$, about $15\%$ higher than before!

Overall, unless the number of hymns is radically different from 1000, or a substantial number of them would be selected only on special occasions, the joint impact of these refinements is very little: we still offer 1 in 40,000 as the ball-park chance of Peter's observation for a random Sunday.


There is another way of estimating the chance of a coincidence such as this one, namely to do a computer simulation. Select four hymns at random with the carols deleted, and repeat the exercise ten million times.

We chose the Methodist Hymnbook (1933), which has $N=984$ hymns, with the Carols numbered 117 to 143; and on just 245 occasions in that simulation, all ten digits appeared exactly once. So our estimate of the chance from this simulation is about 1 in 40,800, gratifyingly close to the earlier calculations.

This suggests that, if you attend 40 "ordinary" services per year, you might expect to wait about 1000 years before sharing Peter's experience. That's a heck of a lot of sermons to sit through!

More coincidences

There's bound to be a coincidence in here, somewhere.

There's bound to be a coincidence in here, somewhere.

There is a different way of looking at coincidence questions such as this one. Peter's email would have seemed just as interesting if he had said: "All four hymns were prime numbers" (the chance of this is actually about 1 in 1,000, depending on the hymnbook). And it might have been even more interesting if the hymn numbers had been 11, 22, 111 and 222 for example. So while the chance of one particular interesting coincidence was 1 in 40,000, the chance of some unspecified interesting coincidence in the numbers will be considerably higher, and impossible to calculate.

Indeed, as David Wells' famous Dictionary of curious and interesting numbers makes clear, the vast majority of numbers between 1 and 1,000 are curious or interesting in their different ways, making the chance of a mathematician finding something of interest in next Sunday's hymn list something close to 100%!

About the authors

John Haigh teaches maths at Sussex University, and Rob Eastaway is currently President of the Mathematical Association. Their book, subtitled The hidden mathematics of sport was republished under its new title Beating the Odds in August 2007.

Read more about...