The following content is
provided under a Creative
Commons license.
Your support will help MIT
OpenCourseWare continue to
offer high quality educational
resources for free.
To make a donation, or view
additional materials from
hundreds of MIT courses, visit
MIT OpenCourseWare at
ocw.mit.edu.
PROFESSOR: OK.
So today's lecture will be on
the subject of counting.
So counting, I guess, is
a pretty simple affair
conceptually, but it's a
topic that can also get
to be pretty tricky.
The reason we're going to talk
about counting is that there's
a lot of probability problems
whose solution actually
reduces to successfully counting
the cardinalities of
various sets.
So we're going to see the basic,
simplest methods that
one can use to count
systematically in various
situations.
So in contrast to previous
lectures, we're not going to
introduce any significant
new concepts of a
probabilistic nature.
We're just going to use the
probability tools that we
already know.
And we're going to apply them
in situations where there's
also some counting involved.
Now, today we're going
to just touch the
surface of this subject.
There's a whole field of
mathematics called
combinatorics who are people who
actually spend their whole
lives counting more and
more complicated sets.
We were not going to get
anywhere close to the full
complexity of the field, but
we'll get just enough tools
that allow us to address
problems of the type that one
encounters in most common
situations.
So the basic idea, the basic
principle is something that
we've already discussed.
So counting methods apply in
situations where we have
probabilistic experiments with
a finite number of outcomes
and where every outcome--
every possible outcome--
has the same probability
of occurring.
So we have our sample space,
omega, and it's got a bunch of
discrete points in there.
And the cardinality of the set
omega is some capital N. So,
in particular, we assume that
the sample points are equally
likely, which means that every
element of the sample space
has the same probability
equal to 1 over N.
And then we are interested in a
subset of the sample space,
call it A. And that
subset consists
of a number of elements.
Let the cardinality of that
subset be equal to little n.
And then to find the probability
of that set, all
we need to do is to add the
probabilities of the
individual elements.
There's little n elements, and
each one has probability one
over capital N. And
that's the answer.
So this means that to solve
problems in this context, all
that we need to be able to do
is to figure out the number
capital N and to figure out
the number little n.
Now, if somebody gives you a set
by just giving you a list
and gives you another set,
again, giving you a list, it's
easy to count there element.
You just count how much
there is on the list.
But sometimes the sets are
described in some more
implicit way, and we may have to
do a little bit more work.
There's various tricks that are
involved in counting properly.
And the most common
one is to--
when you consider a set of
possible outcomes, to describe
the construction of those
possible outcomes through a
sequential process.
So think of a probabilistic
experiment that involves a
number of stages, and in each
one of the stages there's a
number of possible choices
that there may be.
The overall experiment consists
of carrying out all
the stages to the end.
And the number of points in the
sample space is how many
final outcomes there can be in
this multi-stage experiment.
So in this picture we have an
experiment in which of the
first stage we have
four choices.
In the second stage, no matter
what happened in the first
stage, the way this is drawn
we have three choices.
No matter whether we ended up
here, there, or there, we have
three choices in the
second stage.
And then there's a third stage
and at least in this picture,
no matter what happened in the
first two stages, in the third
stage we're going to have
two possible choices.
So how many leaves are there
at the end of this tree?
That's simple.
It's just the product of
these three numbers.
The number of possible leaves
that we have out there is 4
times 3 times 2.
Number of choices at each stage
gets multiplied, and
that gives us the number
of overall choices.
So this is the general rule, the
general trick that we are
going to use over and over.
So let's apply it to some very
simple problems as a warm up.
How many license plates can you
make if you're allowed to
use three letters and then
followed by four digits?
At least if you're dealing with
the English alphabet, you
have 26 choices for
the first letter.
Then you have 26 choices
for the second letter.
And then 26 choices for
the third letter.
And then we start the digits.
We have 10 choices for the first
digit, 10 choices for
the second digit, 10 choices for
the third, 10 choices for
the last one.
Let's make it a little more
complicated, suppose that
we're interested in license
plates where no letter can be
repeated and no digit
can be repeated.
So you have to use different
letters, different digits.
How many license plates
can you make?
OK, let's choose the
first letter,
and we have 26 choices.
Now, I'm ready to choose my
second letter, how many
choices do I have?
I have 25, because I already
used one letter.
I have the 25 remaining letters
to choose from.
For the next letter,
how many choices?
Well, I used up two of
my letters, so I
only have 24 available.
And then we start with the
digits, 10 choices for the
first digit, 9 choices for the
second, 8 for the third, 7 for
the last one.
All right.
So, now, let's bring some
symbols in a related problem.
You are given a set that
consists of n elements and
you're supposed to take
those n elements and
put them in a sequence.
That is to order them.
Any possible ordering of those
elements is called a
permutation.
So for example, if we have the
set 1, 2, 3, 4, a possible
permutation is the
list 2, 3, 4, 1.
That's one possible
permutation.
And there's lots of possible
permutations, of course, the
question is how many
are there.
OK, let's think about building
this permutation by choosing
one at a time.
Which of these elements goes
into each one of these slots?
How many choices for the number
that goes into the
first slot or the elements?
Well, we can choose any one of
the available elements, so we
have n choices.
Let's say this element goes
here, having used up that
element, we're left with n minus
1 elements and we can
pick any one of these and bring
it into the second slot.
So here we have n choices, here
we're going to have n
minus 1 choices, then how
many we put there will
have n minus 2 choices.
And you go down until the end.
What happens at this point
when you are to
pick the last element?
Well, you've used n minus of
them, there's only one
left in your bag.
You're forced to use that one.
So the last stage, you're going
to have only one choice.
So, basically, the number of
possible permutations is the
product of all integers
from n down to one, or
from one up to n.
And there's a symbol that we
use for this number, it's
called n factorial.
So n factorial is the number of
permutations of n objects.
The number of ways that you can
order n objects that are
given to you.
Now, a different equation.
We have n elements.
Let's say the elements
are 1, 1,2, up to n.
And it's a set.
And we want to create
a subset.
How many possible subsets
are there?
So speaking of subsets means
looking at each one of the
elements and deciding whether
you're going to put it in to
subsets or not.
For example, I could choose
to put 1 in, but 2 I'm not
putting it in, 3 I'm not putting
it in, 4 I'm putting
it, and so on.
So that's how you
create a subset.
You look at each one of the
elements and you say, OK, I'm
going to put it in the subset,
or I'm not going to put it.
So think of these as consisting
of stages.
At each stage you look at
one element, and you
make a binary decision.
Do I put it in the
subset, or not?
So therefore, how many
subsets are there?
Well, I have two choices
for the first element.
Am I going to put in
the subset, or not?
I have two choices for the
next element, and so on.
For each one of the elements,
we have two choices.
So the overall number of choices
is 2 to the power n.
So, conclusion--
the number of subsets, often n
element set, is 2 to the n.
So in particular, if we take n
equal to 1, let's check that
our answer makes sense.
If we have n equal to one, how
many subsets does it have?
So we're dealing with
a set of just one.
What are the subsets?
One subset is this one.
Do we have other subsets
of the one element set?
Yes, we have the empty set.
That's the second one.
These are the two possible
subsets of
this particular set.
So 2 subsets when n is equal to
1, that checks the answer.
All right.
OK, so having gone so far, we
can do our first example now.
So we are given a die
and we're going
to roll it 6 times.
OK, let's make some assumptions
about the rolls.
Let's assume that the rolls are
independent, and that the
die is also fair.
So this means that the
probability of any particular
outcome of the die rolls--
for example, so we have 6 rolls,
one particular outcome
could be 3,3,1,6,5.
So that's one possible
outcome.
What's the probability
of this outcome?
There's probability 1/6 that
this happens, 1/6 that this
happens, 1/6 that this
happens, and so on.
So the probability that
the outcome is this
is 1/6 to the sixth.
What did I use to come
up with this answer?
I used independence, so I
multiplied the probability of
the first roll gives me a 2,
times the probability that the
second roll gives me
a 3, and so on.
And then I used the assumption
that the die is fair, so that
the probability of 2 is
1/6, the probably of 3
is 1/6, and so on.
So if I were to spell it out,
it's the probability that we
get the 2 in the first roll,
times the probability of 3 in
the second roll, times the
probability of the
5 in the last roll.
So by independence, I can
multiply probabilities.
And because the die is fair,
each one of these numbers is
1/6 to the sixth.
And so the same calculation
would apply no matter what
numbers I would put in here.
So all possible outcomes
are equally likely.
Let's start with this.
So since all possible outcomes
are equally likely to find an
answer to a probability
question, if we're dealing
with some particular event, so
the event is that all rolls
give different numbers.
That's our event A. And our
sample space is some set
capital omega.
We know that the answer is going
to be the cardinality of
the set A, divided by the
cardinality of the set omega.
So let's deal with the
easy one first.
How many elements are there
in the sample space?
How many possible outcomes
are there when you
roll a dice 6 times?
You have 6 choices for
the first roll.
You have 6 choices for the
second roll and so on.
So the overall number
of outcomes is going
to be 6 to the sixth.
So number of elements in
the sample space is 6
to the sixth power.
And I guess this checks
with this.
We have 6 to the sixth outcomes,
each one has this
much probability,
so the overall
probability is equal to one.
Right?
So the probability of an
individual outcome is one over
how many possible outcomes
we have, which is this.
All right.
So how about the numerator?
We are interested in outcomes
in which the numbers that we
get are all different.
So what is an outcome in which
the numbers are all different?
So the die has 6 faces.
We roll it 6 times.
We're going to get 6
different numbers.
This means that we're going to
exhaust all the possible
numbers, but they can appear
in any possible sequence.
So an outcome that makes this
event happen is a list of the
numbers from 1 to 6,
but arranged in
some arbitrary order.
So the possible outcomes that
make event A happen are just
the permutations of the
numbers from 1 to 6.
One possible outcome that makes
our events to happen--
it would be this.
Here we have 6 possible numbers,
but any other list of
this kind in which none
of the numbers is
repeated would also do.
So number of outcomes that make
the event happen is the
number of permutations
of 6 elements.
So it's 6 factorial.
And so the final answer is
going to be 6 factorial
divided by 6 to the sixth.
All right, so that's a typical
way that's one solves problems
of this kind.
We know how to count
certain things.
For example, here we knew how to
count permutations, and we
used our knowledge to count the
elements of the set that
we need to deal with.
So now let's get to a slightly
more difficult problem.
We're given once more a
set with n elements.
We already know how many subsets
that set has, but now
we would be interested in
subsets that have exactly k
elements in them.
So we start with our big set
that has n elements, and we
want to construct a subset
that has k elements.
Out of those n I'm
going to choose k
and put them in there.
In how many ways
can I do this?
More concrete way of thinking
about this problem--
you have n people in some group
and you want to form a
committee by picking people from
that group, and you want
to form a committee
with k people.
Where k is a given number.
For example, a 5 person
committee.
How many 5 person committees
are possible if you're
starting with 100 people?
So that's what we
want to count.
How many k element subsets
are there?
We don't yet know the answer,
but let's give a name to it.
And the name is going to be this
particular symbol, which
we read as n choose k.
Out of n elements, we want
to choose k of them.
OK.
That may be a little tricky.
So what we're going to do is
to instead figure out a
somewhat easier problem,
which is going to be--
in how many ways can I pick k
out of these people and puts
them in a particular order?
So how many possible ordered
lists can I make that consist
of k people?
By ordered, I mean that we take
those k people and we say
this is the first person
in the community.
That's the second person
in the committee.
That's the third person in
the committee and so on.
So in how many ways
can we do this?
Out of these n, we want to
choose just k of them and put
them in slots.
One after the other.
So this is pretty much like the
license plate problem we
solved just a little earlier.
So we have n choices for who
we put as the top person in
the community.
We can pick anyone and have
them be the first person.
Then I'm going to choose
the second
person in the committee.
I've used up 1 person.
So I'm going to have n
minus 1 choices here.
And now, at this stage I've used
up 2 people, so I have n
minus 2 choices here.
And this keeps going on.
Well, what is going to
be the last number?
Is it's n minus k?
Well, not really.
I'm starting subtracting numbers
after the second one,
so by the end I will have
subtracted k minus 1.
So that's how many choices I
will have for the last person.
So this is the number
of ways--
the product of these numbers
there gives me the number of
ways that I can create ordered
lists consisting of k people
out of the n that
we started with.
Now, you can do a little bit of
algebra and check that this
expression here is the same
as that expression.
Why is this?
This factorial has all the
products from 1 up to n.
This factorial has all
the products from 1
up to n minus k.
So you get cancellations.
And what's left is all the
products starting from the
next number after here, which
is this particular number.
So the number of possible ways
of creating such ordered lists
is n factorial divided by
n minus k factorial.
Now, a different way that I
could make an ordered list--
instead of picking the people
one at a time, I could first
choose my k people who are going
to be in the committee,
and then put them in order.
And tell them out of these k,
you are the first, you are the
second, you are the third.
Starting with this k
people, in how many
ways can I order them?
That's the number
of permutations.
Starting with a set with k
objects, in how many ways can
I put them in a specific
order?
How many specific orders
are there?
That's basically the question.
In how many ways can
I permute these k
people and arrange them.
So the number of ways
that you can do
this step is k factorial.
So in how many ways can I
start with a set with n
elements, go through this
process, and end up with a
sorted list with k elements?
By the rule that--
when we have stages, the total
number of stages is how many
choices we had in the first
stage, times how many choices
we had in the second stage.
The number of ways that this
process can happen is this
times that.
This is a different way that
that process could happen.
And the number of possible
of ways is this number.
No matter which way we carry out
that process, in the end
we have the possible ways of
arranging k people out of the
n that we started with.
So the final answer that we get
when we count should be
either this, or this
times that.
Both are equally valid ways of
counting, so both should give
us the same answer.
So we get this equality here.
So these two expressions
corresponds to two different
ways of constructing ordered
lists of k people starting
with n people initially.
And now that we have this
relation, we can send the k
factorial to the denominator.
And that tells us what
that number, n choose
k, is going to be.
So this formula-- it's written
here in red, because you're
going to see it a zillion
times until
the end of the semester--
they are called the binomial
coefficients.
And they tell us the number of
possible ways that we can
create a k element subset,
starting with a
set that has n elements.
It's always good to do a sanity
check to formulas by
considering extreme cases.
So let's take the case where
k is equal to n.
What's the right answer
in this case?
How many n elements subsets
are there out
of an element set?
Well, your subset needs
to include every one.
You don't have any choices.
There's only one choice.
It's the set itself.
So the answer should
be equal to 1.
That's the number of n element
subsets, starting with a set
with n elements.
Let's see if the formula gives
us the right answer.
We have n factorial divided by
k, which is n in our case--
n factorial.
And then n minus k
is 0 factorial.
So if our formula is correct, we
should have this equality.
And what's the way to
make that correct?
Well, it depends what kind
of meaning do we
give to this symbol?
How do we define
zero factorial?
I guess in some ways
it's arbitrary.
We're going to define it
in a way that makes
this formula right.
So the definition that we will
be using is that whenever you
have 0 factorial, it's going
to stand for the number 1.
So let's check that this is
also correct, at the other
extreme case.
If we let k equal to 0, what
does the formula give us?
It gives us, again, n factorial
divided by 0
factorial times n factorial.
According to our convention,
this again is equal to 1.
So there is one subset of our
set that we started with that
has zero elements.
Which subset is it?
It's the empty set.
So the empty set is the single
subset of the set that we
started with that happens to
have exactly zero elements.
So the formula checks in this
extreme case as well.
So we're comfortable using it.
Now these factorials and these
coefficients are really messy
algebraic objects.
There's lots of beautiful
identities that they satisfy,
which you can prove
algebraically sometimes by
using induction and having
cancellations happen
all over the place.
But it's really messy.
Sometimes you can bypass those
calculations by being clever
and using your understanding
of what these
coefficients stand for.
So here's a typical example.
What is the sum of those
binomial coefficients?
I fix n, and sum over
all possible cases.
So if you're an algebra genius,
you're going to take
this expression here, plug it in
here, and then start doing
algebra furiously.
And half an hour later, you
may get the right answer.
But now let's try
to be clever.
What does this really do?
What does that formula count?
We're considering k
element subsets.
That's this number.
And we're considering the number
of k element subsets
for different choices of k.
The first term in this sum
counts how many 0-element
subsets we have.
The next term in this sum counts
how many 1-element
subsets we have.
The next term counts how many
2-element subsets we have.
So in the end, what
have we counted?
We've counted the total
number of subsets.
We've considered all possible
cardinalities.
We've counted the number
of subsets of size k.
We've considered all
possible sizes k.
The overall count is
going to be the
total number of subsets.
And we know what this is.
A couple of slides ago, we
discussed that this number is
equal to 2 to the n.
So, nice, clean and simple
answer, which is easy to guess
once you give an interpretation
to the
algebraic expression that you
have in front of you.
All right.
So let's move again to sort of
an example in which those
binomial coefficients are
going to show up.
So here's the setting--
n independent coin tosses,
and each coin toss has a
probability, P, of resulting
in heads.
So this is our probabilistic
experiment.
Suppose we do 6 tosses.
What's the probability that we
get this particular sequence
of outcomes?
Because of independence, we
can multiply probability.
So it's going to be the
probability that the first
toss results in heads, times
the probability that the
second toss results in tails,
times the probability that the
third one results in tails,
times probability of heads,
times probability of heads,
times probability of heads,
which is just P to the fourth
times (1 minus P) squared.
So that's the probability of
this particular sequence.
How about a different
sequence?
If I had 4 tails and 2 heads,
but in a different order--
let's say if we considered
this particular outcome--
would the answer be different?
We would still have P, times P,
times P, times P, times (1
minus P), times (1 minus P).
We would get again,
the same answer.
So what you observe from just
this example is that, more
generally, the probability
of obtaining a particular
sequence of heads and tails is
P to a power, equal to the
number of heads.
So here we had 4 heads.
So there's P to the
fourth showing up.
And then (1 minus P) to the
power number of tails.
So every k head sequence--
every outcome in which we have
exactly k heads, has the same
probability, which is going to
be P to the k, (1 minus p), to
the (n minus k).
This is the probability of any
particular sequence that has
exactly k heads.
So that's the probability
of a particular
sequence with k heads.
So now let's ask the question,
what is the probability that
my experiment results in exactly
k heads, but in some
arbitrary order?
So the heads could
show up anywhere.
So there's a number
of different ways
that this can happen.
What's the overall probability
that this event takes place?
So the probability of an event
taking place is the sum of the
probabilities of all the
individual ways that
the event can occur.
So it's the sum of the
probabilities of all the
outcomes that make
the event happen.
The different ways that we can
obtain k heads are the number
of different sequences that
contain exactly k heads.
We just figured out that any
sequence with exactly k heads
has this probability.
So to do this summation, we just
need to take the common
probability of each individual
k head sequence, times how
many terms we have
in this sum.
So what we're left to do now
is to figure out how many k
head sequences are there.
How many outcomes are there in
which we have exactly k heads.
OK.
So what are the ways that I can
describe to you a sequence
with k heads?
I can take my n slots
that corresponds to
the different tosses.
I'm interested in particular
sequences that
have exactly k heads.
So what I need to do is to
choose k slots and assign
heads to them.
So to specify a sequence that
has exactly k heads is the
same thing as drawing this
picture and telling you which
are the k slots that happened
to have heads.
So I need to choose out of those
n slots, k of them, and
assign them heads.
In how many ways can I
choose this k slots?
Well, it's the question of
starting with a set of n slots
and choosing k slots out
of the n available.
So the number of k head
sequences is the same as the
number of k element subsets of
the set of slots that we
started with, which are
the n slots 1 up to n.
We know what that number is.
We counted, before, the number
of k element subsets, starting
with a set with n elements.
And we gave a symbol to that
number, which is that
thing, n choose k.
So this is the final answer
that we obtain.
So these are the so-called
binomial probabilities.
And they gave us the
probabilities for different
numbers of heads starting with
a fair coin that's being
tossed a number of times.
This formula is correct, of
course, for reasonable values
of k, meaning its correct for
k equals 0, 1, up to n.
If k is bigger than n, what's
the probability of k heads?
If k is bigger than n, there's
no way to obtain k heads, so
that probability is,
of course, zero.
So these probabilities only
makes sense for the numbers k
that are possible, given
that we have n tosses.
And now a question similar
to the one we had in
the previous slide.
If I write down this
summation--
even worse algebra than the one
in the previous slide--
what do you think this number
will turn out to be?
It should be 1 because this
is the probability
of obtaining k heads.
When we do the summation, what
we're doing is we're
considering the probability of
0 heads, plus the probability
of 1 head, plus the probability
of 2 heads, plus
the probability of n heads.
We've exhausted all the
possibilities in our
experiment.
So the overall probability,
when you exhaust all
possibilities, must
be equal to 1.
So that's yet another beautiful
formula that
evaluates into something
really simple.
And if you tried to prove this
identity algebraically, of
course, you would have to
suffer quite a bit.
So now armed with the binomial
probabilities, we can do the
harder problems.
So let's take the same
experiment again.
We flip a coin independently
10 times.
So these 10 tosses
are independent.
We flip it 10 times.
We don't see the result, but
somebody comes and tells us,
you know, there were exactly
3 heads in the 10
tosses that you had.
OK?
So a certain event happened.
And now you're asked to find
the probability of another
event, which is that the first
2 tosses were heads.
Let's call that event A. OK.
So are we in the setting
of discrete
uniform probability laws?
When we toss a coin multiple
times, is it the case that all
outcomes are equally likely?
All sequences are
equally likely?
That's the case if you
have a fair coin--
that all sequences are
equally likely.
But if your coin is not fair,
of course, heads/heads is
going to have a different
probability than tails/tails.
If your coin is biased towards
heads, then heads/heads is
going to be more likely.
So we're not quite in
the uniform setting.
Our overall sample space, omega,
does not have equally
likely elements.
Do we care about that?
Not necessarily.
All the action now happens
inside the event B that we are
told has occurred.
So we have our big sample
space, omega.
Elements of that sample space
are not equally likely.
We are told that a certain
event B occurred.
And inside that event B, we're
asked to find the conditional
probability that A has
also occurred.
Now here's the lucky thing,
inside the event B, all
outcomes are equally likely.
The outcomes inside B are the
sequences of 10 tosses that
have exactly 3 heads.
Every 3-head sequence has
this probability.
So the elements of
B are equally
likely with each other.
Once we condition on the event
B having occurred, what
happens to the probabilities
of the different outcomes
inside here?
Well, conditional probability
laws keep the same proportions
as the unconditional ones.
The elements of B were equally
likely when we started, so
they're equally likely once we
are told that B has occurred.
So to do with this problem, we
need to just transport us to
this smaller universe and think
about what's happening
in that little universe.
In that little universe,
all elements of
B are equally likely.
So to find the probability of
some subset of that set, we
only need to count the
cardinality of B, and count
the cardinality of A.
So let's do that.
Number of outcomes in B--
in how many ways can we get
3 heads out of 10 tosses?
That's the number we considered
before, and
it's 10 choose 3.
This is the number of
3-head sequences
when you have 10 tosses.
Now let's look at the event A.
The event A is that the first
2 tosses where heads, but we're
living now inside this
universe B. Given that B
occurred, how many elements
does A have in there?
In how many ways can A happen
inside the B universe.
If you're told that the
first 2 were heads--
sorry.
So out of the outcomes in B that
have 3 heads, how many
start with heads/heads?
Well, if it starts with
heads/heads, then the only
uncertainty is the location
of the third head.
So we started with heads/heads,
we're going to
have three heads, the question
is, where is that third head
going to be.
It has eight possibilities.
So slot 1 is heads, slot 2 is
heads, the third heads can be
anywhere else.
So there's 8 possibilities
for where the third
head is going to be.
OK.
So what we have counted here is
really the cardinality of A
intersection B, which is out of
the elements in B, how many
of them make A happen, divided
by the cardinality of B. And
that gives us the answer, which
is going to be 10 choose
3, divided by 8.
And I should probably redraw a
little bit of the picture that
they have here.
The set A is not necessarily
contained in B. It could also
have stuff outside B. So the
event that the first 2 tosses
are heads can happen with a
total of 3 heads, but it can
also happen with a different
total number of heads.
But once we are transported
inside the set B, what we need
to count is just this part of
A. It's A intersection B and
compare it with the total number
of elements in the set
B. Did I write it the
opposite way?
Yes.
So this is 8 over 10 choose 3.
OK.
So we're going to close with a
more difficult problem now.
OK.
This business of n choose k has
to do with starting with a
set and picking a subset
of k elements.
Another way of thinking of that
is that we start with a
set with n elements and you
choose a subset that has k,
which means that there's n
minus k that are left.
Picking a subset is the same as
partitioning our set into
two pieces.
Now let's generalize this
question and start counting
partitions in general.
Somebody gives you a set
that has n elements.
Somebody gives you also
certain numbers--
n1, n2, n3, let's say,
n4, where these
numbers add up to n.
And you're asked to partition
this set into four subsets
where each one of the subsets
has this particular
cardinality.
So you're asking to cut it into
four pieces, each one
having the prescribed
cardinality.
In how many ways can we
do this partitioning?
n choose k was the answer when
we partitioned in two pieces,
what's the answer
more generally?
For a concrete example of a
partition, you have your 52
card deck and you deal, as in
bridge, by giving 13 cards to
each one of the players.
Assuming that the dealing is
done fairly and with a well
shuffled deck of cards, every
particular partition of the 52
cards into four hands, that is
four subsets of 13 each,
should be equally likely.
So we take the 52 cards and we
partition them into subsets of
13, 13, 13, and 13.
And we assume that all possible
partitions, all
possible ways of dealing the
cards are equally likely.
So we are again in a setting
where we can use counting,
because all the possible
outcomes are equally likely.
So an outcome of the experiment
is the hands that
each player ends up getting.
And when you get the cards in
your hands, it doesn't matter
in which order that
you got them.
It only matters what cards
you have on you.
So it only matters which subset
of the cards you got.
All right.
So what's the cardinality of
the sample space in this
experiment?
So let's do it for the concrete
numbers that we have
for the problem of partitioning
52 cards.
So think of dealing as follows--
you shuffle the deck
perfectly, and then you take the
top 13 cards and give them
to one person.
In how many possible hands are
there for that person?
Out of the 52 cards, I choose 13
at random and give them to
the first person.
Having done that, what
happens next?
I'm left with 39 cards.
And out of those 39 cards, I
pick 13 of them and give them
to the second person.
Now I'm left with 26 cards.
Out of those 26, I choose 13,
give them to the third person.
And for the last person there
isn't really any choice.
Out of the 13, I have to give
that person all 13.
And that number is
just equal to 1.
So we don't care about it.
All right.
So next thing you do is to write
down the formulas for
these numbers.
So, for example, here you
would have 52 factorial,
divided by 13 factorial,
times 39
factorial, and you continue.
And then there are nice
cancellations that happen.
This 39 factorial is going to
cancel the 39 factorial that
comes from there, and so on.
After you do the cancellations
and all the algebra, you're
left with this particular
answer, which is the number of
possible partitions of 52 cards
into four players where
each player gets exactly
13 hands.
If you were to generalize this
formula to the setting that we
have here, the more general
formula is--
you have n factorial, where n is
the number of objects that
you are distributing, divided
by the product of the
factorials of the--
OK, here I'm doing it for
the case where we split
it into four sets.
So that would be the answer when
we partition a set into
four subsets of prescribed
cardinalities.
And you can guess how that
formula would generalize if
you want to split it into
five sets or six sets.
OK.
So far we just figured out the
size of the sample space.
Now we need to look at our
event, which is the event that
each player gets an ace, let's
call that event A. In how many
ways can that event happens?
How many possible hands are
there in which every player
has exactly one ace?
So I need to think about the
sequential process by which I
distribute the cards so that
everybody gets exactly one
ace, and then try to think
in how many ways can that
sequential process happen.
So one way of making sure that
everybody gets exactly one ace
is the following--
I take the four aces and I
distribute them randomly to
the four players, but making
sure that each one gets
exactly one ace.
In how many ways can
that happen?
I take the ace of spades and I
send it to a random person out
of the four.
So there's 4 choices for this.
Then I'm left with 3
aces to distribute.
That person already
gotten an ace.
I take the next ace, and
I give it to one of
the 3 people remaining.
So there's 3 choices
for how to do that.
And then for the next ace,
there's 2 people who have not
yet gotten an ace,
and they give it
randomly to one of them.
So these are the possible ways
of distributing for the 4
aces, so that each person
gets exactly one.
It's actually the same
as this problem.
Starting with a set of four
things, in how many ways can I
partition them into four subsets
where the first set
has one element, the second has
one element, the third one
has another element,
and so on.
So it agrees with that formula
by giving us 4 factorial.
OK.
So there are different ways
of distributing the aces.
And then there's different
ways of distributing the
remaining 48 cards.
How many ways are there?
Well, I have 48 cards that I'm
going to distribute to four
players by giving 12
cards to each one.
It's exactly the same question
as the one we had here, except
that now it's 48 cards,
12 to each person.
And that gives us this
particular count.
So putting all that together
gives us the different ways
that we can distribute the cards
to the four players so
that each one gets
exactly one ace.
The number of possible ways
is going to be this four
factorial, coming from here,
times this number--
this gives us the number of
ways that the event of
interest can happen--
and then the denominator is the
cardinality of our sample
space, which is this number.
So this looks like
a horrible mess.
It turns out that this
expression does simplify to
something really,
really simple.
And if you look at the textbook
for this problem, you
will see an alternative
derivation that gives you a
short cut to the same
numerical answer.
All right.
So that basically concludes
chapter one.
From next time we're going to
consider introducing random
variables and make the subject
even more interesting.
