Post subject: Probability problem 50/50
nesrocks
He/Him
Player (247)
Joined: 5/1/2004
Posts: 4096
Location: Rio, Brazil
There has been a load of discussion about this subject here at work. I'm wondering if it'll spark some discussion here too. We all like discussion, right? Here's the problem: Take a coin toss with a perfectly equal possibility for head or tails (ideal world). Is there, or is there not a way to analyze the previous coin tosses to get a better chance at guessing what the next one will be? I believe with all my molecules that no matter what you analyze, in a perfectly random toss, it will always be unpredictable with a 50% chance for heads or 50% for tails. There are some people who agree with me and some other people who think that over time the amount of heads and tails will tend to be equal, so if that if a large sequence of the same side appears, you'll have a bigger chance of winning if you bet on the other side of the coin for that toss. I find that completely nuts and I'm wondering if there are more crazy people in here :)
Player (121)
Joined: 2/11/2007
Posts: 1522
I make a comic with no image files and you should read it. While there is a lower class, I am in it, and while there is a criminal element I am of it, and while there is a soul in prison, I am not free. -Eugene Debs
Tub
Joined: 6/25/2005
Posts: 1377
Everyone with a half-decent knowledge of stochastic will agree with you. What you're experiencing is a common misunderstanding of the Law of Large Numbers.
m00
Joined: 10/20/2006
Posts: 1248
I guess this misbelief often comes from a misunderstanding what randomness means. The thinking process can work like this: The chance is 50/50, so most of the times the count of heads and tails will be even. Therefore, if we throw a coin for 20 times, there should almost always be 10 heads and 10 coins. So, if there are already 5 heads on the first 7 throws, the next ones have to be tails because it will make it even and most of the time it gets even. That thinking process falsly assumes random distribution (of an equal amount of outcomes) instead of randomness. In reality, the only case where it's sure that results will be even is if you throw a coin for infinite times. Wait, that's also not realistic. >_> And if anything, previous results are more likely to repeat under realistic conditions. The coin is almost definitely slightly heavier on one side.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
I think this is a better explanation: The gambler's fallacy thinks about the problem backwards: It thinks that as you throw more and more heads, the probability of getting tails in the next throw increases. However, this is thinking about it backwards. If you set up to make, let's say 10 coin tosses, before you start the probability of getting 10 heads is 1 in 1024. Now if you toss the coin and get heads, the probability of getting 9 additional heads is 1 in 512. And so on. When you have tossed 9 times and got all heads, the last toss will have a 50% of probability of also being head. Any of the individual tosses you made had a 50% chance, but the total of 10 tosses had that changing probability described above.
Mitjitsu
He/Him
Banned User
Joined: 4/24/2006
Posts: 2997
If you were to toss a coin a million times you'd expect an near exact 50/50 ratio or at least 49.99999/50.000001. The most times I've ever made a coin land on the same side in a row is 14, but it doesn't matter if I did 20 in a row because each flip is exactly 50/50. In essence short term = high variance; Long term = Low Variance However, there is a game where you put a ball under one of 3 cups allow someone to choose, then remove one which doesn't have the ball under it then ask them if they want to switch. I don't know the exact maths behind it but mathamatically it's always best switch because it doubles your chances for some reason.
Player (121)
Joined: 2/11/2007
Posts: 1522
It's basically because two out of three times you'll pick a wrong cup at first, and then when the other known wrong cup is eliminated you will be switching to the correct cup. One out of three times you will pick the correct one to begin with, and switching will make you lose. (If that makes sense.) More wikipedia!!! http://en.wikipedia.org/wiki/Monty_Hall_problem
I make a comic with no image files and you should read it. While there is a lower class, I am in it, and while there is a criminal element I am of it, and while there is a soul in prison, I am not free. -Eugene Debs
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3576)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
[quote="Mitjitsu" However, there is a game where you put a ball under one of 3 cups allow someone to choose, then remove one which doesn't have the ball under it then ask them if they want to switch. I don't know the exact maths behind it but mathamatically it's always best switch because it doubles your chances for some reason.[/quote] That was on an episode of Numb3rs!!!
It's hard to look this good. My TAS projects
Skilled player (1652)
Joined: 11/15/2004
Posts: 2202
Location: Killjoy
Mitjitsu wrote:
However, there is a game where you put a ball under one of 3 cups allow someone to choose, then remove one which doesn't have the ball under it then ask them if they want to switch. I don't know the exact maths behind it but mathamatically it's always best switch because it doubles your chances for some reason.
You are correct. This is in the movie 21, as well. http://en.wikipedia.org/wiki/Monty_Hall_problem
Sage advice from a friend of Jim: So put your tinfoil hat back in the closet, open your eyes to the truth, and realize that the government is in fact causing austismal cancer with it's 9/11 fluoride vaccinations of your water supply.
Skilled player (1410)
Joined: 5/31/2004
Posts: 1821
alden wrote:
It's basically because two out of three times you'll pick a wrong cup at first, and then when the other known wrong cup is eliminated you will be switching to the correct cup. One out of three times you will pick the correct one to begin with, and switching will make you lose. (If that makes sense.) More wikipedia!!! http://en.wikipedia.org/wiki/Monty_Hall_problem
The way I think so see right away that one should switch is if it's applied to a large number of choices. Put a single ball under one of 100 cups. Let someone pick, then remove 98 cups without the ball. Once again, the option to switch. Now the choice doesn't see so hard... same principle.
Mitjitsu
He/Him
Banned User
Joined: 4/24/2006
Posts: 2997
DarkKobold wrote:
You are correct. This is in the movie 21, as well.
I don't remember that, all I can recall is all the myths it told.
Joined: 7/2/2007
Posts: 3960
Now, it is true that if you flip a real coin 100 times and 90 times it's heads, you can begin to draw some conclusions about that coin (or about the person flipping the coin) and suspect that it's not perfectly balanced. :) But a truly random event, by definition, does not depend on previous random events. Otherwise it wouldn't be random. If part of your problem statement is "this coin has a 50% chance of landing heads every time you flip it", then the answer to any given "what happens when I flip it after doing X" is "you'll have a 50% chance of getting heads."
Pyrel - an open-source rewrite of the Angband roguelike game in Python.
Active player (315)
Joined: 2/28/2006
Posts: 2275
Location: Milky Way -> Earth -> Brazil
All Zelda games should have Link and Zelda. But Link's Awakening does not have Zelda. Where's is the game without Link?
"Genuine self-esteem, however, consists not of causeless feelings, but of certain knowledge about yourself. It rests on the conviction that you — by your choices, effort and actions — have made yourself into the kind of person able to deal with reality. It is the conviction — based on the evidence of your own volitional functioning — that you are fundamentally able to succeed in life and, therefore, are deserving of that success." - Onkar Ghate
Bisqwit wrote:
Drama, too long, didn't read, lol.
Joined: 11/2/2007
Posts: 103
pirate_sephiroth wrote:
All Zelda games should have Link and Zelda. But Link's Awakening does not have Zelda. Where's is the game without Link?
wand of gamelon kinda
Editor, Player (54)
Joined: 12/25/2004
Posts: 634
Location: Aguascalientes, Mexico
The topic reminds me of this video: (around 2:30) http://www.thedailyshow.com/watch/thu-april-30-2009/large-hadron-collider
I'm the best in the Universe! Remember that!
Active player (356)
Joined: 1/16/2008
Posts: 358
Location: The Netherlands
I didn't take the time to read other people's responses and I'm sure it's been brought up already.... but a perfect coin (for this purpose) has independent outcomes for each toss, meaning P(X) = P(X| previous result) or in human words: the chance of result X has same probability as the chance of result X given the previous result or: knowing the previous result does not change the probability of finding result X so.... the definition of statistical independence provides your answer
TASes: [URL=http://tasvideos.org/Movies-298up-Obs.html]Mr. Nutz (SNES), Young Merlin 100% (SNES), Animaniacs 100% (SNES)[/URL]
nesrocks
He/Him
Player (247)
Joined: 5/1/2004
Posts: 4096
Location: Rio, Brazil
Thanks guys. So should I be worried that the designer (me) disagrees with 2 programmers (my co-workers) on this subject? He even made a program that analyzed the last 3 tosses and placed a guess that the next one would be the one that came out the least, and the program got it right 75% of the time. I told him that his program was bugged and I wrote my own, doing the same thing and the chances remained closed to 50%.
Active player (356)
Joined: 1/16/2008
Posts: 358
Location: The Netherlands
It's very possible that his (and/or your) Pseudo Random Number Generator is not 'random enough' allowing indeed some pre-knowledge... OR he simply didn't test enough times.... however I (with many in here) will guarantee you with a fair RNG (which is impossible in computers :D) you will not find a higher than 50% chance to guess correctly
TASes: [URL=http://tasvideos.org/Movies-298up-Obs.html]Mr. Nutz (SNES), Young Merlin 100% (SNES), Animaniacs 100% (SNES)[/URL]
Joined: 10/20/2006
Posts: 1248
If the program is written in C/C++, I seem to recall that its rand function is just a repeated long sequence of numbers, so they aren't really random. I have written a program that graphically illustrates this years ago iirc. Nevertheless, it shouldn't be possible to predict the outcome of a coin toss the way he did. Maybe he's playing a trick on you. Or his understanding of randomness is that off that he wrote a piece of code that's more akin to his slightly twisted understandings of it than to the definition of randomness. I suspect that his code simulates random distribution or that he uses a strange way of generating random numbers.
Player (199)
Joined: 12/3/2006
Posts: 151
Here is a graph I made of the performance of the estimator you mentioned, based on the previous 3 coin tosses: [URL=http://img40.imageshack.us/img40/193/cointosses.png][/URL] As you can see, it approaches 0.5 as the number of estimations grows. It shows similar results for window sizes larger than 3.
Active player (315)
Joined: 2/28/2006
Posts: 2275
Location: Milky Way -> Earth -> Brazil
I think Foda's friends think that if Capoeira Legend 1 sucked, the second one must be good.
"Genuine self-esteem, however, consists not of causeless feelings, but of certain knowledge about yourself. It rests on the conviction that you — by your choices, effort and actions — have made yourself into the kind of person able to deal with reality. It is the conviction — based on the evidence of your own volitional functioning — that you are fundamentally able to succeed in life and, therefore, are deserving of that success." - Onkar Ghate
Bisqwit wrote:
Drama, too long, didn't read, lol.
nesrocks
He/Him
Player (247)
Joined: 5/1/2004
Posts: 4096
Location: Rio, Brazil
Gunty: nice graph! Pirate_Sephiroth: lol :) We're releasing a patch that should make the first one a bit better. Btw, one of the programmers said that what he meant was what is described in gunty's graph (he couldn't put it correctly into words), but the other programmer still thinks he can somehow analise previous results to predict the next. But I don't care much about his opinion so I'm feeling better.
gia
Player (109)
Joined: 5/3/2006
Posts: 223
he probably knows seeding with time won't exactly yield truly random values as all pseudo rngs have a period (a period is a set of numbers, when the period ends the series repeat), some are long periods some are short and they don't even have to include all possibilities within your interval (or one of each). (Going from memory tho, but it's something they teach at college so there has to be a lot about it online). at least for certain games you rather want to build your own rng so that all possibilites occur during one period, instead of leaving room for a huge streak of the same effect happening ingame. ie. in true randomness, 400 tails in a row is possible, and using a pseudo rng probably too, but for a game that tries to favor strategy to luck (yet contain some of it) this is too much. So you make a rng stack of lets say 100 numbers where you make sure there's a 50/50 distribution of head and tails and use that and refill it when it's necessary, but then 400 tails in a row is not possible anymore. Your rng becomes slightly more predictable too (although in realtime probably not).
Joined: 8/3/2004
Posts: 380
Location: Finland
Get your random numbers from random.org, which derives it's results from athmospheric noise (thus being better than PRNGs). If you wish you could even run programs against that source to check. EDIT: Or HotBits, randomness taken from radioactive decay. Of course, using the patterns in inexpensive CCDs might also be an option, see LavaRnd.
"Kids! Bringing about Armageddon can be dangerous. Do not attempt it in your home." ( Pratchett & Gaiman: Good Omens )
Joined: 8/27/2006
Posts: 883
The problem is really a point of view problem. What's the probability of getting 15 times head ? It's the same as getting 14 times head and 1 time tail... It seems more unlikely because 15 times is a high number, but it's the same probability with lottery. You have the same chance of the 14 19 25 36 40 45 than getting 1 2 3 4 5 6.