Let A and B be two finite sets, with ∣A∣=m and ∣B∣=n. How many distinct functions (mappings)
can you define from set A to set B, f:A→B?
Solution
We can solve this problem using the multiplication principle. Let
A={a1,a2,a3,...,am},
B={b1,b2,b3,...,bn}.
Note that to define a mapping from A to B, we have n options for
f(a1), i.e., f(a1)∈B={b1,b2,b3,...,bn}. Similarly we have n options for
f(a2), and so on. Thus by the multiplication principle, the total number of distinct
functions f:A→B is
n⋅n⋅n⋯n=nm.
Problem
A function is said to be one-to-one if for all x1=x2, we have f(x1)=f(x2). Equivalently,
we can say a function is one-to-one if whenever f(x1)=f(x2), then x1=x2. Let A and B be two finite
sets, with ∣A∣=m and ∣B∣=n. How many distinct one-to-one functions (mappings) can you define from set A
to set B, f:A→B?
Solution
Again let
A={a1,a2,a3,...,am},
B={b1,b2,b3,...,bn}.
To define a one-to-one mapping from A to B, we have n options for f(a1), i.e.,
f(a1)∈B={b1,b2,b3,...,bn}. Given f(a1), we have n−1 options for f(a2),
and so on. Thus by the multiplication principle, the total number of distinct functions
f:A→B, is
n⋅(n−1)⋅(n−2)⋯(n−m+1)=Pmn.
Thus, in other words, choosing a one-to-one function from A to B is equivalent to choosing
an m-permutation from the n-element set B (ordered sampling without replacement) and as
we have seen there are Pmn ways to do that.
Problem
An urn contains $30$ red balls and $70$ green balls. What is the probability of getting exactly k red balls
in a sample of size $20$ if the sampling is done with replacement (repetition allowed)? Assume
$0\leq k \leq 20$.
Solution
Here any time we take a sample from the urn we put it back before the next sample (sampling with
replacement). Thus in this experiment each time we sample, the probability of choosing a red ball
is 10030, and we repeat this in $20$ independent trials. This is exactly the binomial
experiment. Thus, using the binomial formula we obtain
P(k red balls)=(k20)(0.3)k(0.7)20−k.
Problem
An urn consists of $30$ red balls and $70$ green balls. What is the probability of getting exactly k
red balls in a sample of size $20$ if the sampling is done without replacement (repetition not allowed)?
Solution
Let A be the event (set) of getting exactly k red balls. To find P(A)=∣S∣∣A∣, we
need to find ∣A∣ and ∣S∣. First, note that ∣S∣=(20100). Next, to find ∣A∣,
we need to find out in how many ways we can choose k red balls and $20-k$ green balls.
Using the multiplication principle, we have
∣A∣=(k30)(20−k70).
Thus, we have
P(A)=(20100)(k30)(20−k70).
Problem
Assume that there are k people in a room and we know that:
k=5 with probability 41;
k=10 with probability 41;
k=15 with probability 21.
What is the probability that at least two of them have been born in the same month?
Assume that all months are equally likely.
Given that we already know there are at least two people that celebrate their birthday
in the same month, what is the probability that k=10?
Solution
The first part of the problem is very similar to the birthday problem, one
difference here is that here n=12 instead of $365$. Let Ak be the event that
at least two people out of k people have birthdays in the same month. We have
P(Ak)=1−12kPk12,for k∈{2,3,4,...,12}
Note that P(Ak)=1 for k>12. Let A be the event that at least two people in the
room were born in the same month. Using the law of total probability, we have
P(A)
=41P(A5)+41P(A10)+21P(A15)
=41(1−125P512)+41(1−1210P1012)+21.
The second part of the problem asks for P(k=10∣A). We can use Bayes' rule to write
P(k=10∣A)
=P(A)P(A∣k=10)P(k=10)
=4P(A)P(A10)
=(1−125P512)+(1−1210P1012)+21−1210P1012.
Problem
How many distinct solutions does the following equation have?
We already know that in general the number of solutions to the equation
x1+x2+...+xn=k, where xi∈{0,1,2,3,...}
is equal to
(kn+k−1)=(n−1n+k−1).
We need to convert the restrictions in this problem to match this general form.
We are given that x1∈{1,2,3..}, so if we define
y1=x1−1,
then y1∈{0,1,2,3,...}. Similarly define y2=x2−2, so y2∈{0,1,2,3,...}.
Now the question becomes equivalent to finding the number of solutions to the equation
y1+1+y2+2+x3+x4=100, where y1,y2,x3,x4∈{0,1,2,3,...},
or equivalently, the number of solutions to the equation
y1+y2+x3+x4=97, where y1,y2,x3,x4∈{0,1,2,3,...}.
As we know, this is equal to
(34+97−1)=(3100).
Problem (The matching problem)
Here is a famous problem: N guests arrive at a party. Each person is wearing a hat. We collect all
hats and then randomly redistribute the hats, giving each person one of the N hats randomly.
What is the probability that at least one person receives his/her own hat?
Hint: Use the inclusion-exclusion principle.
Solution
Let Ai be the event that i'th person receives his/her own hat. Then we are interested in
finding P(E), where E=A1∪A2∪A3∪...∪AN. To find P(E), we use the
inclusion-exclusion principle. We have
We are done. It is interesting to note what happens when N becomes large. To see
that, we should remember the Taylor series expansion of ex. In particular,
ex=1+1!x+2!x2+3!x3+...
Letting x=−1, we have
e−1=1−1!1+2!1−3!1+...
Thus, we conclude that as N becomes large, P(E) approaches $1-\frac{1}{e}$.