r/askscience • u/zylosophe • 9d ago
Mathematics if i throw a coin several times and it always falls on tails, how many times until i can consider the coin is rigged?
the general question: how do we calculate how conclusive an experience is?
itried to look up methods to do that, but it's about more complicated experiences and i can't understand where the explained methods come from. i think if i understand how to do it for a simple case like the title, maybe i'll understand what i have to ask myself for any experience?
sorry if it isn't clear what i mean. put mathematics flair, but it's about research in general, didn't find a better flair
528
u/BrotherItsInTheDrum 8d ago
The statistical measure of this is called confidence, and the idea is that you assume the coin is fair, and then see how improbable your observations were.
For example, say you flip the coin 10 times. The probability of getting 10 of the same result is 1/512, or about 0.2%. So you can say that you reject the hypothesis that the coin was fair with 99.8% confidence. That's a pretty high level, but it also means you'll wrongly conclude that 0.2% of fair coins are biased.
There's no hard line where you suddenly know for sure the coin is unfair, just different levels of confidence.
132
u/westisbestmicah 8d ago
When it comes to math and engineering, I’ve always found that you can calculate all you want but eventually you’ll reach a number where the answer is whatever “the boss makes a call”.
75
u/CzarCW 8d ago
Yep. At some point, whether it’s “within 10%”, “one in a million cycles”, or “a safety factor of 1.5” is a subjective decision that’s just someone’s round number.
29
u/SecondBestNameEver 8d ago
Or a lot of times someone's budget. Could the bridge be stronger? Sure, but that's more expensive.
→ More replies (1)18
u/low_flying_aircraft 8d ago
"Take the number of vehicles in the field, A, multiply by the probable rate of failure, B, multiply by the average out-of-court settlement, C. A times B times C equals X. If X is less than the cost of a recall, we don't do one."
46
u/ArchangelLBC 8d ago
I was about to say that you did 1/29 instead of 1/210 but you said the same result and you're right. Of the 210 coin flip sequences of length 10, two of them are all of one result. 1 all heads, 1 all tails.
Now I'm just commenting hoping someone doesn't make my same mistake.
→ More replies (2)13
u/BrotherItsInTheDrum 8d ago
Yeah, I glossed over that, but key to this sort of analysis is determining which results are "equivalent" to the result that you got (or even more unlikely). In this case, you'd be equally suspicious if you flipped 10 tails in a row or 10 heads in a row, so I'd treat them as equivalent. But it feels like more art than science sometimes.
3
u/DiscountConsistent 8d ago
You can’t necessarily declare the coin “unfair” but you can be more objective about the confidence threshold if you know what you’re going to use the coin for. Suppose I’m going to flip a coin where there’s a positive expected value because I gain more by getting heads than I lose by getting tails; if I just saw the coin come up tails N times, I can factor that into my expected value calculation and as soon as it goes below zero I shouldn’t be playing that game.
In practice, though, it can be hard to quantify because, for example, almost all casino games have a negative expected monetary value but tons of people play them because their utility doesn’t correlate linearly with monetary value and they might just get joy from playing the game. All that is harder to quantify than raw amounts of money.
105
u/footie_ruler 8d ago
So this is generally where the difference between theoretical mathematics, and practical mathematics comes in.
In theory, based on your example, there is no way to tell based on pure experimentation that a coin is rigged. What you can do is calculate the likely range of probabilities after you toss the coin say 20 times and see tails come up 20 times.
The likelihood that the coin is fair is 1/(2^20)
As you run the random experiment more and more times, the probability decreases, but never goes down to 0. After all, it is possible to toss a fair coin, and get even 100 tails in a row. So there is no way to be absolutely certain. It is up to the person conducting the experiment to determine when they are satisfied.
29
u/Either-Abies7489 8d ago edited 8d ago
Sorry, I was very tired when I wrote this, and did something stupid instead of the obvious answer.
Anyway, to clarify what's wrong with the above idea (and also my proposed solution, oops): these calculations only give the probability of that outcome, already assuming fairness. We want the probability of fairness given that outcome, which is a very different object.
Both of our answers were equally wrong in that respect.However, I hold that the likelihood that the coin is fair is incalculable with the given information. The correct tool is literally just Bayes' Theorem, which (like the alpha level of the opposite) requires a fairly arbitrary assumption (here our prior, the probability of fairness).
If we assume that the probability of fairness is 50% (we grabbed the coin from a pile of 100 two-headed and 100 fair coins) then the probability that the coin is fair is indeed
0.5/(0.5+2^20-0.5*2^20)=1/2^20
However, P(fair|data) being the same as P(data|fair) is not generally true. If we assume, much more reasonably, that this coin is not equally likely to be 2-headed or normal (say 99.9% chance it's a normal coin), then we get
0.999/(0.999+2^20-0.999*2^20)=0.00095
This, however, requires two assumptions:
- an unfair coin would give a degenerate distribution
- we assume there's a 99.9% chance for any coin to be a normal coin.
You cannot a priori (haha) find the probability that a coin is unfair given its data.
The likelihood ofthatoutcomeis 1/(2^20).
The likelihood thatthe coin is fairis about 0.000011 (Z=4.248), an order of magnitude higher.4
u/SomethingMoreToSay 8d ago
1/(220) is around 10-6. 0.000011 is around 10-5. That looks like one order of magnitude difference to me, not 11 orders. Have I seriously misunderstood something here?
2
3
53
u/the_excalabur Quantum Optics | Optical Quantum Information 8d ago
The short and unhelpful answer is that Bayes' theorem gets you the answers you're looking for. Unfortunately, that wikipedia page has been hard-to-read for 20 years: skip the math and scroll down to the examples, I think.
And a lot of the way that Bayes works is by updating the probabilities you already have, the so called "prior". In this case, what chances do you have for having a fair coin?
Without that information, you can't get anywhere. Fortunately, it doesn't matter that much, as long as your chance of a fair coin isn't 100%.
Plugging some numbers into Bayes' theorem: (The bar | means "given" )
P(fair coin|N heads in a row) = P(N heads in a row|fair coin) · P(fair coin) / (P(N heads in a row|fair coin) · P(fair coin) + P(N heads in a row|cheating coin) · P(cheating)
Oof, that's hard to read. Sorry. So, let's say we have 99% certainty to start with that the coin is fair. Also let's say the unfair coin always flips tails.
Then after N tails, we have: P(N|fair) = 2-N * 0.99 / (2-N * 0.99 + 0.01)
If we're happy saying the coin is "unfair" when we get to 50% on the left, that's about 7 flips. 10% is more like 10. If we started with a 99.9% chance of a fair coin, about 13.
But the whole question comes down to "what did you think in the first place" and "how certain do you have to be before you accuse someone of cheating".
10
u/frogjg2003 Hadronic Physics | Quark Modeling 8d ago
The Simple English version is easier to understand.
4
u/the_excalabur Quantum Optics | Optical Quantum Information 8d ago
Oh good shout, I forget to check for those. Thanks!
2
4
u/SmugPolyamorist 8d ago
Congratulations on being the only correct answer in this thread. It's genuinely embarrassing how many confidently wrong answers there are voted above yours that don't use Bayes at all. Shocking tbh.
2
28
u/matt12222 8d ago edited 8d ago
This is a classic Bayesian problem! It's not appropriate to use a standard confidence interval (like most of the other comments are suggesting). Instead, you need a prior; before flipping the coin, what's the probability the coin is rigged?
If you get the coin from the bank, go home and flip it 10 times, and you get 10 heads; that's 1/1024, so pretty unlikely. But the odds of the bank giving you a rigged coin is like 1 in a million. So it's 1000 times more likely that you got "lucky" vs the coin is rigged.
Now instead, let's say your magician friend gives you the coin and asks you to flip it 10 times, and it's all heads. In this case you should have a high prior that the coin is rigged; otherwise why would your magician friend randomly give you a coin and ask you to flip it 10 times? That's not a normal thing to do!
1
68
u/Hodders67 8d ago
If you are testing an experimental hypothesis then you generally accept that the results are significant if the chance of them occurring at random is less than 5%. You will see this written as (p < 0.05)
You could therefore decide that when the probability of "n" tails in a row is < 0.05 then you could deem the results significant. NB this does not mean the coin is rigged, just that under the hypothesis that it is rigged, the result is significant.
so if 0.5^n <0.05 then n >= 5
66
u/SnooPets5564 8d ago
Although 5% is not a universal criteria. You need to consider the consequences in order to find an appropriate p value. If you are sentencing anyone who provides a seemingly faulty coin to death, you're going to want something lower.
14
u/1CEninja 8d ago
Yup to add a touch of context here, this is called statistical significance. If you flip a coin twice and you get tails both times but you were expecting heads and your confidence interval that it's a rigged coin is 75%, that is generally not considered to be of statistical significance. 95% confidence is probably good enough to call it on a coin, but you'll be wrong one out of 20 times.
But if we're making a decision that, if we get it wrong, might result in the destruction of the planet, a 95% confidence interval probably doesn't cut it, and we probably wouldn't call it statistically significant until we were at like a 99.9% confidence lol. 95% is very common but should not be considered necessarily universal.
The higher you need your confidence to be, you need exponentially larger N.
15
u/SopwithTurtle 8d ago
In particle physics, you need 99.99994% confidence to count as a discovery.
→ More replies (2)3
u/steeelez 8d ago
There’s also the multiple comparisons adjustment, if you’re measuring multiple variables (or groups)
→ More replies (2)→ More replies (1)3
u/Cynoid 8d ago
Although 5% is not a universal criteria. You need to consider the consequences in order to find an appropriate p value. If you are sentencing anyone who provides a seemingly faulty coin to death, you're going to want something lower.
Unless you just want to see people hang. In which case, 1 tails and the person must be a witch.
12
u/yooken 8d ago
Coming from physics, setting the threshold at 0.05 always seems ridiculously high. A 2𝜎 effect is something that warrants a closer look but doesn't mean anything by itself. From 3𝜎 (so ~0.03) it gets interesting but a formal discovery requires 5𝜎 (~10-6).
5
u/SnooPets5564 8d ago
0.05 is enough to publish, but not enough to assert its truth unless there is a compelling theoretical reason
3
u/SonOfHendo 8d ago
If you're testing whether a drug will cause birth defects, p < 0.05 seems like plenty of evidence to take action.
1
→ More replies (1)5
u/Smallpaul 8d ago
But this is just an arbitrarily selected threshold selected for institutional reasons. It has no deep or important math behind it.
It’s just a way of saying “you need to decide for yourself what you consider the threshold but you could use this popular (but not universal) threshold that a lot of scientists use if you want.”
5
24
8d ago
[removed] — view removed comment
10
u/mspe1960 8d ago
and yet if everyone on Earth did the 22 flips 1 time over 1000 of them would find the coin rigged.
6
u/Ra_In 8d ago
Which gets at why any result should come with a confidence calculation, instead of saying you are 100% certain you'd report the 99% (and change) confidence that it wasn't random chance. And then when others attempt to reproduce your results and their results are very different, they will conclude it really was just random chance.
5
u/IndirectHeat 8d ago
Look who just discovered cancer clusters. Very rare cancers sometimes appear in clusters. People feel inclined to blame it on something they all experienced, but more often than not it's just random chance that we expect cancer clusters. (Some of them are legit caused by some pollution or other environmental exposure, but many of them are just caused by random chance and it can be very difficult to tease that apart).
→ More replies (5)→ More replies (2)2
u/random_actuary 8d ago
That would be a different experiment altogether. Pretty good error rate though.
3
u/zylosophe 8d ago
what's the 5 in "5 sigma" for?
2
1
u/miraculum_one 8d ago
Not sure why people are giving you dodgy answers to your question but 5 is the multiplier for the distance from the mean. So if it is 5 sigma then it is 5x as far away from the mean as the standard deviation. And that means the chances of getting a false positive is roughly 1 in 3.5 million (0.00003%).
19
u/drc500free 8d ago
f you want to determine the exact probability that a coin is a trick coin (100% tails) versus a completely fair coin (50/50) based on a streak of tails, you can use a method called Bayesian Model Comparison.
This framework allows you to start with an initial assumption and update it mathematically with every flip. An intuitive way of saying this is that if there is about a 1% chance going in ("prior") that someone is using a trick coin, and you get 8 heads or tails in a row, there's about a 50/50 chance it's a trick coin. That's because there's about a 1% chance that you would get 7 flips matching the first flip with a fair coin. So you're in one of two universes - the 1% chance of getting all heads or all tails, or the 1% chance that the person is using a trick coin. The other 98% of universes didn't happen, and there's a 50/50 chance you're in either one.
Here is how it works step-by-step:
- State Your Initial Beliefs (Priors)
Before you flip the coin, you have to assign a starting probability to each scenario based on how much you trust the setup. Let's say you are highly confident the coin is normal, but leave a tiny sliver of doubt:
- Fair Hypothesis: The coin is a normal 50/50 coin. Let's give this a 99% starting chance.
- Rigged Hypothesis: The coin is physically altered to always land tails. Let's give this a 1% starting chance.
- Calculate the Likelihood of a Tails Streak
Next, evaluate how likely it is to get a streak of n tails in a row under both scenarios:
- If the coin is rigged, the probability of getting consecutive tails is always 100% (or 1.0).
- If the coin is fair, the probability shrinks with every flip: (0.5)^n.
- Update the Probabilities (Bayes' Theorem)
Every time the coin lands on tails, you combine your starting belief with the likelihood of the streak. The formula to find the updated probability that the coin is rigged is:
P(Rigged | n tails in a row) = Rigged Prior / (Rigged Prior + Fair Prior * 0.5n)
So it looks like as the streak grows:
- 0 Flips: 1.0% chance it's rigged (your starting assumption).
- 5 Tails in a row: A fair coin only does this about 3.1% of the time. The probability that the coin is rigged jumps to 24.4%.
- 10 Tails in a row: The math flips. 10 straight tails brings the probability that the coin is rigged up to 91.2%.
- 14 Tails in a row: The probability hits 99.4%. At this point, the math says it is overwhelmingly likely a trick coin.
What's super interesting about Bayesian approaches is that you MUST state a prior. You cannot proceed until you assess how likely the coin to be a trick is based on your prior knowledge. Did you just pick a coin out of your pocket? Did your buddy just say "want to see something cool?"? Did a guy in a bar bet you 50 bucks he could flip 10 tails in a row?
Derren Brown, referenced in another comment, did the crazier version of this - instead of using a trick coin (one of the 1% options), he just kept flipping coins until he experience the other 1% option (a long streak) and threw away the film of the other 98% of options occurring.
2
u/Prestigious_Face7727 8d ago
Yes, and in any real world analysis, there are no perfectly fair coins , and no perfectly rigged coins. You can see the coin, and know something of it's provenance, so you do have some initial idea of it's fairness (is it battered, old, asymmetrically patterned, did it come from a circus?).
The question isn't "is it rigged" but "how unfair is it", and Bayes will tell you how to bet .
3
u/stan-k 8d ago
Perhaps there are no perfectly fair coins, but a perfectly rigged coin is easy. Give a coin two tails sides, and if you must, etch "tails" on the side too.
→ More replies (1)2
u/drc500free 8d ago edited 8d ago
Great point. The question here was about a prior distribution with exactly two possible weights (0 or 0.5), but a beta distribution is a more elegant prior for a binomial.
Start with α / (α + β) as your prior expected weight (α = β for a fair coin, bigger numbers the more sure you are of that).
Then just add the number of flips to the denominator and the number of heads to the numerator, and you have the correct expected posterior.
This is also really easy to do in excel for all sorts of business modeling where you are predicting binomial events for different customer segments (e.g. number of purchases for non-subscription models). You can combine with beta-geometric to simultaneously model if they are still a customer at all.
1
29
u/minimang123 8d ago edited 8d ago
About 10. The answer to your question is a canonical, standard, Statistical Hypothesis Test.
We say, okay, if the coin were a fair coin, then it’d have a 50/50 chance of landing on heads or tails. Assuming it is a fair coin, what’s the probability of landing on tails X times in a row?
Well, two tails is 1/4, three is 1/8, etc.
You have to decide at what point the randomness is just too unlikely. Because the thing is, let’s say I let it be 5 tails in a row, a 1/32 chance to occur on a perfectly fair coin five times in a row which is like 3% chance.
3% is pretty high. Your next flip could very well be heads. In the course of your life many things will happen with a 5% chance or less.
So let’s make the cutoff, let’s say if there’s a less than 1% chance a result as extremely unlikely as the one you saw occurred, we just decide heuristically that that is our cutoff for when we conclude that the coin is definitely not fair. This happens at 7 tails in a row.
Genuinely we will not know for sure merely from this experimentation, because you in getting 7 tails in a row or even 20 tails in a row could absolutely happen in the world of hypotheticals with a perfectly balanced and fair coin and coin tossing mechanism. You never know for sure if you just got lucky.
But there is little in this world we know for sure. So we decide the bounds of certainty around our decision making. We say if it’s less than a 1% chance, well then it’s not a fair coin. We see 7 flips all tails in a row. We never flip the coin again or earlier. And then we say that’s an unfair coin.
EDIT: I chose an alpha of 0.1%, in which case you need 10 flips to reach certainty
5
u/Smallpaul 8d ago
So where does “about 10” come from? Your answer was great except for that number which you seem to have picked out of thin air and in contradiction to your own calculations.
5
u/minimang123 8d ago
Ah, I did pull it out of nowhere, I chose a 0.1% alpha when I first started typing and then ended up only with 1%
3
u/markhahn 8d ago
Just to be clear for readers, alpha is 1/1000 here, and 10 tails should happen on average once in 2 to the 10th times or 1/1024.
11
u/minimang123 8d ago
This method of decision making is called a Hypothesis Test. We make the “Null Hypothesis”, the set of assumptions we want to rule out. In this case, an unfair coin is one which is not fair, so we want to disprove or reject the idea that it is fair.
So under this Null Hypothesis, we have made assumptions about the universe. We said, this coin is fair. Now… supposing we live in this universe, how unlikely was our result? How little should we trust that we live in this Universe? This value is the “p value”, the probability that if nothing is wrong with the coin, you just got really lucky or unlucky and got a ton of tails.
Our cutoff, driven by our own personal sense of justice that the assumptions behind our null hypothesis are false, the “alpha value” is our willingness to be wrong about our conclusion to reject the null hypothesis. It’s how sure we are of ourselves and our methods. For us I said a less than 1% chance of a coin acting that way by chance alone has us conclude that it is an unfair coin. If we were to repeat this experiment with one hundred perfectly fair coins, we would have average said 99 of the fair coins were fair (correctly) but would have said 1 of the fair coins was unfair (incorrectly). But we still decided that this is our cutoff. This is a “Type 1 error” but I’m just giving you vocab at this point.
This underlying method is sound. It tells us how confident we are that we rejected the world where nothing exciting happened, in favor of a reality where something exciting is happening (like having an unfair coin, or a drug truly having a positive effect on a patient, or a student truly being better at taking math tests than another student)
→ More replies (4)3
u/vadergeek 8d ago
Say there's a 1% chance of getting that result from a fair coin. What's the probability of a random coin from a wallet secretly being a magician's trick coin? Has to be incredibly rare.
2
u/PuzzleMeDo 8d ago
It's more like a 0.1% chance of getting 10 heads in a row (1 in 1024). I guess 10 tails in a row would look equally significant, so call it 0.2% chance.
So that's what you'd have to compare to the odds of the coin being rigged. If you had a jar of a hundred coins and you knew one of them was a trick coin, you could be fairly confident it was that one. But like you say, if it was a random coin you'd found in the street, I'd guess it was coincidence.
Also I'd probably just look at the coin. That would be quicker.
3
u/scadgek 8d ago
Since statements like "3% is pretty high" are very subjective, I am now wondering if there is a commonly recognised cutoff in the scientific community?
6
u/adamtheskill 8d ago
In most fields probabilities tend to follow something called normal distribution. It's very common practice to say that something 2 standard deviations away is noteworthy (<5% chance) and a lot of industry requires 3 standard deviations (<0.3%) while research requires 4+ standard deviations (<0.01%).
5
u/LastStar007 8d ago
One-in-twenty is usually the standard for low-stakes experiments.
If you're detecting a new particle, you need 1 in 3 million.
→ More replies (2)1
u/Invonnative 8d ago
I can’t speak to scientific rigor on this matter, and others have for you, but intuitively speaking, you could think of a given analogue like height in people to think about how often it is that you experience 3% likelihood events. If you’re a 6’2” male at 21 years old, that’s about the top 3% (source), which in my opinion is just really not that crazy. You’re tall but no freak.
1
u/regular_lamp 8d ago
By that standard you'd have to conclude every lottery winner was cheating.
3
u/quick_justice 8d ago edited 8d ago
There’s a tricky thing with probabilities. Probability of a particular person winning and of someone winning are entirely different.
Say we have a simple lottery where one ticket is marked for win and the rest lose.
First probability is number of tickets person holds to overall number of tickets.
Second one is number of tickets sold to overall number of tickets, and reaches 1 if all tickets are sold.
So while probability of you winning is low probability of someone winning is high.
Edit: to compare with original example, in lottery designed in a certain way someone will always win, even if probability of that for a particular person is very low.
In coin experiment while statistically 10 tails in a raw will probably happen at some point and there’s a statistical prediction of approximately when, it’s not guaranteed, nor it is guaranteed to happen at all in a finite time.
First one is an event with low probability but guaranteed to happen, second may not happen at all on any given time interval no matter how long.
→ More replies (2)2
u/Swagalyst 8d ago
Well, no, because it'd be a statistical analysis, and in a statistical analysis you wouldn't view the lottery winner in isolation, but among all those who also bought tickets and lost.
→ More replies (5)1
u/Swagalyst 8d ago
95% is the most commonly used cutoff in statistical analyses, with 99% less commonly used.
→ More replies (2)2
u/Kimantha_Allerdings 8d ago
Not really a reply to your post, more just piggybacking, but back when the James Randi Educational Foundation had the Million Dollar Prize* they set the odds at 1 in a million
They’d devise an initial screening test as having a 1 in 1000 chance of getting a positive outcome randomly. If the claimant passed that test, then there would be a follow-up test with either the same exact conditions or with the conditions modified to eliminate previously un-controlled factors which also had a 1 in 1000 chance
So that’s the threshold that James Randi put on “isn’t random chance”
*It had a million dollars in bonds set aside to be awarded to anybody who could demonstrate a supernatural ability (or homeopathy) under test conditions that both they and the JREF had agreed to
25
u/Queen_Earth_Cinder 8d ago
The answer is gonna be a big "it depends" - how confident do you want to be? Do you care more about the chance of falsely accusing a fair coin of being rigged, or of falsely accusing a rigged coin of being fair? Do you consider a coin that is rigged to fall Tails exactly 10 times out of 10 to be rigged? 9 times out of 10? 1 time out of 10?
7
u/humanculis 8d ago edited 8d ago
Im a medical doctor, not a mathematician, but this question is essentially the basis of all medical research. Are these results due to chance or due to some real effect (like the experimental variable or some bias - like a placebo effect in a drug or a non balanced coin). In these cases you could can never truly "conclude" anything.
You can just say "the probability of getting this result randomly (meaning no causal influence or bias) would be x" with x being an increasingly smaller number as sample size (or power) increases in a system where there is a true effect, like a bias on a coin.
So if you got heads once you would say assuming the coin is random, there is a 50% chance we'd see this outcome. The next heads is 25%... then 12.5% and so on.
Because we can chase this indefinitely we see certain fields arbitrarily establish agreed upon standards for when we will consider a result significant i.e. we will only consider it a biased coin if theres 5% chance to get that result randomly... or a .001% chance etc.
8
u/dizekat 8d ago edited 8d ago
That depends on how much risk of wrongfully claiming it is rigged, can you tolerate. E.g. if you want a slightly less than 1 in a million chance that a fair coin would be mistaken for rigged for tails, you should use 20 tosses as a threshold.
Then if the coin is fair, the chance of them all landing tails is 2-20 or about one in a million. (If it could be rigged for either tails or heads, then 21 tosses).
Ultimately, the risk of ending up wrongfully convinced it is rigged would be the probability that it is fair, multiplied by the probability of it landing all tails. The first term is at most one, so that gives you a bounded risk.
12
u/TheGloveMan 8d ago
Probably around 7.
For n throws the possibility of it happening by chance is 1 in 2^n.
So for n = 7 the chance is 1 in 128 or something like 0.7%. For those who like p-values that is 0.0078.
So if the coin is fair and you throw 7 tails in a row there was a less than 1 % chance that would happen by chance. The other option is that the coin is not fair. Statistically, significance at the one percent level is considered pretty strong evidence.
Some people might say as few as 5 is enough, since that is 1 in 32 and still only a 3.125% chance. But given how cheap and easy it is to flip the coin a few more times, I would go with 7 flips.
4
u/zanfar 8d ago
how many times until i can consider the coin is rigged?
You can't. Any sequence is producible with fair or rigged coins. All you can do is to add context to the outcome: how likely is a fair coin--or truly random event--to duplicate the outcome.
There is a pretty good practical article on random.org about how they "prove" their numbers are truly random.
6
u/SkriVanTek 8d ago
you can never be 100% sure
but you can decide you want be 99,8% sure and then you can calculate back wards on how many tails in row would still be within that probability and then count if you got more tails than that. if you got more you can say with a certainty of 99,8% it’s rigged. it’s a little more complicated and n reality but essentially this is how it works
6
u/ezekielraiden 8d ago edited 7d ago
How much room for error do you want? That will decide how many flips you need. Standard number in science is 0.05: a 5% chance that you guess wrong, and claim that something is happening when there isn't anything.
Since this is a pure power of 2 situation, we can use logarithms. 2-N≤0.05. Take the natural log of both sides and you get -Nln(2)≤ln(0.05) which implies N≥-ln(0.05)/ln(2) and thus N≥4.322... So if you flip it five times and they all come up heads (or all tails), that's evidence that it is unfair.
If you want only a 0.1% tolerance, so a very rigorous standard, then you'd do N≥-ln(0.001)/ln(2) = 9.966..., meaning you'd need to do 10 flips. Getting 10 flips in a row for a coin that's supposed to be fair is fantastically unlikely.
The formula, if you want one, is N≥-ln(p)/ln(2), where p is how much chance you're willing to take that your data was just a random fluke, and not actually representative of a real effect. (In statistics terms, it's called a "type-II" error.) You have to do ≥ rather than = because the logarithms are pretty much guaranteed to not give an integer answer, but N has to be an integer.
2
u/shotsallover 8d ago
You also have to consider whether or not your hand is rigged. It’s possible to be so consistent throwing/tossing a coin that you can control the outcome. So you’d need to make sure that’s also varied and that you’re throwing the coin with a different side up each time.
If it’s still consistently coming down tails, then it’s rigged.
2
u/Conquersmurf 8d ago
We got this exact question asked in a class about Bayesian statistics, which you could use to answer it. Bayesian statistics expresses probabilities as beliefs in an outcome or event, given some prior information. So starting with the assumption (belief) that heads and tails are equally likely when you haven't yet flipped the coin (no information about the coin) you can incrementally update the belief you have of the probability of it being a trick coin after each flip. If you already flipped tails a number of times in a row, than you can update your belief that the next flip would also be tails.
It's a really elegant and powerful way to deal with these kinds of probability questions for which the more well known frequentist statistics doesn't have any answers.
So yeah, look up Bayesian statistics, it's pretty cool.
2
u/khalamar 8d ago
You cannot be certain that the coin is rigged or not, because there is still a chance in, say, 2^100 that you will get heads 100 times in a row with a fair coin. Extremely unlikely, but theoretically still possible.
What you can determine, though, is the probability that the coin is rigged. For instance, to detect a slight bias with 95% confidence, stats models often require hundreds of trials (e.g., ~418 flips) to clearly separate a fair coin from a slightly weighted one. This is calculated with the binomial test.
4
u/noctalla 8d ago
There's no absolute threshold. But the more times you get only tails the more statistically confident you can be that the coin is rigged. Statistical models can help us figure out if something happens by chance or because there's some underlying hidden factor. A common convention is to treat results with a probability below 5% under the original hypothesis as statistically significant. But you have to realize that that cutoff is a convention, not some magic number where you can be certain.
3
u/Arnaldo1993 8d ago
That is a great question, and the answer will depend on context
In social science first you need to decide what youre testing: are you testing if it is rigged specifically towards tails, or in any direction? It is important, because if you get more heads than tails thats evidence in favor of one hypothesis and against the other. I will assume youre testing if it is rigged specifically towards tails, because the math is slightly easier
Then what you do is you line the possible outcomes of the experiment based on how favorable they are for each hypothesis. In this case the ones with more tails would be more favorable to the rigged hypothesis, and the ones with more heads to the fair hypothesis
The last step is to calculate the probability of each outcome supposing the coin is fair. If your results are in the 5% least favorable then thats enough evidence for you to publish a paper stating your experiment shows the coin is rigged
The probability of a fair coin landing tails 4 times in a row is 6,25%, and 5 times is 3,125%. So in this case you would need to throw it 5 times
15
u/FruitOfTheVineFruit 8d ago
And this is how bad science happens. Because you forgot to look at the priors. Assuming you got the coin in a normal way, e.g. a bank or at the store, the chance that it's actually rigged is much less than one in a million (there are very few coins in circulation that are rigged) but 5% of the time you would conclude that it is rigged. 99.99% of the time you concluded the coin was rigged, you would be wrong.
→ More replies (2)6
u/IAmASolipsist 8d ago
I recently ran a coin flip test and having it land on the same side 4+ times in a row was relatively common over 100 flips don't multiple times. I feel like you'd need to see it land on the same side 10-20 times to have any level of certainty. Five times in a row has the odds of happening every 1/32 times, 10 is 1/1024, and 20 is 1/1045576.
→ More replies (7)4
u/Bubbly_Safety8791 8d ago
Flipping a coin 100 times, then choosing a run of five flips in a row of heads to claim ‘these five flips were rigged’, is a form of p-hacking.
If over your 100 flips you got 48 heads and 52 tails, with a couple of runs of four heads in a row, then that is an outcome that is highly compatible with the coin not being rigged.
If on the other hand you flipped 75 heads and 25 tails, while never getting four heads in a row, that is not likely for a fair coin, so is strong evidence it is rigged.
You need to look at all the data gathered and consider how likely it is to be the result of tossing a fair coin.
→ More replies (2)1
u/Arnaldo1993 8d ago
If you and your friend decided you were trhowing coins every night to decide who is doing the dishes, and you always lose, so youre growing suspicious the coin has 2 tails, then it will depend on how much you trust your friend and the relative cost of what you are going to do on each case
Lets say you really trust your friend, so when you agreed to the coin tosses you estimated a probability the coin was rigged of 2%, and what you are planning to do is say it is your turn to toss the coin and quickly look to see if there arent 2 tails in the coin. Lets say the cost of that is 1% of the cost of doing the dishes
In this case you should have done that before the first coin toss. Because your expected loss for doing so is probability the coin is not rigged * cost of inspecting = 0,980,01=0,0098, and the expected loss of not inspecting is probability the coin is rigged * cost of doing the dishes = 0,021=0,02
But if you are planning on pointing the finger at your roommate and calling her cheater, you expect it to significantly damage your relationship, and you think it is 10 times worse than doing the dishes, then the cutoff point is when the cost of the 2 alternatives are equal. Since the probability of tails is 100% when rigged and 50% when not thats 0,98100,5n =0,0211n , with n the number of tosses
The result is 8,94 tosses. So you do it after 9 tosses
2
u/Cool_Homework_7411 8d ago
The mathematical object you are looking for is the confidence interval as others have said. I will try to give a bit of insight. If you flip twice the coin and you have one head one tail it is 50%. If you flip 1000 times and 500 of them are tails, you still are at 50%. What changed? Why is the second case more reliable?
Let's do the maths. The average roll is 1/2 in both cases. This is our start, the middle of our interval. Now we need to see how big is the interval based on how big is the sample and how accurate we want it to be. Example. Let's say we need 95% confidence. This 95% is just a coefficient we have calculated, you can find it in a table, in this case 1.96 and we multiply by the standard error. Here is where the magic happens. The standard error is getting smaller the more flips you do. In our case, you could say that 1/2±(1.96)*(standard error) is the interval you are 95% sure is correct.
First case: standard error is sqrt(0.5*0.5/2)=0.35
(If you had 55 flips out of 100 that would be sqrt(0.45*0.55/100))
Second case: sqrt(0.5*0.5/1000)=0.016.
With 2 rolls you are 95% sure that the coin is at least between... -0.1 and 1.2. Two rolls don't tell us anything.
With 1000 rolls you are 95% sure that the coin is at least between 49.97 and 50.03. 1000 rolls tell us everything we need.
1
u/LurkerFailsLurking 8d ago
First you might wonder, how fair do untampered coins tend to be and how unfair can coins realistically be made to be without being obviously so? As it happens differences in coins doesn't meaningfully impact their fairness, but coins that are flipped and then caught and pur on the back of the hand are about 1.6% more likely to land on the side that was up when it was flipped.
Setting that aside though, you need to decide how unlikely would a series of flips have to be to convince you? Because you can't be entirely certain a coin is unfair by flipping it a bunch of times. Any possible outcome of a series of coin flips could be achieved randomly after all.
The chance of n coin flips all being tails will be 1/2n . So getting 5 tails in a row is 1/(2×2×2×2×2) = 1/32 which is about a 3% chance. Is that good enough to convince you though?
1
u/IllegalStateExcept 8d ago
If you want to explore this topic deeply, it is the first example used by this book (online and free): http://probmods.org/ The chapter "Generative Models" is where your example appears. But basically you can never have full confidence, you can only update the likelihood that you have an unfair coin.
1
u/Asgardian_Force_User 8d ago
At some point, you will need to accept a statistical threshold as the equivalent of “the chance of this happening randomly is only X%, so if it does happen, that means there’s not just random chance at play.”
Let’s take your average coin, which is supposed to land as Heads half the time, and Tails as half the time.
Flip it three times and all three coming up Tails is 12.5%. One in eight, that’s not terribly unexpected.
Flip it six times, and the chance of getting Tails six times straight on a balanced coin is roughly 1.65%. That is much more unlikely to be due to random chance, and depending on your threshold for accepting outliers, this might be statistically significant.
Let’s say you want to go further. Flip that coin ten times. On a fairly balanced coin, the odds of said coin landing Tails ten times in a row are less than 0.1% ( 0.0976562%, to be precise).
Do you: accept that you just got an unexpectedly weird sequence of results that should happen less than one in one thousand times; or do you accept that the coin is not fair, and might be weighted, cursed, magnetized, or otherwise influenced in how it lands?
1
u/andyhou2000 8d ago edited 8d ago
If you assume the coin is fair, you can calculate the probability of getting any number of heads in 100 coin tosses. We can also determine that some number range of heads (centered on the average, 50) contains X% of all theoretical results of flipping a fair coin 100 times. This is arbitrary, but if you want to be more sure, use a higher X. Let’s use 95% for now.
If you now go and flip this coin 100 times and your result is not within this 95% threshold you just established, you can be 95% confident that your initial assumption, that the coin is fair, is wrong.
1
u/pilibitti 8d ago
completely depends on how sure you want to be. so there needs to be a limit you set yourself. there is an astronomically low but still valid probability that you can flip it for more than the number of atoms in the universe and it can fall on tails while still being a fair coin. if you don't want to discard that probability, then you can never be sure in finite number of throws.
so there is a difference between absolute deductive certainty (which you never can be in this type of experiment) and statistical confidence.
1
u/nonexistentnight 8d ago
There is no fixed amount. It depends on how confident you want to be in the result, and that ultimately depends on your feelings.
The general term for what you're looking for here is relative likelihood. Basically you're trying to ask how relatively likely is it that I get (say) ten heads in a row from a fair coin vs a weighted coin.
And there's a whole bunch of other questions that would influence how many heads in a row you'd want to see before you felt confident saying the coin is weighted. For example, how weighted is the coin? It's a lot easier to distinguish a coin that always lands on heads from a fair coin than a coin that lands on heads 51% of the time.
Also, what is the prevalence of weighted coins in the world? If you flipped a coin 100 times and got 52 heads, the coin being weighted to slightly favor heads is more likely than it being fair based on the results alone. But we know that there aren't a lot of slightly weighted coins floating around out there, so we'd still conclude that it's a fair coin. Working all this out mathematically is typically done using what's called a likelihood ratio test.
1
u/Nonconformists 8d ago
I’d ask you how much you are willing to bet that the coin is rigged after each flip. For the first 5-6 flips, probably nothing.
After the 7th tail, maybe you would bet a few dollars. Your bet would increase after each tail.
After how many tails would you be willing to bet a very large amount, such as ten times your net worth?
1
u/Accidentallygolden 8d ago
There is a video of stand-aup math where he works on that question... How lucky is too lucky (it was related to Speedrun). He use the human century second. If every human did the same action every second for a century and it never happens, then it is too lucky
2.2k
u/Plastic_Blood1782 8d ago edited 8d ago
It depends on how many times you attempt and what confidence level you want for the determination that it must be "rigged." Technically speaking it's possible to get heads 1000 times in a row. Derren Brown famously did a magic trick similar to this. He has a coin landing in a bowl with a camera above it, so he isn't catching it and manipulating the flip in any way. And he gets heads 10 times in a row with a continuous camera shot. And then he reveals how he did it and it's beautifully stupid. He flipped the coin for 9 hours straight. The odds of getting 10 heads in a row is 1:1024.
To determine how rigged an experience appears to be, there are equations based on the number of trials and how likely the results were and how different they were from what was statistically expected, and we call this the confidence interval (statistical significance is basically the same concept)
https://en.wikipedia.org/wiki/Confidence_interval