This tutorial covers the law of large numbers. The law of large numbers explains that as a random event occurs more and more often, the experimental probability gets closer and closer to the predicted or the theoretical probability. One great example is with flipping coins. I'm going to switch my screen to show a demonstration of this.
So here we have a program that's going to demonstrate flipping coins for us. With a coin, there's a 50/50 chance of getting heads. Half the time it's going to come up heads, half the time it's going to come up tails. So our theoretical probability is right here at 0.5. It's halfway in between 0 and 1. So this blue line is showing your theoretical probability.
Now, when I hit Play, it's going to flip some coins for us. So when they did this first run, it didn't flip any heads. So our theoretical probability is here at 0.5, but our experimental is down at 0. And as I go again, still no heads. So we're still below 0, still no heads. And you can see the chances of the heads coming up right here, it's still showing me zeros. So we're still heading away from that experimental theoretical probability.
And now that we start to get some heads, it's starting to head back up towards it. And we're approaching and getting closer to the line, but then we start to head away from it. So what this is showing us is that as I do this more and more times-- so an example, instead of stopping at 10, we stopped at 10,000-- that's getting us closer and closer as I'm doing more trials.
And we can expect that eventually we're going to get 2.5, we won't go above 0.5, but we're going to start to narrow right around that blue line. That's the law of large numbers. As I take more and more trials, as I flip more and more coins, we're going to get closer and closer to the blue line and just kind of waver right around it. We're looking at that red one, how it's wavering right around the blue line, the more trials that we do.
Now, an interesting thing about the chart down here is it shows us the proportion. So as we're going up, we're going from 0.3 to 0.35, 0.38, 0.4, we're getting closer and closer until we actually hit 0.5. Then it goes above 0.5 for a bit, comes back to 0.5, goes under, goes back to 0.5. It's wavering right around 0.5.
Now, when we're back here, and we have that long streak of no heads at all, someone might say, I haven't gotten any heads at all. I am due for a tails. It's going to have to happen. Now, that statement there is false. Because I hadn't gone a head the first time, it didn't mean that I had to get a head the second time. And then when I went twice without getting any, it didn't mean I had to get one the next time either.
So this is called the law of averages or the gambler's fallacy or gambler's ruin. Now, the key here is that it's false. It's not true that because I got a head that first time-- oh, sorry-- because I didn't get heads for three or four times, that all of a sudden I had to get a heads the next time. I still have the same chance on that fifth flip of getting a heads as I did on that first flip. It's always 0.5 chance of getting a heads. It doesn't change whatever happened before it.
Now, the reason this is called gambler's fallacy or the gambler's ruin is because people who are betting, and they're betting on streaks, like a player being due for a hit. That's totally not true. Their chances of getting a hit doesn't really depend on what happened before it. And so the hot streaks in sports are a good example of someone believing that you have to have that hit come or that miss come.
And one example is Joe DiMaggio had a 56-game hitting streak. Even though he had 56 games where he was hitting, that next time that he got up to bat, his chances of getting a hit or of missing didn't have anything to do with the fact that he'd done it 56 times. He still has that same chance based on how good he is of getting a hit or not. It doesn't have to do with the streak that came before it.
So be careful and be on the lookout for these ideas of streaks, or you're getting due for a hit, or you're due for a win. Those are false. That's a false sense of averages there. This tutorial has covered the law of large numbers and the law of averages.