A couple of posts ago I talked about how laughably improbable it would be to get 92 heads in a row on a fair coin. To sum up, the probability is:
The probability of this happening is so abysmally low that you could flip coins your entire life and never expect to see this happen. Or could you? How many times would you need to flip a coin to see a reasonable chance of this happening?
A pointless question? Most certainly. But trying to answer pointless questions that can be solved by math is one of the trademarks of a geek. So a quick review of probability and statistics lead me to the Geometric Distribution, which gives the probability of an event occurring after a given number of trials.
Here p is the probability of the event occurring once in one trial, i.e. \(2.017\times 10^{-28}\). k is the number of trials, and P is the probability of the event occurring once within k trials. However, this equation doesn’t quite give us the probability distribution we need. This function will give us the probability of getting exactly one event (heads 92 times in a row) out of k trials (flipping a coin 92 times in a row k times). We’re not interested in the probability of exactly one success, we’re interested in the probability of one or more successes. For that, we need the related Cumulative Distribution Function. Basically it’s the sum of the probabilities of 1, 2, 3,… up to k successes out of k trials. It’s actually pretty easy to derive without performing sums for arbitrarily large values of k. Since we want one or more successes, that means the only thing we don’t want is a failure for every trial. The probability of a single failure is simply \(1-p\), so the probability of k failures is \(\left( 1-p\right)^{k}\). Since we want every possible combination except every trial a failure, we just subtract this from 1 (the sum of all possible combinations is of course equal to one). This function comes out to be:
Choosing a reasonable number for F, we’ll select 0.98. Solving the above equation for k we get:
This equation is exact, but it has a big problem. No normal calculator or computer is going to be able to calculate the answer because of the denominator. The logarithm of one is zero, so the logarithm of a number very very close to one is a very very small number. But no normal calculator is going to be able to handle \(\text{ln}\left( 1-2^{-92}\right)\approx\text{ln}\left( 0.999999999999999999999999999798\right)\)
(Note I said no normal calculator. I used Mathematica for this and it works fine. But anything limited to double-precision arithmetic isn’t going to get you there.) Fortunately there is a convenient Taylor series expansion for \(\text{ln}\left( 1-x\right)\). It is
The first term in the series will give more than sufficient precision in this case, so we have
This tells us how many trials we we will need to to have a 98% confidence of getting 92 heads in a row, but it doesn’t tell us how many coin flips we will need. Now a trial is defined as 92 coin flips, and if all 92 are heads it is a success, otherwise it is a failure. However, we don’t need to do all 92 flips each time, as soon as we get our first tails, we already know that the trial is a failure and we can start over. Since a fair coin is going to result in tails half of the time, then that means on average we will have two flips for every trial. So if f is the total number of coin flips we will need to get a 98% confidence, then:
This is a very very big number. If we flipped a coin once a second, how long would it take us to get this number of flips?
And how long is this? This is really, really long. Astronomers estimate the current age of the universe to be \(1.373\times 10^{10}\) years old. That puts it as 100 billion times longer than the current age of the universe. This is a feat that could only be pulled off by, say, Wowbagger, the Infinitely Prolonged. According to this fascinating article on the eventual heat death of the universe, at this point there will be no matter left in the universe but white and black dwarfs (and black holes, but I don’t know if they’re considered to be matter within our universe or not), and they will be flung from their orbits due to gravitational radiation.
So is all lost? Is there no way to get 92 heads in a row? For all practical purposes, yes, there is no way. As for impractical purposes though, in a subsequent post I’ll detail a way that we could accomplish it long before the death of the universe using a scheme that in all reality would only make sense in a Douglas Adams’ universe.
As I explained your post to Adrian, I thought of a related solution and a small problem. First, Goldberg contraption style robotic coin flippers capable of 1 coin flip/second arrayed along the inside of a Dyson sphere (solar powered of course). The second is that coin flips are not actually random although they give that appearance. Using precision instruments the precise amount of force necessary to flip a coin with a fixed number of rotations should occur long before the heat death of the universe. Using the appropriate amount of force in a controlled environment is no longer strict probability, of course, so in may not apply here. Even now there may be cults of coin flipping ninjas who have already mastered this art using it to affect key wagers throughout history.
Well, there is a style of coin flipping that sleight-of hand artists use to perform what looks like a coin flip without it actually flipping head-over-tail. They make it spin about its vertical axis with a high angle of incidence, so to a casual observer it looks a lot like a valid coin flip. But only one side is always on top, so by catching it correctly you can always guarantee a heads or a tails.
For the robot coin-flipping Dyson sphere we’d have to assume that the coin flips can be made completely random. Then we’d have to calculate how many robots we can have in our Dyson sphere to be able to estimate how long it would take to get our $latex 3.874\times 10^{28}$ coin flips. I’ll include your scenario in my next post on this topic. My guess is for us to achieve the requisite number of flips before the heat death of the universe, we will need several million or so such Dyson spheres.
I look forward to your solution but, wait, don’t we live in Douglas Adams’ universe?