We have only one more topic to complete our basic probability modules. This is something very special called the binomial theorem. It's binomial because it's used when there are two possible outcomes. A success or a non-success. So, for example, if I'm flipping a coin, and I consider heads to be a success, the number of heads that I get would be the number of successes, the number of coin flips would be the number of trials. So, I'm interested in trials and I'm interested in successes and I'm talking about a binary outcome. There are only two outcomes, like heads or tails. Okay? The individual probability of success with a fair coin could be 0.5 but using the binomial theorem, I'm not limited to fair coins or situations where the probability of success is 0.5. The probability can be any value greater than zero and less than one. So let's say I want to know what is the probability of getting a certain number of heads in a string of coin tosses. The binomial theorem will tell me the answer. And this is the binomial theorem. It's n choose s times the probability raised to the number of successes times 1 minus the probability. Note that this is also the probability of failure raised to the (n – s), and this would be the number of failures. So we have the number of ways in which you can have s successes in n trials, multiplied by the probabilities of an individual success, raised to the number of successes, multiplied by the probability of failure raised to the number of failures. Okay, so, let's try an example. Let's say that I have 72 heads out of 100 coin tosses of a fair coin. Okay, what is the probability that, that outcome will occur? In other words, with 100 coin tosses I will get exactly 72 successes or 72 heads. Well, my n is equal to 100, my s or number of successes is equal to 72, and my probability is equal to 0.5. And my formula will be 100 choose 72 times 0.5 to the 72 times 1 minus 0.5 or also 0.5 to the 100 minus 72 or 28. Okay and we'll just pause here for a minute, if you'd like to try this on your calculator or Excel, you can do so and I'll give you the answer in a moment. We have 100 Choose 72 times 0.5 to the 72 times 0.5 to the 28 and this is equal to 3.94 times 10 to the minus 6. So, we have an extremely small probability of getting exactly 72 heads in a series of 100 heads. But now let's ask a little bit more interesting problem or question. Let's say, here's our question. Either we have a fair coin. It's probability is 0.5 of heads. Or we have a bent coin. It has a probability of 0.55 of heads. Okay. We've observed the 72 heads out of 100 and we want to know what is the probability that we've observed that the fair coin and what is the probability that we've observed vertically. And this how we would set this problem up using Bayes theorem. We'd say, probability of observing the fair coin given 72 heads of 100 is equal to probability of observing 72 heads of 100 given the fair coin Times the probability that, that coin is fair and because we have no basis for knowing whether it's fair or not, we're going to start with a prior probability of one half by the principle of indifference and then we're going to divide this by the total probability of the data which is since we are limited to only the two possible coins is going to be equal to the probability of 72 heads out of 100 given the fair coin times one half plus the probability of 72 heads of 100 given the bent coin times one half. Okay, so as I mentioned before, the probability on the top is 3.94 times 10 to the minus 6. And a quick application of the binomial theorem will tell us that the probability of 72 successes in 100 trials
given the bent coin is
0.0001972. So we take this, divided by this plus this and what we're find out is that the probability that the we are looking at the fair coin is less than 2% and the probability that we are looking at the bent coin is greater than 98%. So Bayes theorem has allowed us to determine with near certainty which process with its known parameter is responsible for the data that we have observed. And this is the power of Bayes theorem combined with the binomial theorem.