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

0 energy points

# Conditional probability and combinations

Video transcript

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, [UNINTELLIGIBLE] 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.