107

Consider a two-sided coin. If I flip it $1000$ times and it lands heads up for each flip, what is the probability that the coin is unfair, and how do we quantify that if it is unfair?

Furthermore, would it still be considered unfair for $50$ straight heads? $20$? $7$?

Ben Grossmann
  • 203,051
  • 12
  • 142
  • 283
Adam Freymiller
  • 1,051
  • 2
  • 8
  • 7
  • 26
    [Here's a wikipedia article](https://en.wikipedia.org/wiki/Checking_whether_a_coin_is_fair) devoted to exactly this question. – Ben Grossmann Jul 02 '15 at 01:57
  • 16
    If you are on a ship sailing from Denmark to England, the odds may differ. – marty cohen Jul 02 '15 at 03:32
  • 10
    And if you continued the experiment and flipped it another 1000 times and it came up tails every time then we would have to judge it fair. – Aran Mulholland Jul 02 '15 at 07:25
  • There's a char limit of like 600 so my answer must be $1$ (unless I cave in and use standard form!) – Alec Teal Jul 02 '15 at 10:43
  • 5
    Since "fair" and "unfair" are qualitative values, let me give a qualitative answer: For 1,000 and 50 straight heads --> I would bet my life that the coin is "unfair". For 20 straight heads --> I would **not** bet my life that the coin is "unfair", though it sure seems to be. For 7 straight heads --> I would consider the coin "fair" though I wouldn't wager against it without further data. – user23715 Jul 02 '15 at 15:59
  • 3
    It depends ... what does your prior on $p$ look like? – Glen_b Jul 03 '15 at 03:04
  • This is *exactly* the kind of problem [Bayes's theorem](https://en.wikipedia.org/wiki/Bayes'_theorem) is for. Once you understand the theorem this problem will be totally trivial. – DanielSank Jul 03 '15 at 05:58
  • 7
    Bear in mind, If you happen to flip 1000 times and *then* it occurs to you that it may be unfair, it's [not exactly fair](https://en.wikipedia.org/wiki/Testing_hypotheses_suggested_by_the_data) to use that data in your test – Nathan Cooper Jul 03 '15 at 08:04
  • Frequency of heads in a series of tossing experiments depends on many factors, most importantly on the initial and boundary conditions of each experiment (the way the coin is tossed). The coin itself is only one of those factors. It follows the resulting series of values does not describe behaviour of the coin by itself, but the whole series of tossing experiments, including the tossing agent. The term "fair coin" is problematic; how would you define it? – Ján Lalinský Jul 03 '15 at 21:10
  • Valuable reading : E. T. Jaynes, Probability theory The logic of science, chap. 10. Physics of ‘random experiments’ – Ján Lalinský Jul 03 '15 at 21:18
  • No probability space has been defined (even conceptually) for the probability you ask about. Therefore your question is meaningless, I'm afraid – Luis Mendo Jul 04 '15 at 09:53
  • 1
    Actually if you define "fair" as "the probability of landing on head is exactly 0.5" then the probability of the coin being fair is zero, independent of the results you obtained from tossing. – celtschk Jul 04 '15 at 17:05
  • Hey high roller. Come here. Lemme show you a trick. – imallett Jul 05 '15 at 07:44

9 Answers9

105

First of all, you must understand that there is no such thing as a perfectly fair coin, because there is nothing in the real world that conforms perfectly to some theoretical model. So a useful definition of "fair coin" is one, that for practical purposes behaves like fair. In other words, no human flipping it for even a very long time, would be able to tell the difference. That means, one can assume, that the probability of heads or tails on that coin, is $1/2$.

Whether your particular coin is fair (according to above definition) or not, cannot be assigned a "probability". Instead, statistical methods must be used.

Here, you make a so called "null-hypothesis": "the coin is fair". You then proceed to calculate the probability of the event you observed (to be precise: the event, or something at least as "strange"), assuming the null-hypothesis were true. In your case, the probability of your event, 1000 heads, or something at least as strange, is $2\times1/2^{1000}$ (that is because you also count 1000 tails).

Now, with statistics, you can never say anything for sure. You need to define, what you consider your "confidence level". It's like saying in court "beyond a reasonable doubt". Let's say you are willing to assume confidence level of 0.999 . That means, if something that had supposedly less than 0.001 chance of happening, actually happened, then you are going to say, "I am confident enough that my assumptions must be wrong".

In your case, if you assume the confidence level of 0.999, and you have 1000 heads in 1000 throws, then you can say, "the assumption of the null hypothesis must be wrong, and the coin must be unfair". Same with 50 heads in 50 throws, or 20 heads in 20 throws. But not with 7, not at this confidence level. With 7 heads (or tails), the probability is $2 \times 1/2 ^ {7}$ , which is more than 0.001.

But if you assume confidence level at 95% (which is commonly done in less strict disciplines of science), then even 7 heads means "unfair".

Notice that you can never actually "prove" the null hypothesis. You can only reject it, based on what you observe is happening, and your "standard of confidence". This is in fact what most scientists do - they reject hypotheses based on evidence and the accepted standards of confidence.

If your events do not disprove your hypothesis, that does not necessarily mean, it must be true! It just means, it withstood the scrutiny so far. You can also say "the results are consistent with the hypothesis being true" (scientists frequently use this phrase). If a hypothesis is standing for a long time without anybody being able to produce results that disprove it, it becomes generally accepted. However, sometimes even after hundreds of years, some new results might come up which disprove it. Such was the case of General Relativity "disproving" Newton's classical theory.

Mark Galeck
  • 971
  • 1
  • 6
  • 7
  • 2
    This seems interesting but I think there may exist some better approach than this, maybe (Im not sure). Unfortunately I dont have by now the knowledge to make an answer. To me the uses of law of larger numbers is fundamental here or some analysis at the level of variance more than mean. – Masacroso Jul 02 '15 at 02:39
  • 7
    @Masacroso your intuition is correct. If we had, for example, 550 heads for 1000 throws, you would want to calculate not the probability that exactly 550 heads happen (which is easy but incorrect thing to do), but the probability that 550 heads _or_more_ happened. This is not so simple and advanced techniques (of the kind you are mentioning) are needed. But in the exact question that was asked, it is OK to calculate it like I did. – Mark Galeck Jul 02 '15 at 03:04
  • 5
    How would your confidence in rejecting the null hypothesis (the coin is fair) have been different if the results had been HTHTHTHTHTH..., perfect alternation between heads and tails? Or if it had been HTTHHTTHHTTHHTTHH... or indeed _any_ specific sequence of outcomes? – Marc van Leeuwen Jul 02 '15 at 06:20
  • 2
    @MarcvanLeeuwen Marc, note what I said in my comment - you actually don't calculate the probability of any _given_ event, because most of the time , that would be very close to 0. Instead, you correctly choose the "tail" of the distribution, for that particular null hypothesis. For this null hypothesis, the tail is "the number of heads in the event, or more". So for perfect alternation event you describe, although it is a very "strange" event, but it would not disprove this particular null hypothesis. Any event, would disprove it, only if there were far more one side than the other. – Mark Galeck Jul 02 '15 at 06:47
  • Actually, I correct myself, you need to take "both tails" into account, so, the number of heads or more, and the same number of tails, or more. – Mark Galeck Jul 02 '15 at 10:17
  • 5
    @MarcvanLeeuwen In both those cases, you could then use "I expect each consecutive pair of flips (HH, HT, TH, TT) to occur with equal probability" to be the null hypothesis, and calculate against your confidence interval similarly. – Phylogenesis Jul 02 '15 at 12:29
  • Hold on. Wouldn't getting 7 heads out of 1000 imply that it's *more* likely that the coin is unfair than getting 50 heads out of 1000? Right now, your answer says otherwise. – Ajedi32 Jul 02 '15 at 14:14
  • @Ajedi32 the 50 and 7 are not out of 1000, they are consecutive heads. So the chance of HHHH is higher than HHHHHHHHH. – DanielST Jul 02 '15 at 14:21
  • @slicedtoad Ah, of course! Yeah, that makes way more sense. Submitted an edit to clarify, feel free to accept if you think it's helpful. – Ajedi32 Jul 02 '15 at 14:28
  • @slicedtoad not exactly even "consecutive" heads. The OP asked "7 out of 7", or "1000 out of 1000". 7 consecutive out of a larger number, is a different ball game :) – Mark Galeck Jul 02 '15 at 16:19
  • @Ajedi32 fine with your edit, thank you – Mark Galeck Jul 02 '15 at 16:20
  • @Marc: If you picked a specific sequence of 1000 coin flips, you could design a test around whether or not that specific sequence comes up. Then if you flip the coin and see that sequence, you can reject (with an astronomical level of confidence) the hypothesis that the coin is fair. This test wouldn't be very useful, though, since pretty much every unfair coin is virtually guaranteed to pass the test. Note the importance of deciding on the test *before* performing the experiment, rather than performing the experiment and *then* deciding what tests to run. –  Jul 03 '15 at 23:23
  • ... the key idea about what's going in is that, say, you pick 5% of the possible outcomes (assuming each is equally likely), and decree "if any of these come up, I will reject the hypothesis the coin is fair". Then, 95% of the time, if you're given a fair coin, you will not reject the hypothesis that the coin is fair. The real trick is picking the 5% in a way to make it likely unfair coins will fail the test, so you can reject the hypothesis that they're fair. e.g. if you're worried about unfair coins that alternate, you'll have to use a different test than just counting heads and tails. –  Jul 03 '15 at 23:30
  • @Hurkyl I would disagree partially with you. You can't pick "any" 5% of possible outcomes. Suppose you pick some random sequence of 50 outcomes with the same number of tails and heads. Then you see that sequence come up. On that basis, you cannot say the coin is unfair at all! You cannot really say anything - the only thing I would reject at that point, if it were me, is I would probably reject that I am awake, or, that I am sane. :) – Mark Galeck Jul 04 '15 at 02:30
  • @Mark: I meant outcome (of a 1000-flip experiment) not outcome (of a single flip), sorry for the confusion! I mean to select any 5% of the set of all possible 1000-long strings of heads/tails. (that said, I would expect the odds of a particular 50-long string occurring in a 1000-flip experiment to be rather rare; probably one in a trillion-ish, so seeing it happen would still be grounds to reject the hypothesis the coin is unfair... at least if you aren't looking for twelve 9's of confidence) –  Jul 04 '15 at 03:20
  • ... I suppose I also am taking "fair" to also mean that the coin flips are *independent* of each other, rather than just being 50-50 chances. –  Jul 04 '15 at 03:27
  • @Hurkyl well it's OK we can politely disagree, but no, I would definitely not pick just _any_ 5% subset (or any subset of 1) series of flips. It has to be the tails of a particular distribution whose middle is the null hypothesis. – Mark Galeck Jul 04 '15 at 04:34
  • @Mark: It is the tail of a distribution, if you want to insist on constructing your test that way: e.g. of the random variable that is $0$ when the sequence of flips is not of the chosen set and $1$ when the sequence of flips is of the chosen set. A fair coin will produce $0$ for this random variable 95% of the time. I know this approach seems suspicious, but you're looking in the wrong place for the problem: this really is a perfectly good test that the coin is fair, but you need to make the choice intelligently to have the best chance to reject unfair coins. –  Jul 04 '15 at 04:39
  • ... e.g. if you want to reject a coin whose flips are i.i.d. Bernoulli trials with $p \neq 0.5$, then choosing that 5% to be the sequences whose proportion of heads are the furthest away from $0.5$ (in whatever relevant manner) will be the most effective choice. e.g. taking the 5% of the sequences with the most heads are the least likely sequences that can be flipped with an i.i.d. coin with less than $0.5$ chance of flipping heads –  Jul 04 '15 at 04:45
  • This is an excellent introduction to statistical testing! I wish I could have read this during my college stats course! (Sorry. I know I'm not really adding anything to the post, but this is just so outstandingly clear an explanation that I felt it deserved special acknowledgement.) – jpmc26 Jul 04 '15 at 06:38
  • @jpmc26 thank you - actually, I taught statistics to undergraduates, as a graduate student in Computer Science – Mark Galeck Jul 04 '15 at 13:32
  • Is there any chance of editing this to use MathJax? It may not matter whether we're talking 1/(2^1000) or (1/2)^1000 but it would certainly make the theory clearer. – Andrew Leach Jul 05 '15 at 08:56
  • @AndrewLeach please do if you know how to do it, and thank you – Mark Galeck Jul 05 '15 at 09:20
43

If you take a coin you have modified so that it always lands in heads and you get $1000$ heads then the probability of it being unfair is $100\%$.

If you take a coin you have crafted yourself and carefully made sure that it is a fair coin and then you get $1000$ heads then the probability of it being unfair is $0\%$.

Next, you fill a box with coins of both types, then take a random coin.

  • $NF$ : fair coins in the box.
  • $NU$ : unfair coins in the box
  • $P(U)$ : probability of having taken an unfair coin $$P(U) = \frac{NU}{NF + NU}$$

  • $P(F)$ : probability of having taken a fair coin $$ P(F) = \frac{NF}{NF + NU} = 1 - P(U) $$

  • $P(H \mid{U})$ : Probability of having 1000 heads conditioned to having take an unfair coin $$P(H\mid{U}) = 1 $$
  • $P(H\mid{F})$ : Probability of having 1000 heads conditioned to having taken a fair coin $$P(H\mid{F}) = \left( \tfrac{1}{2} \right)^{1000}$$
  • $P(H)$ : Probability of having 1000 heads

\begin{align} P(H) &= P(U \cap H) + P(F \cap H)\\ &= P(H \mid{U})P(U) + P(H \mid{F})P(F)\\ &= P(U) + P(H \mid{F})P(F) \end{align}

By applying Bayes theorem :

$P(U \mid{H})$ : probability of the coin being unfair conditioned to getting 1000 heads $$P(U\mid{H}) = \frac{P(H \mid{U})P(U)}{P(H)} = \frac{P(U)}{P(U) + P(H\mid{F})P(F)}$$

And that is your answer.


In example

If $P(U)=1/(6 \cdot 10^{27})$ ($1$ out of every $6 \cdot 10^{27}$ coins are unfair) and you get 1000 heads then the probability of the coin being unfair is \begin{align} \mathbf{99}.&999999999999999999999999999999999999999999999999999999999999999999999\\ &999999999999999999999999999999999999999999999999999999999999999999999\\ &999999999999999999999999999999999999999999999999999999999999999999999\\ &999999999999999999999999999999999999999999999999999999999999999944\% \end{align}

Very small coins like the USA cent have a weight of $2.5g$. We can safely assume that there are no coins with a weight less than 1 gram.

Earth has a weight of less than $6 \cdot 10^{27}$ grams. Thus we know that there are less than $6 \cdot 10^{27}$ coins. We know that there is at least one unfair coin ( I have seen coins with two heads and zero tails) thus we know that $P(U) \ge 1/(6 \cdot 10^{27})$.

And thus we can conclude that if you get 1000 heads then the probability of the coin being unfair is at least \begin{align} \mathbf{99}.&999999999999999999999999999999999999999999999999999999999999999999999\\ &999999999999999999999999999999999999999999999999999999999999999999999\\ &999999999999999999999999999999999999999999999999999999999999999999999\\ &999999999999999999999999999999999999999999999999999999999999999944\% \end{align}

This analysis is only valid if you take a random coin and only if coins are either $100\%$ fair or $100\%$ unfair. It is still a good indication that yes, with $1000$ heads you can be certain beyond any reasonable doubt that the coin is unfair.

Anonymous Coward
  • 756
  • 5
  • 10
  • The Finland 1 penni of 1969 weighs just 0.45g :) -- But I guess there are only about $10^{15}$ coins in the world ([this](https://answers.yahoo.com/question/index?qid=20100107070401AAg60hC) discussion ends up with about $2\cdot 10^{12}$ coins in the US). – Hagen von Eitzen Jul 02 '15 at 13:18
  • 4
    Very good for including actual data. Bayesian works best in presence of data. – PyRulez Jul 02 '15 at 15:34
  • 2
    So your saying it probably wasn't a fluke then? – PyRulez Jul 02 '15 at 15:36
  • 7
    @PyRulez More than that. This great answer managed to show that 1) the question omitted a number of key parameters (like what is the coin population I'm looking at) without which such a question normally makes no sense, and that 2) the remaining parameters were so absurdly extreme that in any otherwise "normal" circumstances inside the Solar system, this couldn't have been a fluke. – Jirka Hanika Jul 03 '15 at 12:18
  • 8
    @PyRulez The real fluke would be that after the first 500 in a row, the flipper didn't go "Hmm... better do another 500 just to be sure..." – corsiKa Jul 03 '15 at 16:58
  • 3
    @corsiKa [Well, you can never be sure.](http://dilbert.com/strip/2001-10-25) – PyRulez Jul 03 '15 at 17:21
21

In order to assign a probability to this event you need to start with a prior probability which can then be updated based on the data. Probabilities can't really be derived from experience alone, you need to start with some sort of "inductive bias" in order to draw conclusions from evidence.

The heuristic approach of hypothesis testing gives a framework for making decisions in these situations, but it doesn't pretend to assign probabilities to those hypotheses.

dsaxton
  • 1,152
  • 6
  • 14
8

In my comment, posted this link to a more thorough treatment of the general question being asked. However, I will directly answer the question using the attained result on posterior density functions, as discussed in the linked article.

In particular, we note that if $r$ is the actual probability that the coin will land on "heads" rather than "tails", then if we got $h$ heads and $t$ tails, the distribution of $r$ is described by the probability density function $$ f(r\mid T=t; H=h) = \frac{(h+t+1)!}{h! \, t!} r^h(1-r)^t $$ Now, let's say that the coin is "fair" if $r$ (which should be exactly $1/2$) falls between $0.45$ and $0.55$. Then the probability that our coin is fair, given $h$ heads and $t$ tails, is given by $$ P = \int_{.45}^{.55}f(r\mid T=t; H=h)\,dr = \frac{(h+t+1)!}{h! \, t!} \int_{0.45}^{0.55} r^h(1-r)^t dr $$ Suppose we get $0$ tails and $h$ heads. Then this probability comes out to $$ P = \int_{.45}^{.55}f(r\mid T=0; H=h)\,dr = (h+1) \int_{0.45}^{0.55} r^h dr = \\ \left. r^{h+1} \right|_{0.45}^{0.55} = (0.55)^{h+1} - (0.45)^{h+1} $$ As you can see, the more consecutive heads we get (assuming this is all the information we have), the less likely it becomes that the coin is fair. For $20$ straight heads, we compute $$ P = (0.55)^{21} - (0.45)^{21} = 3.48 \times 10^{-6} $$ Which is to say that it is extremely unlikely that the coin is fair. The probability that the coin is unfair is, correspondingly, very high.

Ben Grossmann
  • 203,051
  • 12
  • 142
  • 283
  • 1
    Mind that in this case, our prior distribution is uniform. So, the probability that a coin is fair (given that we have not yet flipped it), by this consideration, is $1/10$. – Ben Grossmann Jul 02 '15 at 04:44
  • 3
    Using a uniform prior IMO makes this computation useless. You are assuming that there are as many coins that give heads say with fixed probability $p$ with $0< p<0.10$ as there are fair coins with your definition ($0.45

    – Marc van Leeuwen Jul 02 '15 at 09:02
  • 2
    @MarcvanLeeuwen I would disagree about the "uselessness" of the approach, but yes: that assumption may be excessively biased towards an unfair coin. However, I think that changing the prior distribution only affects the probability by at most some constant factor, so that the rate at which the probability of unfairness increases is accurate. – Ben Grossmann Jul 02 '15 at 10:05
6

For "almost all" priors, the answer is 100%: you have to specify an interval of "fairness" in order to get a nonzero value. Why? Because the bias $p$ can be any real number between $0$ and $1$, so the probability that it is a very specific real number is $1/\infty = 0$; hence the probability that it is $1/2$ is 0.

However, what I can tell you is that after your tosses, the heads probability is $$\frac{h + 1}{t + h + 1 + 1} = \frac{1000 + 1}{0 + 1000 + 1 + 1} = \frac{1001}{1002}$$ ...assuming you initially believed the coin was fair (see @leonbloy's comment under the question).

More generally, if the heads probability $p$ has prior distribution $\Pr(p)$ then the answer is:

$$\frac{\int_0^1 p\,p^{1000}(1-p)^{0}\Pr(p) \,dp}{\int_0^1 \phantom{p\,} p^{1000}(1-p)^{0}\Pr(p) \,dp}$$

Notice that for the uniform prior $\Pr(p) = 1$, this degenerates to what I gave above.

The derivation is longer and likely to be much more complicated than you might expect, so I'll omit it to save typing... if you really want to see it, let me know.
(Basically, you need to apply Bayes's rule and simplify.)

user541686
  • 12,494
  • 15
  • 48
  • 93
  • Actually, an uniform prior means that you made no assumption at all about the fairness of the coin (you still get $p(Head)=0.5$ from ignorance: Since you have no bias, both results are equally likely). A prior 100% assumption that the coin was fair would mean $Pr(p)=\delta(p-0.5)$, and with that you'd find that the coin is fair with probability 1 no matter what you toss. Basically it's the "unshakeable belief" prior. In reality, you'd probably use a prior that's peaked around the fair coin (because most coins are approximately fair, but you wouldn't exclude the probability of it being biased). – celtschk Jul 05 '15 at 11:43
2

You asked

if this specific string of flips happens, what is the probability the coin is unfair?

And it seems to me that most answer here are answering the question

if the coin was fair, what is the probability of this specific string of flips happening?

If I try to literally answer your question, I get stuck unless we make additional assumptions. For your question, the sample space would have to be something like all instances ever of flipping a coin 1000 times. Not one specific coin mind you, but all instances ever, anywhere, of flipping one coin 1000 times. The next instance of 1000 flips can use a different coin. Some elements of that sample space would have 1000 heads. And some elements of that sample space would have involved a fair coin.

But we can't do any calculating until we understand, among coins, what is the distribution of fairness? $p$ for a coin can range form $0$ to $1$, with only exactly $0.5$ being fair. If you assumed a specific distribution for the fairness of all coins, then we'd have the necessary information to calculate an answer for your literal question.

In a world where every coin is fair, then even with these 1000 heads, there is a 0% chance that your coin is unfair. In a world (more like the real world) where no coin is truly fair, then there is automatically a 100% chance that your coin is unfair. If you'd like to model with something in between, say 50% of coins are truly fair, and the other 50% is distributed some way among $p\in[0,0.5)\cup(0.5,1]$, then based on that information we could calculate a more interesting answer.

2'5 9'2
  • 51,425
  • 6
  • 76
  • 143
1

This is an issue not so much about mathematics as about the real-world background to the coin-tossing experiment. Convincing fake coins are fairly common: for example, about 5% of the £1 coins circulating in the UK are counterfeit*. It would be just as easy to forge a double-headed (or double-tailed) coin as a normal one. And probably (!) forgers have made a few, either as a joke or to cheat people. On this basis, your coin (by a Bayesian analysis) is almost certainly double-headed.

Well, the next step is to inspect the coin to verify that it has a head on only one side. Then you have to ensure that this is actually the coin that is thrown each time; that the way it is thrown is fair; that the people checking the coin and recording the outcomes are honest and scrupulous; and so on. The more boxes are ticked, the less plausible is the 1000-head outcome. But this outcome would be near impossible even for a coin that is osmium--iridium on the tail side and magnesium on the head side. So doubts would still arise about the checking and recording procedure. For example, is a conjuror or skilled hoaxer involved at some stage?

The discussion of this experiment can obviously go hyperbolic. To cut things short, if the conditions of the experiment are guaranteed, in some absolute cosmic sense, to be fair, and only the balance of the coin is in question, then supposing the 1000-head outcome would be close to postulating a miracle; and that does not usually admit rational discussion.

As the supposed number of heads reduces, so the above argument weakens and needs to become more hedged, more complex, more numerical, and more uncertain. At some point, the only supportable response is to shrug one's shoulders and say "who knows?".

*2018 update: The £1 coin mentioned has now been replaced by a coin with new complex features to make forgery much harder.

John Bentin
  • 16,449
  • 3
  • 39
  • 64
0

The Bayesian approach others are taking requires guessing at a prior distribution of the coin's probability of heads, introducing another assumption into the question. We can simply take another approach, which is to ask "if the coin was perfectly fair, what are the chances I'd observe a string of heads of length $k$ or longer?"

It is well known that this follows the binomial distribution, which says that the probability of getting exactly $k$ heads in $n$ independent flips, each with probability $p$ is given by

$$ f(k;n,p) = \binom{n}{k}p^k(1-p)^{n-k} $$

If I want to know the probability of length $k$ or longer, in general, I have to sum up the probability for length $k$, $k+1$, $k+2$...up to $n$ flips. However, in this case, $k=n$ because we are calculating what happens when all the flips are heads, so there is only one term in the sum. If the coin were perfectly fair, then $p=1/2$. All this gives $$ f(k;k,1/2) = \frac{1}{2^k} $$

For $k=1000$, this gives a probability less than $1$ in $10^{301}$. For $k=50$ the probability is less than $1$ in a quadrillion. For $k=20$ the probability is less than $1$ in a million. For $k=7$ the probability is $1$ in $128$. It's up to you to decide if these outcomes are unlikely enough to warrant the conclusion of unfairness; that number is the probability that you got a string of heads by chance from a truly fair coin. If that probability seems unreasonable to you, you can instead conclude that the coin is not truly fair.

rajb245
  • 4,550
  • 14
  • 30
  • 6
    Suppose we get the combination $THTH...$ of length $k=50$. By your logic, the probability of this outcome is $1$ in a quadrillion, so it's practically impossible that it happened by chance. So, we might conclude that we have a "magic coin". But then again, the probability of **any** single sequence of outcomes is about 1 in a quadrillion. That's low enough to assume that the outcome that occurred couldn't have happened by chance. The conclusion we must reach, then, is that if you flip a coin 50 times, it becomes magic. – Ben Grossmann Jul 02 '15 at 15:25
  • @Omnomnomnom yes, raj245 answer is basically the same as mine, but without one very very important detail - that you should take the probability of the "tails" of the distribution, rather than, a particular event, which is likely to have a very low probability by itself. – Mark Galeck Jul 02 '15 at 16:24
  • @Omnomnomnom the string of heads and tails you propose is simply $k=25$ heads in $n=50$ flips; the probability assigned to this event is about $11$ percent, so I wouldn't say this coin is magical; this outcome is not exceedingly rare. Remember, the binomial distribution does not give the probability of one particular string of outcomes, but simply of the total counts of a string of outcomes. It just happens in the case of all heads, there is only one way to choose how to assign $50$ heads into $50$ slots. – rajb245 Jul 06 '15 at 19:33
  • @raj245 no not at all - the perfectly alternating string of results does not have 11% chance. It has the same chance as "all heads" or "all tails". – Mark Galeck Jul 08 '15 at 05:55
  • I don't disagree that any particular sequence is very rare, only that getting 25 out of 50 heads, in any order, is not that rare. If a coin was observed to give a set of flips that was THTHTH..., I would use the binomial distribution and get about 11%, and conclude that the this is not unlikely enough to discard the hypothesis that the coin is fair. As you said, we both gave answers along the same lines...it seems that we should agree here. In general, I'd sum over events more extreme (the distribution "tails" you talk about, $\sum_k f(k;n,p)$), but that sum only has one term in this case. – rajb245 Jul 08 '15 at 14:36
  • @rajb245 OK I see what you mean. I agree. In fact, in the case of 25 tails and heads in the trail of 50 throws, the probability is 1, because the "tails" must be added, and in this case the event is right in the middle. So this event would never disprove this null hypothesis. However, if this event happened to me, what I would reject immediately, is that I am awake. If some other evidence proved absolutely that I am awake, I would then reject the hypothesis that I am sane and not hallucinating, and promptly seek help at a mental institution. Not kidding. – Mark Galeck Jul 09 '15 at 18:02
  • Now this is getting interesting :-) If I saw that behavior repeatedly, and I was fairly certain I'm not insane, I think I would simply reject that the flips are independent events, and then begin writing a paper about how I discovered a coin that flips with perfect dependence on the previous flip. I'll have discovered a coin with 1-bit of memory, a mechanical 1-bit flip-flop! – rajb245 Jul 09 '15 at 18:30
-5

Given the chance for a head-up is 0.5:

$(1/2)^{1000} = 9.332636 \times 10^{-302}$

50 times?

$(1/2)^ {50} = 8.8817842 \times 10^{-16}$

Depends on your standard of unfairness, I would say it is pretty unfair for cases 50 and 1000 of straight heads.

Ben Grossmann
  • 203,051
  • 12
  • 142
  • 283
Eric Feng
  • 1
  • 1
  • 6
    For the case of 1000 consecutive heads, do you mean that there is a 1 - ((1/2)^1000) percent chance that the coin is biased? What prevents us from saying that there would be a 1 - ((1/2)^5) percent chance that a coin is biased if it lands heads up five straight times? Where do we draw the line? – Adam Freymiller Jul 02 '15 at 02:05
  • 3
    You are just plain confusing the probability that $n$ successive outcomes will be heads given a fair coin with the likelyhood that a coin is fair given $n$ successive outcomes "heads". The link between these two problems (only the first of which is well formulated probability question) is complicated, and at the heart of the foundations of statistics; in fact the answer to the first problem in itself says almost nothing about the second problem. Such simplisitc answers are unhelpful. – Marc van Leeuwen Jul 02 '15 at 11:18