377 points · by fbartos · 3y ago · 265 comments
1. Flip the coin twice
2. If you get the same result both times, goto 1
3. Now that you have different results for your pair of flips, use the first element of the pair of flips as your result.
https://en.wikipedia.org/wiki/Fair_coin#Fair_results_from_a_...
https://www.techiedelight.com/generate-fair-results-biased-c...
The coin is biased to come up TAILS 80% of the time, but using Von Neumann's method in the program I got HEADS 50.035%, TAILS 49.965%.
Probability of two heads: p*p
Probability of two tails: (1-p)*(1-p)
Probability of head followed by tails: p*(1-p)
Probability of tails followed by heads: (1-p)*p
It's not difficult to notice that if you remove the first two, the last two form a 50/50 distribution
I recall conversations on Usenet decades ago about the Monty Hall problem[1] in which people gave elementary proofs that probabilities don't change by opening a door. Even from mathematicians and statisticians. People were very insistent that the analytical solution was simple and obvious and that switching doors didn't change anything.
The only thing that changed some people's minds was a program that simulated the Monty Hall problem. This was needed to get people to reconsider their proof when the claim was highly counterintuitive.
A colleague told him about the Two Trains Problem (https://mathworld.wolfram.com/TwoTrainsPuzzle.html), and Von Neumann replied with the correct answer. When his colleague said, "Ah! You figured out he trick!", Von Neumann replied, "What trick? I just summed up the distances in my head!"
Theory is useful but so is experiment.
p(th) = p(t) p(h)
p(ht) = p(h) p(t)
Hence p(th) = p(ht) regardless of coin imbalance as long as both events actually will happen. QED.
Look I found the mathematician
Is this a wrong way to get a right answer?
Very nice way to illustrate why throwing out the duplicate sequences gets back to a 50/50 distribution.
Maybe it's just a meat space thing, but even if the math gives us the answer it still only feels "final" or "true" to me when we've actually tested something out.
So the probability is the same. Whereas p doesn't equal (1-p) unless p=0.5
Why not?
The fact that you can show something with a mathematical equation doesn’t make other demonstrations any less cool.
Because according to the study the person can choose the bias by choosing which side start up.
So if the person wants tails based on what you've said, they should always
1. Do the first throw starting tails up.
2. If the first one is tails, then they now want to start second one heads up.
3. If the first one is heads, they will want to try and get heads again to dismiss the results. So they will do heads up.
So assuming for example that they have an ability to control bias 75% vs 25%.
Then there would be 75% chance of getting first as tails. After that 75% chance of getting heads.
So they will have 56.25% chance of getting it right the first 2 rounds.
The worst case for them would be if they get heads first (25% chance), and then are unable to get heads again. Which would be another 25% chance so 6.25% odds to lose with the first round.
So 56.25% chance of winning the first round of 2, or 6.25% losing and 37.5% of having to try again.
And I think the odds would converge at somewhere around 90% to 10%. I didn't do full calculations here, but overall it seems this strategy would increase the bias even more.
Alice writes on a piece of paper whether to use the result from the first or the second coin, Bob flips the coins however he likes, then once there are two different sides of the coins up, Alice turns over the paper and reveals to Bob which coin contains the result.
Though I guess that unnecessarily complicates the procedure – maybe Alice can just write "heads" or "tails" on a note and then Bob flips without having seen the note. It essentially replaces the second coin with Alice's mind which hopefully doesn't suffer from the same known bias.
° Shake the cup vigorously and dump coins on the table
° If coins match, go back to step one
° If coins are opposed take the result of the southernmost coin
I was still lucky with the numbers as for example with 80% vs 20% it would've been 4x4=16 and so 1 to 16 comes to 100 / 17.
Under the same IID assumption you can take N flips that returned M heads and map them to the N choose M possible ways that could have happened. The result will (under IID assumption, even in the presence of bias) be a uniform number on the range [0..N choose M). The ctz(N choose M) trailing bits can be used directly (as they will be uniform) but the rest would have to be converted to binary via something like an arithmetic coder or rejection sampling.
The result is muuch more efficient.
Less directly, VN debiasers can also be stacked. Each debiaser outputs three streams: the normal one, one that says if the normal one output anything, and one that says if it got HH or TT. Then run VN debiasers on those. Though it takes a fairly large tree to extract most of the entropy.
To get a fair result from a biased dN: Roll it N times. If you don't get all N distinct results, restart. If you do, then the first of those is your final result.
In both cases it has to do with shaping the combination of multiple rolls using some knowledge of outcome-symmetries and overlaps.
____
[0] In this particular case, that's something like: Roll the die twice to get rolls A and B; map those a number X in the range range [1,36] using x=(((A-1)*6)+B); if X<=33 then return (x%11)+1 which will be equally likely in the range [1,11]; if X>33 then start over.
If a coin is more likely to land on the side it starts on, then the bias can change between flips. To fix this, we just need to make sure the coin starts the same side up before every flip.
I find it easier to understand if you say “instead of using the level/value as the source of randomness, use the transition from one level/state to the other as the bit of entropy.” (edge-based instead of level-based) I.E. instead of head is 0 and tails is 1, head to tail is 0 and tails to head is 1, and the other transitions are disregarded.
You're right that the first coin is more likely to end up heads. But so is the second coin, and if both occur, that would invalidate the pair of tosses. Now, imagine you guessed tails despite the coin starting on heads. If the first toss lands tails, the second coin is still more likely to land heads, which keeps the pair valid.
In other words, whatever you gain by guessing the side that's up on the first coin, you lose on account of the second coin having that same higher probability of invalidating the pair.
----
Using extreme numbers, in case that makes it more clear: imagine a coin that has a 99 % probability of ending up with the same side we start with, and – for simplicity of exposition – we always start with heads facing up before the toss.
If you guess heads, and the first coin lands heads, then there is a 1 % chance that you win, namely that when the second coin lands tails.
If you guess tails, and the first coin lands tails, then there is a 99 % chance that you win, namely that when the second coin lands heads.
The two outcomes of the first coin (99 % and 1 % respectively) perfectly balance out the two valid outcomes of the second coin.
https://www.newton.ac.uk/files/seminar/20100623134014301-152...
[edit]
If you always start with the same side of the coin face-up, then the tosses will be independent of each other, but if you e.g. always flip it once or always keep it the same before the next toss, then they are not.
It would be important to start the flip on the same side, but that’s doesn’t make the second flip dependent on the first
(You might say "of course it is!", but if that's your approach to the problem, you should be aware that biased coins don't exist...)
Otherwise it never halts.
1. starting from heads
2. flip heads
3. flip heads
4. starting from heads
5. flip heads
6. flip tails
take 5 = heads?
heads should still be more likely to occur than tails under this scenario, although, Zeno-like, with decreasing likelihood approaching zero over time?
on edit: of course Von Neumann's process has more restrictions, leading closer to fairness.
Well, yes. The wiki description basically states that you get to throw away results of coin tosses in some particular cases.
In that sense, it's not really any different from just making up the results of the coin tosses entirely. There's 10000 different ways to make your data garbage.
If you flip a fair coin and catch it in hand, what's the probability it lands on the same side it started?
Today, we are finally ready to share the results. Thanks to my friends, collaborators, and even strangers from the internet, we collected flippin 350,757 coin flips. We ran several "Coin Tossing Marathons" (e.g., https://youtu.be/3xNg51mv-fk?si=o2E3hKa-ReXodOmc) and spent countless hours flipping coins.
In short, we found overwhelming evidence for a "same-side" bias predicted by Diaconis, Holmes, and Montgomery 2007: If you start heads-up, the coin is more likely to land heads-up and vice versa. How large is the bias? In our sample, the mean estimate is 50.8%, CI [50.6%, 50.9%].
We also found considerable variance in the same-side bias between our 48 tossers. The bias varied with a standard deviation of 1.6%, CI [1.2%, 2.0%], in our sample. The variation could be explained by a different degree of "wobbliness" between our tossers.
If you bet a dollar on the outcome of a coin toss 1000 times, knowing the starting position of the coin toss would earn you 19$ on average. This is more than the casino advantage for 6-deck blackjack against an optimal player (5$) but less than that for single-zero roulette (27$).
The manuscript is at arXiv: https://arxiv.org/abs/2310.04153 And the open data, code, and video recordings at OSF: https://osf.io/pxu6r/.
Diaconis, P., Holmes, S., & Montgomery, R. (2007). Dynamical bias in the coin toss. SIAM Review, 49(2), 211-235. https://doi.org/10.1137/S0036144504446436
This sounds like the plot of a western where a man travels from town to town and gleans a little cash from the local waterhole a little every time. I did the math though, in order to get just the $19, assuming you played a modest 20 times a day, it'd take 10 weeks (not including weekends), and by that point people would definitely figure out your trick. In order to make any profit quickly, you'd have to distribute the strategy, after which your secret would explicitly be out there. Even assuming perfectly honest colleagues, having that many parallel people using the same strategy in the open means that before you turn any real profit, people will find out. It's a fun idea to fantasize about though.
Anyway, cheers on the paper! Pretty cool result that you guys put the effort in in implementing.
On the other hand, /if/ you do, you'll have to play for 6000 more flips until you can be fairly certain that you're even again.
What's worse is if, after having lost $50, you're down to your last $50, there's almost a 1/5 chance you'll blow all of it trying to recover if you wager $1 each time.
If you grow wise and start Kelly betting you'll get back to your starting $100 on average in 5000 flips, though. If you can take out a loan of $500 first, you can Kelly bet your way to even much faster, in an expected 700 flips. Whether this is worth the interest on the loan depends on how quickly you can find challengers to bet with.
If they can print money, why not infinitely as you will always pay it back anyway, so you don't have to worry about introducing inflation. There will always be a point when you can just burn the money that you temporarily introduced.
What if one play session consisted of 10 coin tosses (each an independent $1 bet)? I guess 20 games like this per day would still be doable. Would that mean $19 per week?
Next we up the bet to $10 per throw.
These are fairly gentle coin tosses; barely going a foot into the air!
When I think of a coin toss, I think high and spinning fast (like the ones before sports games, where the coin goes into the air and lands on the ground, usually rolls a short way, and is collected on whatever side it landed). I would guess the 50.8% same-side bias would be much closer to 50% if the coins were tossed this way in the experiment.
This reminds me of the casino I was at with a fair roulette. Betting Black/Red and getting a zero meant all bets stayed for the next spin ;)
My winning strategy was to always bet the opposite color of a friend of mine.
"In each sequence, people randomly (or according to an algorithm) selected a starting position (heads-up or tails-up) of the first coin flip, flipped the coin, caught it in their hand, recorded the landing position of the coin"
Presumably if you instead allow the coin to land and bounce on a hard surface, the bias would disappear?
> The standard model of coin flipping was extended by Persi Diaconis [12] who proposed that when people flip a ordinary coin, they introduce a small degree of ‘precession’ or wobble—a change in the direction of the axis of rotation throughout the coin’s trajectory. According to the Diaconis model, precession causes the coin to spend more time in the air with the initial side facing up. Consequently, the coin has a higher chance of landing on the same side as it started (i.e., ‘same-side bias’).
[12] Diaconis P, Holmes S, Montgomery R. Dynamical bias in the coin toss. SIAM Review 2007; 49(2): 211–235.
You could probably control for it by making people alternate which side was face up before the flip.
That's my intuition anyway.
> Two-up is a traditional Australian gambling game, involving a designated "spinner" throwing two coins, usually Australian pennies, into the air. Players bet on whether the coins will both fall with heads (obverse) up, both with tails (reverse) up, or with a head and one a tail (known as "Ewan"). The game is traditionally played in pubs and clubs throughout Australia on Anzac Day, in part to mark a shared experience with diggers (soldiers).
I have seen that figure (roughly 0.5% edge) but that has to depend on how deep the shoe is dealt? I remember playing only the last hands with dealers playing down to between 1.0 and 0.5 decks left. That meant you could play hands where you knew almost all remaining cards were suited. I guess the average edge assumes constant bet and doesn't include betting strategies based on counting at all? (And those strategies obviously wouldn't work in any real casino because it's "frowned upon").
Trying not to be disrespectful but I don't believe you intuited a 50.8 % bias. So nothing weird going on at all.
> Trying not to be disrespectful
No worries, it is just me using high context communication style, where I assume that you know that I know this and I just share what was my experience in childhood (it was not like a single thought).
Pretty simple. In fact I just picked up a quarter and practiced (20+ years out of practice) and have some observations: 1) harder than when I was a kid, my fingers are lot bigger + stronger so it's not as precise from the start. A bigger and heavier coin would help. 2) the timing factor is bigger than I recalled.. essentially you can watch the coin flipping and get a subconscious/automatic/predictable sort of count/feedback to it. You can bring your hand up to the coin in the air at a precise moment pretty easily and "tell" (>90% accuracy today of the flips I just did that I considered successful before looking at the result) if the flip was predictable. Hand eye coordination, spatial awareness is very correlated to this skill, I suppose. 3) it really is the same side that comes up.. again I think because of the automatic watching/count/completion of full rotations, i.e. catching the coin at the end of a full rotation instead of a partial.
Came in handy occasionally.. if I knew I was going to be wrong (other person usually waits to call mid-flip) I could catch the coin a little lower to give myself a chance, or punk them by not putting it on the back of my hand as is more standard (they might demand a re-flip.. kind of like if you are playing rock paper scissors and one person goes on 3 and the other on 4).
On average, each flipper in that experiment flipped a coin over 7000 times, after that amount many people will have learned to flip in a comfortable way with less variance between physical action and force they use. I'd imagine that in that case the coin would more likely land with the same orientation.
I don't think this would be true if someone flipped without practice.
(I know that there are techniques for adding the wobble to the toss, but I didn't study them and I have no clue how to do them. I think it is safe to say you don't discover them intuitevelly.)
The original paper says:
The standard model of coin flipping was extended by Persi Diaconis who proposed that when people flip a ordinary coin, they introduce a small degree of precession’ or wobble—a change in the direction of the axis of rotation throughout the coin’s trajectory. According to the Diaconis model, precession causes the coin to spend more time in the air with the initial side facing up. Consequently, the coin has a higher chance of landing on the same side as it started.
Another coin toss experiment[1] site says this:
The basic reason is that, instead of rotating around a horizontal axis as one might imagine, a typical tossed coin is rotating around a tilted axis which is precessing in 3-space, and this entails a certain degree of "memory" of the initial parameters.
The Diaconis paper[2] has the definitive explanation but it's hardly intuitive. I got a feel for why it is, but I can't do an ELI5. The best I'm able to write is this: A human being is likely to introduce some precession in the coin toss. If there is precession, then the angular momentum vector is going to spend more time in the heads direction if starting from heads, and that accounts for the bias.
What I think would work well for an ELI5 is an animation of a coin toss showing the angular momentum vector sweeping out a region during its flight, and showing it spends slightly more time pointing toward heads.
[1] https://www.stat.berkeley.edu/~aldous/Real-World/coin_tosses...
The next step is not at all intuitive to me, namely that even someone trying to do a fair flip causes some precession, and that this isn't decoupled from the rotation.
Edit: The sequence was meant to represent the sequence of head and tail facing up during the rotation. A sequence of [H, T] denotes one full rotation, starting with head. [T, H, T, H] denotes two full rotation, starting with a tail, ends with a head. I didn't mean the result of a flip. So the result of a flip is the final element of the sequence.
Imagine the situation that you flip the coin (starting at H) and you grab it in air immediately. Of course, you will get H as result.
But let's say, the time to stop the coin can be a relatively long time T. Then, I think the probability is some kind of sum. Let's choose \Delta T= 10ms as time discretization:
P(H) = 1 / T * (10ms-0ms) + (30ms-20ms) + (50ms-40ms) + ... = 1/T \sum_{i=0}{floor(T / (2 * \Delta T))} \Delta T
P(T) = 1 / T ((20ms-10ms) + (40ms-30ms) + (60ms-50ms) + ... = 1/T \sum_{i=0}{floor(T / (2 * \Delta T)) - 1} \Delta T
For T -> \infty P(H) and P(T) getting more similar.
But, in practice you wouldn't wait equally distributed in time but more like a Gaussian distributed time period. Hence, each term of the sum would get weighted differently. And the variance and the offset of the Gaussian distribution can shift the probability in favor of H or T. It's really dependent of the concrete parameters. If you grab always after 35ms, then you'll always get T for example.
If the coin is resting on your hand waiting to be flipped, it is currently mid-way through being on side up. This is because the switch between being e.g. heads up to tails up is done when the coin is vertical. If it isn't a clear explanation, try imagining catching the coin and "flattening" it at different angles, while 50% of angles will match either side, at the moment the coin is flipped, it is already half-way through the angles representing the current side.
This means that the correct sequence you describe it not THTHTH but rather THHTTHHTTHH. Taken at even intervals, both sides will appear the same number of times. Taken at odd intervals, at half of the intervals there are more Ts and the other half have more Hs.
I'm mostly serious. I know that's not ideal. But I've never been able to master the art of flipping a coin onto the back of my hand, and even catching it mid-air is hit-or-miss for me. The vast majority of time I or anyone I'm with has flipped a coin it's ended up on the floor.
That's not the usual way of doing it. Usually, you catch it in the palm of your throwing hand, and only then put it on the back of your other hand, flipping it once more in the process.
Based on the paper it looks like 55% chance that it will land on the same side it started is possible. This was the most extreme subject.
The bias is caused by procession so I want my flip to process as much as possible. Maybe I offset my finger as far away from the center of the coin as possible. Also putting as much force into it as possible is probably a good idea.
Finally I have to catch it in a way that the top side is facing up when I reveal it.
Any thoughts?
Nitpick: Precession. This is one case where a minor mispelling really does throw off the meaning of the sentence. At least to me.
Since for every number of flips either the number of odds is the same as the number of evens, or higher by 1, the chances of getting an odd number of flips is higher. There seems to be more at work here, and only testing validates a model!
I thought they would have run a computer simulation instead.
Is there a minimum number of rotations per coin flip to consider it valid?
If looks like the bias was not evenly distributed across people. How did you protect your experiment from skilled bad actors who could influence the data with a few bad/skilled flips? Did strangers on the internet fare any differently than in-person attempts from trusted people?
Also, I wish I had (any) budget to hire proffesional skilled tossers haha.
Diaconis, P., Holmes, S., & Montgomery, R. (2007). Dynamical bias in the coin toss. SIAM Review, 49(2), 211-235. https://doi.org/10.1137/S0036144504446436
@bradrn on this thread kindly extracted the description of the proposed physical model from inside the paper, it is helpful: https://news.ycombinator.com/item?id=37830265
1. 1/2 (i.e fair - von Neumann)
2. p^2
3. p^2/(p^2+(1-p)^2)
4. sqrt(p)
Number 4 really surprised me, I learned it from this paper: http://www.math.chalmers.se/~wastlund/coinFlip.pdf
But you can never generate the biases:
5. 2p
6. 4p(1-p)
Although... if you change the game to allow a quantum coin then 5. and 6. are possible (a paper of mine: https://arxiv.org/abs/1509.06183)
I guess in theory you could "catch" with the correct call by varying the height of the catching platfrom.
However, I was unaware that they already conducted said experiment. I am now left confused as to why they would not mention such in the abstract, and refer only to natural experiments and second order measurements.
I shall aquire the paper and learn why.
(1) https://scholar.google.com/scholar?cluster=16877003867074896...
If you take into account trading costs, you'll probably lose money this way even if the theory is correct.
There are enough actors out there trying to develop complex algorithms to find an edge, and so there wouldn't be any simple edges like this left anywhere as they would be arbitraged away.
If there is a simple pattern, it is noticed and traded until the pattern disappears.
A number of failed finance companies have the story: find a legitimate arbitrage opportunity; take on a billion dollars in investment to exploit the opportunity; make bank; other people discover your arbitrage opportunity and jump on; stop making bank; try riskier and riskier investment opportunities to keep it going; engage in outright fraud to keep it going; go bankrupt and/or to jail.
E.g. something like selling 0dte options sufficiently out of money might seem like a free money hack, but once something unexpected happens you are down to just "who could have possibly foreseen that event to occur, my decision making was solid.".
You also have to take into account transaction fees and broker spread. (If you get a great deal on one of these, check the other very carefully!) I'd be quite surprised if the edge on your system is enough to cover those.
There's also the classic Gelman & Nolan https://www.tandfonline.com/doi/abs/10.1198/000313002605 "You Can Load a Die, But You Can't Bias a Coin", in case you're imagining more complex dynamical behavior.
The kinds of participants you're talking about are not just left off the paper out of lack of interest. It's often the ethically preferable option. They often have a vested interest in remaining unnamed for privacy reasons, and derive no tangible benefit from being listed as authors.
A big author list isn't totally unheard of. The paper where they announced the discovery of the Higgs boson had an author list that spanned 8 densely-packaged pages.
https://www.npr.org/2004/02/24/1697475/the-not-so-random-coi...
They were sitting with their laptops and pressed a button for every result.
I wonder if human error can explain (at least part of) the deviation from 50/50:
* locations of the buttons they pressed on the laptops (they only pressed once per toss before enter, meaning the button represented same-side or other-side)
* remembering what the coin started out as may be harder (or easier, but probably harder) when the result is other-side
* other??
Need to repeat this amount of tosses but with a higher degree of supervision to be sure of the result.
People were pressing one button for heads and another button for heads (which we deemend less error prone and less likely to be subcontiously influenced). The trick was that the next coin flip started the same side-up as the previous landed. Therefore there was no need to record the start (and we randomized the starting position of every 100th flip)
We also did some auditing of the video recordings (trying to decode the outcomes from the videos) and they showed quite consistent degree of bias as the original responses.
Let's consider a spherical cow...
This also happens to be the great divide between frequentists and Bayesians.
What's necessary to guess 50 % on the first toss is simply (a) complete ignorance about the bias, whatever it is, and (b) the hypothesis that the bias is just as likely to be negative as positive (i.e. a symmetric prior.)