If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains ***.kastatic.org** and ***.kasandbox.org** are unblocked.

Main content

Current time:0:00Total duration:16:52

welcome back now let's do a problem that involves almost everything we've learned so far about probability and combinations and conditional probability so let's say I have a bag again and in that bag I have five fair coins five fair and I have ten unfair coins ten unfair and a fair coin of course there's a 50/50 chance of getting heads or tails and the unfair coin let's say that there is a 80% chance of getting a heads for any one of those coins and that there is a 20% chance of getting tails right because it's going to either be heads or tails so my question is is I what happens is I put my hand in the bag and I my eyes are closed and I picked out a coin and then I flip it six times and it turns out that I got five out of well let's say yeah well no let me do it let's say I got four out of six heads that's the result I got what I want to know is what is the probability that I picked out a fair coin given that I got four out of six heads so before moving on let's do a little bit of review of Bayes theorem and I think that'll give us a good framework for the rest of this problem so Bayes theorem let me let me do it in this corner up here Bayes theorem tells us the probability of both a and B happening that upside down U is just intersection and set theory but it's essentially saying you know it's the set of events in which both a and B occur that's equal to the probability of a occurring given B times the probability of B which is also equal to the probability of B occurring given a time's the probability okay I think this should make some intuition to you for you if it doesn't it might be a good idea to watch the the conditional probability videos but what we can do is we can rearrange this equation right here to get if we just divide both sides by the probability of B we get the probability and I'll do this in a vibrant color the probability of a given B is equal to the probability of B given a time's the probability of a divided by the probability of B I just took this equation divided both sides by the probability of B and I got this so what is a and B in the problem we're trying to figure out we want to try to figure out the probability that I picked out a fair coin given that I got four out of six heads so in this situation a is that I got a fair coin a is equal to picked fair coin picked fair and then B is V is equal to four out of six heads four out of six cents so in order to figure out the probability that I picked a fair coin given that I got four six adds I have to know the probability of getting four out of six heads given a fair that I picked the fair coin times the probability of picking out a fair coin divided by the probably getting four out of six heads in general so this is probably the hardest part to figure out and we will along the way will actually probably figure out the top two terms so what's the probability of B or the probability of getting four out of six heads let's see what happens right when I I put my hand into the bag and I pick out a coin there is a five and ten chance or in five and fifteen chance right there fifteen total coins that I pick a fair coin so five and fifteen that's the same thing as 1/3 that I pick a fair coin and then there is a two-thirds chance that I pick a unfair coin right now if I pick a fair coin given I that I have a fair coin what is the probability what is the probability given the fair coin what is the probability that I get four out of six heads well once again let's think about the previous several videos what's the probability giving any one particular combination of four out of six heads so for example you know it could be heads tails heads tails heads heads it could be I don't know it could be the first four heads heads heads heads heads tails tails right and there are a bunch of these and we once again will use the the binomial coefficient or we'll use our knowledge of combinations to figure out how many different combinations there are but what's the probability of each of these combinations well what's probability of heads that's 0.5 times 0.5 times 0.5 times 0.5 and then the probability of tails this is a fair coin is also point 5 times 0.5 times 0.5 so each of these there's a 1/2 chance of getting a heads times 1/2 chance of a tail some someone's 1/2 chance of a heads times 1/2 chance of a tail 6 etc so each of these are essentially you know 1/2 times 1/2 6 times so the probability of each of the combinations is 1/2 to the 6th power 1/2 to the 6th power and so how many combinations are there like this where you get out of the 6 flips you're choosing you're essentially choosing 4 heads you're choosing you know if I'm once again the god of probability I am picking for exactly four of the six heads sorry I'm picking four of exactly six of the flips to end up heads right I'm choosing which of the the flips get you know selected so to speak so it's essentially there are going to be out of out of six flips I'm choosing as a god of probability for to be heads so that's the number of combinations I've cut the number of unique combinations where you have four out of six heads times the probability of each of the combinations which is 1/2 to the sixth power well what's 6 choose 4 that's sick factorial over 4 factorial times 6 minus 4 factorial so that's 2 factorial and that's times 1/2 to the sixth and I'll switch colors again just to stop the monotony and that equals see 6 times 5 times 4 times 3 times 2 we don't have to write the wrong times 1 I'll do it anyway over 4 factorial 4 times 3 times 2 times 1 and then 2 factorial 2 times 1 so that cancels with that the 1 we can ignore to 2 divide both sides by the numerator and denominator by 2 and this becomes 2/3 so this becomes 15 so this equals 15 times 1/2 to the 6 what's 1/2 to 6 that's 1 over 64 right so 1 over 64 so becomes 15 over 64 so the probability of getting four out of six heads given a fair coin is 15 out of 64 so this is the probability of four out of six heads given a fair coin and if you look at it based on our definition of B and a this is the probability of B given a right B is four out of six heads given a fair coin fair enough so let's figure out the probability of because there's two ways of getting four out of six heads one that we picked a fair coin and then you know times 15 out of 64 and then there's a probability that we picked an unfair coin so what's the probability of the unfair coin of getting of getting four out of six heads given the unfair coin well once again what's probably if each of the combinations we get four out of six so in this situation let's do the same one heads tails heads tails heads heads right that's four out of six heads but in this situation it's not a 50% chance of getting heads 80% so it would be 0.8 times 0.2 times 0.8 times 0.2 times 0.8 times 0.8 is essentially we have you know this multiplication we can rearrange it because it doesn't matter what order you multiply things in so it's point eight to the fourth power times 0.2 squared right it's it and it doesn't matter you know any any of the unique combinations will each have the same probability because we can just rearrange the the order in which we multiply right and then how many of these combinations are there if we are once again the god of probability and out of six flips we are picking four we're choosing four that are going to end up heads how many ways can I pick a group of four well once again that's times 6 choose 4 and we figured out what that is 6 choose 4 is 15 so this equals 15 15 times 0.8 to the fourth times 0.2 squared so the probability so the end this so this is this is the probability of four out of four out of six heads given an unfair coin so what's the total probability of getting four out of six heads well it's going to be the probability of getting the fair coin which is one-third times the probability giving four out of six heads given the fair coin and that's this 15 over 64 times 15 over 64 plus the probability of an unfair coin two-thirds times the probability of getting four out of six heads given the unfair coin and that's what we figured out here times 15 times 0.8 to the fourth 2 times 0.2 squared and this is the probability of getting four out of six heads and let's figure out what that is well this is one of this is just this will cancel out with this it becomes five out of 64 that's easy enough two-thirds times fifteen that's ten and now we just have to figure out what that is let's see I'm gonna go over the time limit to see if being a YouTube Partner allows me to go over the time limit see point 8 times 0.8 times 0.8 times 0.8 is equal to and then times 0.2 squared so times 0.2 times 0.2 is equal to 0.01 6 so that's that and then we say times 10 right because 2/3 times 15 so times 10 is equal to sixteen point three eight four percent so the probability is so this term right here let me write that down and I'll switch colors again this is 0.16 three eight four and we're going to add that to five divided by 64 so let's see five divided by 64 is equal to 0.074 whatever plus 0.16 three eight four is equal to 0.2 four one nine six five so that's the probability not knowing which coin I picked out that's the probability of getting four out of six heads when you when you combine it you know it could be one-third chance fair two-thirds chance unfair so that's 24 point one nine I'm keeping the precision just because it might come in useful later percent chance so that's the probability of B so let's see if we can clean this up a little bit just because I don't think we need all of this writing now I think we're ready to substitute into the our Bayes formula which we base theorem that we read arrived let me derive no but that's not what I wanted to do according longer videos is dangerous because if I make a mistake that's more time wasted I don't want to delete anything that could be useful okay so let's see if we can solve the probability that we picked a fair coin given that we got four out of six heads so that is going to be equal to by Bayes theorem which should make some sense to you that is is equal to the probability of B given a so it's the probability that we get four out of six heads given a fair coin times the probability of a fair coin over the probability of getting four out of six heads either way 406 heads so four out of six heads given a fair coin we figured that over here that's 15 over 64 so this equals 15 over 64 what's the probability that we picked a fair coin well there's 15 coins and five of them were fair so it's 5 out of 15 so it's 1/3 sometimes one-third and what's the probability that in general we picked four out of six heads well that's that's this number 0.2 four one nine six five so this equals let's see this is equal to five over 64 divided by 0.2 four one nine six five and what is that equal to that's five divided by 64 it's equal to that divided by 0.2 four one nine six five is equal to 32 point well roughly three percent is equal to 32 point three percent so that's amazing or relatively amazing weave now it's a little bit less than a one-third shot that we picked the fair coin given that we got four out of six heads oh and and and what's interesting is the four out of six heads it kind of decreased the probability that we got a fair coin right because if the before having any data on on what happens when we flip it we would have had a one-third probability which is thirty-three point three right but given that we got more heads than tails kind of the universe of probability is is telling us that well if you got more heads than tails that makes it a little bit more likely that you picked the unfair coin which is a little bit more weighted to heads but saying it's not that much more likely because this isn't that unusual of a result to get even with a fair coin and so that's why it became a little bit likely to get a fair coin I will actually land let me give you a let me give you a bit of an intuition visually kind of what set theory on why that makes sense why that makes sense so if we go back to Bayes theorem let's just say that you know this is our let me this is the universe of all of the events right that's all of the universe there's roughly a one-third chance that I picked a fair coin so roughly one-third of this will be fair this is fair this is unfair right and then if I picked a fair coin we figured out that it's roughly a fifteen out of 64 shot that I get I get four out of six heads so maybe that's this little section of the let me do it in a different color that's this section and then we figured out if we have an unfair coin I forgot what the exact number is but there was some probability that we get four out of six heads right it's actually a little bit bigger it's like that right so this is getting four out of six heads given you got an unfair coin this is getting four out of six heads given that you got a fair coin and then this whole area is a probability to get four out of six heads so all Bayes theorem told us is look we got four out of six heads so this this where in this universe where we got four out of six heads and if we got four out of six heads one-third of this universe roughly you're thirty two point three percent of this subset of four out of six heads intersects with the fair coin universe right so this 32.3% is essentially this fraction of the total probability of getting four out of six heads anyway hopefully that gave you a little bit of intuition and I hope that YouTube lets me publish this video because I'm on my 17th minute I'll see you in the next video