Statistics and probability
- Probability using combinations
- Probability & combinations (2 of 2)
- Example: Different ways to pick officers
- Example: Combinatorics and probability
- Getting exactly two heads (combinatorics)
- Exactly three heads in five flips
- Generalizing with binomial coefficients (bit advanced)
- Example: Lottery probability
- Probability with permutations and combinations
- Conditional probability and combinations
- Mega millions jackpot probability
- Birthday probability problem
Probability that I picked a fair coin given that I flipped 4 heads out of 6 tosses. Created by Sal Khan.
Want to join the conversation?
- Bayes Theorem? May I know which video teaches it? (Tried a search but couldn't find it)(14 votes)
- by following the link in the 1st A to the 1st Q, by proc.null ... I found http://oscarbonilla.com/2009/05/visualizing-bayes-theorem/ posted by Benjamin.keep ...
1) picture (or better yet sketch) a Venn diagram with overlapping circles A and B
2) note that the 'area' (probability) for the intersection of these two, AB, can be written as:
P( AB ) = P( A | B ) * P( B )
i.e. the probability that an 'event' is in both A and B equals the probability of an 'event' being in A given that it is in B, times the probability an 'event' is in B
P( AB ) = P( B | A ) * P( A )
3) as both are equal to P( AB )
P( A | B ) * P( B ) = P( B | A ) * P( A )
4) divide both sides by P( B ) to get:
P( A | B ) = P( B | A ) * P( A ) / P( B )
This is Bayes' Theorem.(19 votes)
- I don't understand why the formula changes between the two branches (picking fair coin vs picking fair coin). When picking the fair coin, P(B|A)=(combination of 4 out of 6) / 2^6 x (1/3). When picking the unfair coin, the P(B) becomes MULTIPLIED by (combination of 4 out of 6) and the unfair coin outcomes (80%^4 x 20%^2). In my head, it should be Divided by (80%^4 x 20%^2). Can anyone help?(5 votes)
- Great question - I see how that could be confusing.
In the case of the fair coin, the probability of each outcome is equal at 0.5 for heads and 0.5 for tails. Because they are equally likely, the probability can be calculated by simply using a proportion - the combinations 4 out of 6 proportional to the total number of possible EQUALLY LIKELY outcomes.
In the case of the unfair coin with heads at 80%, the proportion won't work because the outcomes are not equally likely. If you tried a proportion with the unfair coin you would get a probability which doesn't take into account the 30% advantage that heads has. That is why Sal switched formulas to use one which is based on the multiplication rule of probability, so he could multiply the 20% in for all the tails outcomes (80%^4 heads outcomes, and 20%^2 tails outcomes). This formula is known as the Probability Mass Function of the Binomial Distribution. Sal has a whole bunch of videos on the Binomial distribution in a later section.
Hope this helped!(3 votes)
- How do you decide whether to use the combination formula n!/(n-k)!k! used in this video or to use the permutation formula n!/(n-k)! used in the next video (birthday problem probability) ? It seems like you would never use the permutation formula because it counts redundant sets but he uses it in the next video but not this one.(3 votes)
- Choosing to count permutations vs counting combinations involves considering if a different order of results is relevant. For example, when flipping coins it only matters if a result is H, it doesn't matter exactly which coin is heads. When choosing birthdays, when person 1 has B-day January 1 and person 2 has B-day January 2, that is a different result from person 1 has B-day January 2 and person 2 has B-day January 1.(5 votes)
- Since I need captions to understand what's being said, my eyes were confounded by the poor video quality. It would be good to redo this.(4 votes)
- i think this particular questions is not fathomable to me because it seems confusing. is there any other example which explains this question better. i'm totally confused(3 votes)
- The prerequisites that you need to have for understanding this problem are -
1. Conditional Probability
2. Bayes theorem
Just as an overview P(A|B) means what is the probability of event A occurring given that event B occurs. And P(A.B) means what is the probability of events A and B occurring together.(2 votes)
- At10:00, Sal shows the P(4/6 heads) = (P(F) * P(4/6 heads | F)) + (P(U) * P(4/6 heads | U)). I don't quite understand why we are adding both sets of probabilities (fair and unfair) in order to get the P(4/6 heads). Can anyone clarify?(2 votes)
- There are 2 ways to get 4H out of 6:
(1) with the fair coin. and (2) with the unfair coin (convince yourself of this).
Breaking the problem into parts, get the probability for the fair coin, then for the unfair coin, then add them together to get the total probability (since the coin can be fair OR unfair, you can add the probabilities).
The probability for the fair coin is: P(4H/6 | fair) * P(fair) (that is: P(you get a fair coin) * P( a fair coin gets you 4H/6 ).
Similarly the probability for the unfair coin is P(4H/6 | unfair ) * P(unfair) (that is: P(you get an unfair coin) * P( the unfair coin gets you 4H/6).(2 votes)
- I keep seeing P( A | B ) defined as:
P( A | B) = P( The intersection of A & B) / P( B )
But if the events are independent, then P( A | B ) = P( A ).
Can these two forms be reconciled? Usually in mathematics the definition would cover both these situations but I can not see how the first definition works out to P( A ) when the intersection of A and B is empty.
Any help would be appreciated,
- Independent does not mean the intersection is empty. Independence implies that:
P (A ∩ B) = P(A) x P(B)
I trust you can do the division from there?(4 votes)
- When you calculate the probability of getting heads in a number of flips, why do you multiply the probability of heads with tails? I expected you will multiply the probability of the heads only, could you clarify?(2 votes)
- If you flip a coin what are the chances you get heads? Tails? Of course, it's 50-50 for either heads' and tails'.
Now, for 2 flips of a coin: what are the chances for HH? HT? TH? TT? What do you think?
Well, each flip is an independent event, so e.g. P(H, then T) = P(H) * P(T) = 1/4. So P(HH) = P(HT) = P(TH) = P(TT) = 1/4. The probability of getting 1 heads is 1/2, but that's because there are 2 possible events for 1 heads - HT and TH - which are each 1/4, and you get 2*(1/2)*(1/2) = 1/2.
It's this same idea for any number n of tosses, for example, 6 tosses. What's P(4 heads)? It's the number of sequences which have 4 heads', times (1/2)^6, = (6 C 4) * (1/2)^6(1 vote)
- Where are the conditional probability videos that he mentions at2:00?(2 votes)
- Conditional probability refers to the probability given that another event has happened. So all of the equations where you see the given line: "|" are calculations of conditional probabilities.(1 vote)
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 5 fair coins, and I have 10 unfair coins. And a fair coin, of course, is a 50:50 chance of getting heads or tails, and the unfair coin-- let's say that there is an 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, what happens is I put my hand in the bag, and my eyes are closed, and I picked out a coin. And then I flip it six times. 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-- and 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 an intersection in set theory, but it's essentially saying, you know, it's a 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, times the probability of a. And I think this should make some intuition for you. If it doesn't, it might be a good idea to watch 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, times 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're 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. And then b is equal to four out of six heads. So in order to figure out the probability that I picked a fair coin, given that I got four out of six heads, I have to know the probability of getting four out of six heads given that I picked the fair coin, times the probability of picking out a fair coin, divided by the probability of getting four out of six heads, in general. So this is probably the hardest part to figure out. And we will-- along the way-- we will actually probably figure out the top 2 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 put my hand into the bag and I pick out a coin, there is a five in fifteen chance-- right, there are 15 total coins-- that I pick a fair coin. So five in fifteen-- that's the same thing as 1/3-- that I pick a fair coin. And then there's a 2/3 chance that I pick an unfair coin. Now if I pick a fair coin, given that I have a fair coin, 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 of getting 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 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 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 the probability of heads? That's .5 times .5 times .5 times .5. And the probability of tails, if this is a fair coin, is also .5 times .5 times .5. So each of these-- there's a 1/2 chance of getting a heads, times a 1/2 chance of a tails, times a 1/2 chance of a heads, times 1/2 chance of a tails, et cetera, et cetera. So each of these are essentially 1/2 times 1/2, six times. So the probability of each of the combinations is 1/2 to the sixth power. And so how many combinations are there like this? Where you get-- out of the six flips, you're essentially choosing four heads. You're choosing-- if I'm once again the God of probability-- I'm picking four, 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 flips get selected, so to speak. So it's essentially, there are going to be-- out of six flips, I'm choosing, as the God of probability-- four to be heads. So that's 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 6 factorial over 4 factorial times 6 minus 4 factorial. So that's 2 factorial. And that's times 1/2 to the sixth. I'm going to switch colors again, just to stop the monotony. And that equals 6 times 5 times 4 times 3 times 2-- we don't have to write the 1 times 1, but 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. 2, divide the numerator and denominator by 2, and this becomes 3. So this becomes 15. So this equals 15 times 1/2 to the sixth. What's 1/2 to the sixth? It's 1/64, right? So 1/64, so it becomes 15/64. So the probability of getting four out of six heads, given a fair coin, is 15 out of 64. 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 times 15 out of 64. And then there's the probability that we picked an unfair coin. So what's the probability of the unfair coin? Of getting four out of six heads, given the unfair coin? Well, once again, what's the probability of each of the combinations where we got four out of six? So in this situation, let's do the same one. Heads, tails, heads, tails, heads, heads. That's four out of six heads. But in this situation, it's not a 50% chance of getting heads. It's 80%. So it would be .8 times .2 times .8 times .2 times .8 times .8. Now, 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 .8 to the fourth power times .2 squared. And it doesn't matter. You know, any of the unique combinations will each have the same probability. Because we can just rearrange the order in which we multiply. And then how many of these combinations are there? If we are, once again, the God of probability, and out of six flips we're 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. We figured out what that is. 6 choose 4 is 15. So this equals 15 times .8 to the fourth times .2 squared. And this is the probability 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 1/3-- times the probability of getting four out of six heads, given the fair coin-- and that's this 15/64. Plus the probability of getting an unfair coin-- 2/3-- 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 .8 to the fourth, times .2 squared. And this is the probability of getting four out of six heads. And let's figure out what that is. This'll cancel out with this. This becomes 5 out of 64, that's easy enough. 2/3 times 15, that's 10. And now we just have to figure out what that is. Let's see, I'm going to go over the time limit to see if being a Youtube partner allows me to go over the time limit. .8 times .8 times .8 times .8 is equal to-- and then times .2 squared. So times .2 times .2 is equal to .016. So that's that. And we said times 10, right? Because 2/3 times 15. So, times 10, is equal to 16.384%. So the probability is-- so this term right here-- let me write that down, and I'll switch colors again-- this is .16384. And we're going to add that to 5 divided by 64. So let's see. 5 divided by 64 is equal to .07, whatever, whatever. Plus .16384 is equal to .241965. 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 combine them you know? It could be 1/3 chance fair, 2/3 chance unfair. So that's 24.19-- I'm keeping the precision, just because it might come in useful later-- % 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 Bayes' formula, which we-- Bayes' Theorem-- that we rederived. Nope, that's not what I wanted to do. Recording 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. OK. 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 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. So four out of six heads, given a fair coin-- we figured that over here-- that's 15/64. So this equals 15/64. What's the probability that we picked a fair coin? Well, there's 15 coins and 5 of them are fair, so it's 5 out of 15, so it's 1/3. So times 1/3. And what's the probability that, in general, we picked four out of six heads? Well that's this number: .241965. So this equals-- let's see, this is equal to 5/64 divided by .241965, and what does that equal to? That's 5 divided by 64 divided by .241965 is equal to 32.-- well, roughly 3%-- is equal to 32.3%. So that's amazing. Or relatively amazing. It's a little bit less than a 1/3 shot that we picked the fair coin, given that we got four out of six heads. And what's interesting is, the four out of six heads, it kind of decreased the probability that we got a fair coin. Because before having any data on what happens when we flip it, we would have had a 1/3 probability. Which is 33.3, right? But given that we got more heads than tails, the universal probability is telling us that, well, if you got more heads then 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 it's saying it's not that much more likely, because this isn't that unusual of a result to get, even with a fair coin. So that's why it became a little bit less likely to get a fair coin. And let me give you a bit of an intuition, visually, kind of with Set Theory, on why that makes sense. So if we go back to Bayes' Theorem-- let's just say that this is the universe of all of the events. That's all of the universe. There's roughly a 1/3 chance that I picked a fair coin. So roughly 1/3 of this will be fair. This is fair, this is unfair. And then if I picked a fair coin, we figured out there's roughly a 15 out of 64 shot that I get four out of six heads. So maybe that's this little section of this-- 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. It's actually a little bit bigger, it's like that. 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 the probability that you get four out of six heads. So all Bayes' Theorem told us is, look, we got four out of six heads. So we're in this universe where we got four out of six heads. And if we got four out of six heads, 1/3 of this universe-- roughly, or 32.3% of this subset of four out of six heads-- intersects with the fair coin universe. 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.