# I flip a coin twice, it comes up heads twice. What are the odds it is a fair coin? (No prior estimate) Is this even answerable?

I was wondering a very simple question as I was reading a book about predictions.

Let's say you have a coin and you flip it twice, and both times it comes up heads. How could you calculate the odds that the coin is fair? Is this even possible?

If we look at a more extreme example, let's say we toss a coin a million times, and we get 1 million heads. What are the odds the coin is fair? I would be extremely confident at that point that the coin is NOT fair, 99%+ confident (a made up number). However, even here I would be unsure how to assign a mathematical answer.

I know the odds of getting 1 million heads in a row is $(.5)^(1million)$ which is basically so intuitively maybe 1- $(.5)^(1million)$ is the odds it's an unfair coin.But that seems wrong when we extend it to a 2 flip example, since the odds of a getting two heads in a row is 25% and it seems absurd after two consecutive heads to declare a coin 75% likely to be biased.

Now I have seen the Bayes' way of doing it, where we start with a prior probability. (if there is anything wrong with what I post below please let me know)

If we assume there's a 50-50 chance of a coin being fair or biased such that when it is tossed heads will come up everytime.

Now it becomes a simple matter. $1/2$ of the time we will get 2 heads from the biased coin, and $1/2$ * $1/4$ = $1/8$ times we get the fair coin giving us two heads.

Now we can sum these two up and get $5/8$ chance of the coin coming up heads twice in a row. And so the odds of the coin being biased is $(4/8) / (5/8)$ = 80%

However, that number depends on our initial estimate of the coin being biased. Is it possible to have some estimate of the biased coin without an initial estimate? in the case of a million consecutive flips, I feel like you can say with almost 99.999% (arbitrary number but probably close to the "true" answer whatever that is) certainty the coin is not fair without any need for a prior estimate.

• If you give me an estimate based on 1 million flips I will give you an estimate based on 2 million flips. My answer will be more accurate, but still an estimate based on 3 million flips will be even more accurate &etc. There is no ratio between the most accurate answer, infinity, and the number of flips you've done. – mechanicious Mar 22 '18 at 23:54

As Arnaud alluded to, you cannot go anywhere unless you have other coins of some probability of being selected with some probability of being heads. On the other hand, what you can do is test the null hypothesis that the coin was fair, after you observed flipping $2$ heads.

You can implement a binomial test. Assume the coin is fair.

Let $$H_0 : p=0.5$$

$$H_a : p\neq 0.5$$

Then what is the probability of getting $2$ heads or $2$ tails?

Let $X$ be the number of heads we observe. Then

$$P(X=0)+P(X=2)=2\cdot P(X=2)=2\cdot{0.5^2}=0.5$$

Thus we fail to reject the null hypothesis at a meaningful significance level that the coin was fair.

A more interesting example would be increasing the number of trials to $n=10$

Here, if you flipped $10$ heads then you'd reject the null hypothesis at $\alpha=0.01$ that the coin was fair since $$P(X=0)+P(X=10)=0.5^9\approx0.00195\lt0.01$$

• Indeed, you can't do Probability, but you still can do Statistics :) – Arnaud Mortier Mar 23 '18 at 0:04
• Ahh Arnaud this makes a lot of sense. Thank you! – user3002540 Mar 23 '18 at 1:09

The point here is that you can't get probabilities out of your hat. You have to have a probability space that you define yourself before you can make any computation.

You have three coins, one is fair, one will land on Heads with probability $1/3$, the last one will land on Heads with probability $5/6$. You take a coin at random, by which we mean that all three coins are equally likely to be chosen, and flip it twice, getting two heads.

What is the probability that you took the fair coin?

See that the framework is perfectly well defined, you know exactly which coins are out there, how likely they are to be chosen, and how fair they are. Without these assumptions, you can go nowhere.

To expand a bit on the "million heads in a row" problem, you can imagine a framework with some number $N$ of fair coins, and one coin that is Heads on both sides. We assume that you take one of them at random and flip it a million times, getting a million Heads.

If $N$ is large enough, it is actually more likely that you took a fair coin :)

The problem with this problem is that coins can be biased in infinitely many ways. For example, you could be dealing with a coin for which the probability of coming up heads is $p=0.49$. Or, it could be one for which $p=0.53264$, or .... so, unless you give us an idea of what that space looks like, this question is impossible to answer. In fact, if you are dealing with an actual real coin from real life, the probability with which it comes up heads is most likely close to $p=0.5$, and yet the probability that the coin is one for which $p$ is exactly half is pretty much zero.

A more meaningful question would be to come up with a confidence interval of values of $p$ so that you could something like "I am 95 % confident that the $p$ value of this coin is somewhere between $0.48$ and $0.52$" ... but I can tell you that with two flips that confidence interval will be a whole lot wider than that. But with a million flips and a million heads, you can make that confidence interval very narrow, and thus probably rule out any $p$ value lower than $0.99$ or something like that ... people with a better grasp of statistics than myself can probably provide some more quantitative methods and answers.

Two heads on a fair coin comes up with probability $1/4$. Two tosses of the same side has probability $1/2$. There is nothing significant from that experiment.

According to the law of large numbers, the more you flip the coin, the closer it must get to the true proportion. So, there is a significant difference between flipping the coin twice and a million times. The idea of confidence interval is based on sampling and the size of sample. The population proportion is equal to the sample proportion plus/minus the margin of error (due to sampling). So, in inferencial statistics, the sample size $2$ (flipping twice) with unknown population distribution is considered small and it is recommended to increase the sample size to at least $30$ to apply the Central Limit Theorem...