Sunday, 28 December 2014

Math of QZ8501 (Sum of 3 numbers that add up to 8888)

Let's hope the missing plane QZ8501 can be found soon. According to CNN, the plane is most likely at the bottom of the sea. Hopefully there can be some survivors, and our prayers are with them.

Something very mysterious about the recent flight disappearances is that their numbers add up to "8888", a very significant number in Chinese culture. (see our earlier post at:
MH17, MH370, QZ8501

What are the chances of 3 numbers (taken from the range 1-9999) adding up to 8888?

We will calculate the probability of 3 numbers (between 1 to 9999, since most aeroplane flight numbers are up to four digits) adding up to 8888.

We will first do an analytic theoretical calculation, and then follow up with a numerical simulation to double confirm our calculations.

Theoretical Calculation

Firstly, there are 9999 numbers from 1 to 9999. Hence, in total, there are $9999^3=999700029999$ ways of selecting 3 numbers from the range 1-9999. Repeats are allowed, for example 17, 17, 17, since they could be from different airlines e.g. MH17, QZ17, SQ17, just to illustrate the point.

Next, we need to consider how many positive integer solutions there are to $x_1+x_2+x_3=8888$. One of them would be 17, 370, 8501; but there are many more like 1, 1, 8886.

The technique to solve this type of question is to use a Stars and bars (combinatorics) method.
We can write 8888 stars, and to separate them into 3 "bins" we need 2 bars. Hence, out of 8887 possible gaps, we need to choose two gaps to put the bars. Hence, the total number of ways is ${8887 \choose 2}=39484941$.

Hence, the final probability, the chance of 3 random numbers adding up to 8888 is $$\frac{39484941}{999700029999}=0.0039497\%$$, or around 1 in  25,000.
(WolframAlpha Calculation)

For comparison, this is rarer than winning the top prize in 4D (a popular guess the correct 4 digit number lottery in Singapore), which has a probability of 0.01%, or 1 in 10,000.

It is more common than winning the Jackpot in Lottery, which has a probability of 1 in 14 million.

Computer Verification

We write a simple Python code to verify our calculations. (We verify a simpler case: probability of 3 numbers (range 1-99) adding up to 88.
 for x in range(1,100):  
   for y in range (1,100):  
     for z in range (1,100):  
       if x+y+z==88:  
 print (total)  
 print (counter)  
 print (counter/total*100.0)  
(total ways) 970299
(ways of adding up to 88) 3741
(probability) 0.3855512579112212

This indeed tallies with our calculations since $$\frac{87 \choose 2}{99^3}]\times 100\%\approx 0.38555$$.

(see WolframAlpha calculation)

No comments:

Post a Comment