An Example: Coin-tossing
The gambler's fallacy can be illustrated by considering the repeated toss of a fair coin. With a fair coin, the outcomes in different tosses are statistically independent and the probability of getting heads on a single toss is exactly 1⁄2 (one in two). It follows that the probability of getting two heads in two tosses is 1⁄4 (one in four) and the probability of getting three heads in three tosses is 1⁄8 (one in eight). In general, if we let Ai be the event that toss i of a fair coin comes up heads, then we have,
Now suppose that we have just tossed four heads in a row, so that if the next coin toss were also to come up heads, it would complete a run of five successive heads. Since the probability of a run of five successive heads is only 1⁄32 (one in thirty-two), a believer in the gambler's fallacy might believe that this next flip is less likely to be heads than to be tails. However, this is not correct, and is a manifestation of the gambler's fallacy; the event of 5 heads in a row and the event of "first 4 heads, then a tails" are equally likely, each having probability 1⁄32. Given the first four rolls turn up heads, the probability that the next toss is a head is in fact,
While a run of five heads is only 1⁄32 = 0.03125, it is only that before the coin is first tossed. After the first four tosses the results are no longer unknown, so their probabilities are 1. Reasoning that it is more likely that the next toss will be a tail than a head due to the past tosses, that a run of luck in the past somehow influences the odds in the future, is the fallacy.
Read more about this topic: Gambler's Fallacy