2022 Permutation and Combination
2022 Permutation and Combination
by 2401:4900:5959:71f2:ace8:7eff:febd:ff on 10/06/24. Re-use and distribution is strictly not permitted, except for Open Access articles.
Chapter 1
1.1. Introduction
We start this journey through probability with an exploration of various
approaches to do counting. Why? To make a long story short, say we would
like to find the likelihood of the occurrence of a given event, call it event E,
of interest. Let m be the number of scenarios that are constituents of E and
n be the total number of possible scenarios in the experiment of interest.
Assume that all scenarios are equally likely to occur. Then it is reasonable
to assert that the probability E occurs is given by P (E) = m/n. For example,
we consider a simple experiment involving drawing a card from a standard
card deck. Let E denote the event of getting a spade. Then we see that
P (E) = 13/52 as there are 13 spades in a card deck of 52 cards. Probabilistic
problems at times can be involved and tricky. If we can master our expertise
in counting, then many times finding probability amounts to counting with
respect to figuring out the numerator m and the denominator n of P (E).
1.2. Permutations
Assume that there are n distinguishable items. We would like to line them
up. How many ways can this be done? So we do this methodically. For the
first spot, any one of the n items can occupy the spot. Once that is done, we
move to the second spot. There are n − 1 remaining items. Any one of the
n − 1 remaining items can occupy the second spot. We reiterate the process
till we reach the last spot. There is only one remaining item. Thus there is
1
April 10, 2022 16:16 An Introduction to Probability: With Mathematica 9.61in x 6.69in b4410-ch01 page 2
one possibility. To summarize, the total number of ways to line these n items
up is given by
n × (n − 1) × (n − 2) × · · · × 2 × 1 ≡ n!.
by 2401:4900:5959:71f2:ace8:7eff:febd:ff on 10/06/24. Re-use and distribution is strictly not permitted, except for Open Access articles.
n!
(n)k ≡ n × (n − 1) × · · · × (n − k + 1) =
(n − k)!
ways to do this. We see that the order of selection matters and each item can
be selected only once. The notation (n)k is sometimes called k−permutation.
Example 2. Suppose we want to use 26 alphabets to make license plates
that only display 6 alphabets Assume alphabets are not allowed to be
repeated. How many license plates are possible?
Assume for the moment all n items were distinguishable. If so, there
would be n! ways to permute them. Since items in the same group are
not distinguishable, there are n1 ! × n2 ! × · · · × nk ! duplicates, i.e., being
counted n1 ! × n2 ! × · · · × nk ! times as duplicates. Thus, in actuality, the
by 2401:4900:5959:71f2:ace8:7eff:febd:ff on 10/06/24. Re-use and distribution is strictly not permitted, except for Open Access articles.
plaque with five places. How many distinct arrangements are there: (a) If
alphabets are distinguishable and numerals are distinguishable, and (b) if
alphabets are indistinguishable and so are the numerals?
(a) If alphabets and numerals are all distinguishable. Then there are 5! =
120 ways to permute them.
(b) If the alphabets are indistinguishable and so are the numerals, we remove
the indistinguishable duplicates for both cases. Hence
5!
= 10.
3!2!
Solution. Assuming for the moment the three P ’s and two E’s were
distinguishable. Then we would have 6! = 720 ways to permute them. Since
the three P ’s and two E’s are actually indistinguishable, we remove these
two sets of duplicates from the earlier permutations. Therefore, the number
of distinct letter arrangements is
6!
= 60.
2!3!
In Illustration 1, we use Mathematica to replicate the computation.
April 10, 2022 16:16 An Introduction to Probability: With Mathematica 9.61in x 6.69in b4410-ch01 page 4
1.3. Combinations
Suppose we have n distinguishable items from which we will choose r of
them. How many ways can it be done? As an example, we have a class of 32
by 2401:4900:5959:71f2:ace8:7eff:febd:ff on 10/06/24. Re-use and distribution is strictly not permitted, except for Open Access articles.
students and want to select 5 of them to form a basketball teams. How many
selections are there? We can come up with an answer by first approaching it
from a permutation perspective. We have r spots to be filled from a potential
of n candidates. Thus there are
n!
(n)r = n × (n − 1) × · · · × (n − r + 1) =
(n − r)!
An Introduction to Probability Downloaded from www.worldscientific.com
ways to fill the r spots. Since in actuality, the order with which a spot gets
filled with a candidate is irrelevant. Thus the above count contains r! of
duplicates. Hence, the number of distinguishable choices is given by
(n)r n! n
= ≡ .
r! (n − r)!r! r
n
The term r is commonly used as the notation for combinations.
32 32!
Solution. There are 7 = 7!25! = 3, 365 , 856 ways to form such a
committee.
The expansion involves the filling of the n spots with x’s and y’s. Thus,
a typical term involves xk y n−k , i.e., x shows up x times and y shows up n − x
times. For the term xk y n−k , out of the n spots, k of which will be occupied
by x’s. Thus, for this particular terms, there are nk ways to make such a
selection. Since x can be selected from 0 to n times, we conclude that
n
n
(x + y) = n
xk y n−k .
k
k=0
April 10, 2022 16:16 An Introduction to Probability: With Mathematica 9.61in x 6.69in b4410-ch01 page 5
n
The above also suggests the term k is sometimes called the binomial
coefficient.
by 2401:4900:5959:71f2:ace8:7eff:febd:ff on 10/06/24. Re-use and distribution is strictly not permitted, except for Open Access articles.
n1 × n2 × · · · × nk .
n1 × n2 × · · · × nk .
Solution. There are (13) × (12) = 156 ways two diamonds can be
drawn.
April 10, 2022 16:16 An Introduction to Probability: With Mathematica 9.61in x 6.69in b4410-ch01 page 6
Solution. One way to start a seating plan is to have a boy occupying the
An Introduction to Probability Downloaded from www.worldscientific.com
leftmost position. Following this, there are 4! ways to seat the boys and then
4! to seat the girls. Similarly, another way is to have a girl occupying the
leftmost position. Again, there are 4! ways to seat the girls and then 4! to
seat the boys. These two components form a partition of all the possible
outcomes. Thus the total number of seating arrangements is
Example 13. How many 3 digit area codes can be formed while allowing
at most two of the digits assuming the same value?
Solution. We see that there are 103 possible outcomes without any
by 2401:4900:5959:71f2:ace8:7eff:febd:ff on 10/06/24. Re-use and distribution is strictly not permitted, except for Open Access articles.
exclusion. Now there are 10 × 9 × 8 cases with all three digits being different.
Thus the difference yields the needed answer, i.e., 103 − 10 × 9 × 8 = 280.
Solution. (a) We have 15 spots, each spot can assume 2×3 = 6 attributes.
Thus the total number of outcomes is 156 .
(b) The number of outcomes associated with “none is high school educated”
is 153 . Thus the number of possible outcomes if at least one of the chosen is
high school educated is 156 − 153 .
Solution. We first consider books dealing with the same subject a collection.
There are three collections — hence 3! ways to arrange them. Within the
three collections, there are 4!, 5!, and 8! ways to permute them, respectively.
Therefore the total number ways to arrange the books is
n+1 1 n 1 n n n
= + = + .
r 1 r−1 0 r r−1 r
The left side is about the number of ways to select r items from n + 1 items.
To establish the equivalent right side, we argue
n that
a specific item is either
An Introduction to Probability Downloaded from www.worldscientific.com
Assume that an urn contains n white and m black balls. When we remove
r balls from the urn, a part of which, say i, will be white balls and the
remaining r − i balls will be black balls where i = 0, . . . , r. The left side of the
last equality gives the number of possible such selections when considered in
aggregate. The right side of it gives the result when we sum over all possible
scenarios leading to the same objective. Other identities can be obtained in
similar manner without resorting to a brute-force work involving the factorial
notation.
We now introduce the multinomial coefficient. Let n1 + · · · + nk = n. We
define
n n!
= .
n1 , . . . , nk n1 !n2 ! · · · nk !
15 15!
Solution. (a) There are 5,5,5 = 5!5!5! = 756, 756 possible selections.
(b) We can first form a group of three teams using the result obtained in
part (a). We then assign a team name to each one of the three teams so
chosen. There are 3! ways to do so. In conclusion, there are 756, 756 × 6 =
4, 540 , 536 possible arrangements. We also use of the “Multinomial” function
of Mathematica in Illustration 2 to do part (a).
Example 17 (Multinomial Expansion). We want to expand (x1 + x2 +
· · · + xk )n .
The expansion involves the filling of the n spots with x1 ’s, x2 ’s, . . . ,
and xk ’s. Thus a typical term involves xn1 1 xn2 2 · · · xnk k , i.e., x1 shows up n1
times, x2 shows up n2 times, . . . , and xk shows up nk times. For the term
xn1 1 xn2 2 · · · xnk k , out of the n spots, n1 of which will be occupied by x1 ’s, n2 of
which will be occupied by x2 ’s, and so on. We use the multinomial coefficients
to account for the multiplier associated with each product term. This gives
the needed expansion:
n
n
(x1 + x2 + · · · + xk ) = n
xn1 xn2 · · · xnk k . (1.1)
n1 , n2 , ..., nk 1 2
(n1 ,...,nk ):
n1 +···+nk =n
ni =0,1,2,...,n
Following Polya: look at an easily solvable problem, solve it, and develop
some insights for solving the original problem.
We start with a small example. Consider n = 5 and r = 3. In this case,
we can enumerate the solution:
by 2401:4900:5959:71f2:ace8:7eff:febd:ff on 10/06/24. Re-use and distribution is strictly not permitted, except for Open Access articles.
1,1,3 0#0#000
1,2,2 0#00#00
1,3,1 0#000#0
2,1,2 00#0#00
2,2,1 00#00#0
3,1,1 000#0#0
An Introduction to Probability Downloaded from www.worldscientific.com
In the above table, we place our enumerated results in the first column. Thus
we know the answer is 6, namely, there are 6 ways the 5 balls can be put
into the three urns. Now we look for hints that would lead us to the solution.
Assume that the 5 balls, each marked as “0”, are lined up. There are four
“gaps” between to five “0”. We choose any two such gaps and fill each one of
them with a marker “#”. By doing so, the five “0” are being split into three
groups. The numbers of 0’s in the three demarcated groups corresponds to
the numbers of balls in the respective urns. This is clearly illustrated in the
second column of the above tally. Thus there is one-to-one correspondence
between the placements of markers and the resulting solution. The number
of ways this can be done is given by
n−1 5−1 4
= = =6
r−1 3−1 2
We have just solve the following general problem: Let xi = the number
of balls in urn i. Assume x1 + · · · + xr . = n and we require xi ≥ 1 for each i.
Then the number of vectors (x1 , . . . , xr ) that satisfies the stated conditions is
n−1
.
r−1
y1 + · · · + yr = n,
yi ≥ 0.
(x1 − 1) + · · · + (xr − 1) = n,
by 2401:4900:5959:71f2:ace8:7eff:febd:ff on 10/06/24. Re-use and distribution is strictly not permitted, except for Open Access articles.
xi − 1 ≥ 0
or equivalently
x1 + · · · + xr = n + r,
xi ≥ 1 for each i.
An Introduction to Probability Downloaded from www.worldscientific.com
n+r−1
But the answer for this version is r−1 . Hence the problem is solved.
Example 18. A person plan to leave 10 million dollars to her four children.
Her favorite child should receive at lease 3 million dollars. How many ways
the inheritance can be divided among the four children. Assume that each
child should receive at least 1 million dollars.
y1 + · · · + y4 = 10,
y1 = 3, 4, . . . ,
y2 , y3 , y4 = 1, 2, . . . .
(x1 + 2) + x2 + x3 + x4 = 10,
xi ≥ 1 for each i
or
x1 + · · · + x4 = 8
x1 ≥ 1 for each i.
8+4−1
Thus, the number of ways the inheritance can be allocated is 4−1 =
11
3 = 165.
April 10, 2022 16:16 An Introduction to Probability: With Mathematica 9.61in x 6.69in b4410-ch01 page 12
(∗)
Consider the term marked by (*), x21 x2 x3 . Assume that we have 4 “1’s” to
be placed in three slots indexed by 1, 2, and 3, where 4 is the exponent
shown at the left hand side of (1.2). We envision that two “1’s” are placed
in slot 1, one “1” in slot 2, and one “1” in slot 3, For the each “1” we assign
a value of one to the corresponding xi . For this specific term, we end up in
(1.2) having x21 = 1 · 1 = 1, x12 = 1, and x13 = 1. We notice that for the
three exponents of the term x21 x2 x3 can be represented by an ordered triplet
(n1 , n2 , n3 ) = (2, 1, 1). Now its coefficient in associated with this term in
(1.2) represents the number of ways the 4 “1’s” can be distributed to form
4
the pattern (2, 1, 1), namely, 2,1,1 = 12.
Following the above line of argument, we consider the case where we have
4 indistinguishable balls to be randomly distributed to three urns. If we are
interested in the number of cases where we observe the ordered pattern (2, 2,
0), then the coefficient associated with the term x21 x22 gives the answer. It is
6. On the other hand, if we are interested in the number of cases of unordered
pattern (2, 2, 0), the sum of the coefficients associated with the terms x21 x22 ,
x21 x23 , and x22 x23 yields 18. Extracting these coefficients from a polynomial
can easily be done using Mathematica. This is shown in Illustration 3.
In this example, when we set all {xi } to 1, then it give
4
= 81.
n1 , n2 , n3
(n1 ,n2 ,n3 )
n1 +n2 +n3 =4
ni =0,1,... ∀i
April 10, 2022 16:16 An Introduction to Probability: With Mathematica 9.61in x 6.69in b4410-ch01 page 13
Solution. We set the polynomial as it has just been suggested (x1 +x2 +x3 )4 .
We sum over the coefficients associated with the terms x21 x22 , x21 x23 , and x22 x23
in the expansion. In Illustration 3, we find that it is 18 — as expected.
Example 20. An elevator starts from the basement of a four-story condo
with 7 seven passengers on board. Assume that passengers will leave for the
four floors randomly and there are no one enters the elevator for this ride
towards the top floor. (a) What is the number ways, denote it by n(E), that
all passengers get discharged from the elevator and there are four passengers
leave for the third floor? (b) What is the number ways, denote it by n(S),
that all passengers get discharged from the elevator?
(x1 + x2 + x3 + x4 + x5 + x6 ).
by 2401:4900:5959:71f2:ace8:7eff:febd:ff on 10/06/24. Re-use and distribution is strictly not permitted, except for Open Access articles.
We envision that in each roll of the die, if it lands a number “i,” then an “1”
is tosses into slot i whose exponent is i. The exponent counts the number
resulting from the roll. If we sum up all coefficients associated with the
above polynomial expansion with their exponents being 20. It gives the value
of n.
An Introduction to Probability Downloaded from www.worldscientific.com
Illustration 3. The number of terms involving x21 x22 , x21 x23 , x22 x23 in a
polynomial expansion of (x1 + x2 + x3 )4 as stated in Example 19.
An Introduction to Probability Downloaded from www.worldscientific.com
Problems
1. In how many ways can 5 boys and 5 girls be seated around a round
table so that no two boys sit next to each other?
2. In how many ways can a lady having 10 dresses, 5 pairs of shoes, and 2
hats be dressed?
3. In how many ways can we place in a bookcases with two works each of
three volumes and two works each of four volumes, so that the volume
of the same work are not separated?
4. In how many ways can r indistinguishable objects be distributed to n
persons if there is no restriction on the number of objects that a person
may receives?
5. In how many ways can r distinguishable objects be distributed to n
persons if there is no restriction on the number of objects that a person
may receive?
6. Eight points are chosen on the circumference of a circle. (a) How many
chords can be drawn by joining these point in all possible ways? If the
April 10, 2022 16:16 An Introduction to Probability: With Mathematica 9.61in x 6.69in b4410-ch01 page 16
10. How many ways can 5 history books, 3 math books, and 4 novels be
arranged on a shelf if books of each type must be together?
11. Twelve different toys are to be divided among 3 children so that each
one gets 4 toys. How many ways can this be done?
12. How many ways can 4 men and 4 woman can sit in a row if no two men
or two women sit next to each others?
13. (a) In how many ways can 4 boys and 4 girls sit in a row? (b) In how
many ways can 4 boys and 4 girls sit in a row if boys and girls are each
to sit together? (c) In how many ways if only boys must sit together?
(d) In how many ways if no two people of the same gender are allowed
to sit together?
14. How many 3 digit numbers xyz with x, y, z all ranging from 0 to 9 have
at least 2 of their digits equal? (b) How many have exactly 2 equal
digits?
15. We have $20,000 that must be invested among 4 possible opportunities.
Each investment must be integral in units of $1,000. If an investment is
to be made in a given opportunity at all, then the minimal amounts
to be invested in the each one of the four investments are $2,000,
$2,000, $3,000, and $4,000, respectively. How many different investment
strategies are available if
(a) An investment must be made in each opportunity?
(b) Investments must be made in at least 3 of the four
opportunities?
16. An elevator starts at the basement with 8 people (not including the
elevator operator) and discharges them all by the time it reaches the
April 10, 2022 16:16 An Introduction to Probability: With Mathematica 9.61in x 6.69in b4410-ch01 page 17
top floor, the 6th floor. In how many ways could the operator have
observed the 8 people leaving the elevator (e.g., all leave from the 1st
floor)? What if the 8 people consist of 5 men and 3 women (e.g., 2 men
leave from the 2nd floor, 1 man leaves from 3rd floor, 1 man leaves from
by 2401:4900:5959:71f2:ace8:7eff:febd:ff on 10/06/24. Re-use and distribution is strictly not permitted, except for Open Access articles.
the 5th floor, and all 3 women leave from the 6th floor)?
17. Delegates from 12 countries, including Russia, Australia, New Zealand,
and the United States, are to be seated in a row. How many different
seating arrangements are possible if the Australian and New Zealand
delegates are to be next to each other and the Russian and U.S. delegates
are not to be next to each other?
An Introduction to Probability Downloaded from www.worldscientific.com
18. A dance class consists of 22 students, of which 10 are women and 12 are
men. If 5 men and 5 women are to be chosen and then paired off, how
many results are possible?
19. A person has 8 friends, of whom 5 will be invited to a party. (a) How
many choices are there if 2 of the friends are feuding and will not attend
together? (b) How many choices are there if 2 of the friends will only
attend together?
20. If 8 identical blackboards are to be divided among 4 schools, how many
divisions are possible? How many if each school must receive at least 1
blackboard?
21. (a) In how many ways can n indistinguishable balls be put into n
numbered boxes so that exactly one box is empty? (b) In how many
ways can n distinguishable balls be put into n numbered boxes so that
exactly one box is empty?
22. A girl decides to choose either a shirt or a tie for a birthday present.
There are 3 shirts and 2 ties to choose from. (a) How many choices does
she have if she will get only one of them? (b) If she may get both a shirt
and a tie?
23. There are 3 kinds of shirts on sale. (a) If two men buy one shirt each
how many possibilities are there? (b) If two shirts are sold, how many
possibilities are there?
24. How many different initials can be formed with 2 or 3 letters of the
alphabet? How large must the alphabet be in order that one million
people can be identified by 3-letter initials?
April 10, 2022 16:16 An Introduction to Probability: With Mathematica 9.61in x 6.69in b4410-ch01 page 18
25. (a) In how many ways can 4 boys and 4 girls be paired off? (b) In how
many ways can they stand in a row in alternating gender?
26. (a) In how many ways can a committee of three be chosen from 20
by 2401:4900:5959:71f2:ace8:7eff:febd:ff on 10/06/24. Re-use and distribution is strictly not permitted, except for Open Access articles.
28. A child has 5 blocks with the letter A, 3 blocks with the letter B and
1 block with the letter C. Assuming these 9 blocks are to be randomly
lined up to form letters. How many distinct words can be formed?
29. There are 10 indistinguishable balls and 5 numbered urns. These balls
are randomly thrown into the urns. (a) How many different distributions
of balls into the urns. (b) How many different distributions of balls into
the urns provided that each urn must contain at least one ball.
30. Letters in the Morse code are formed by sending a succession of dashes
and dots with repetitions allowed. How many letters can be formed using
ten symbols or less?
31. Consider an experiment consists of determining the type of job — either
blue collar or white collar, and the political affiliation — Republican,
Democrat, or Independent — of the 15 members of an adult soccer
team (a) How many elements are in the sample space? (b) How many
elements are there when at least one of the team members is a blue-
collar worker? (c) How many elements are there when none of the team
members consider himself or herself an independent?
[3] Polya, G., How to Solve It, A Doubleday Anchor Book, 1957. (Originally published by
Princeton University Press in 1945.)
[4] Ross, S. M., A First Course in Probability, 10th edn., Pearson, 2019.
[5] Wilf, H. S., Generating functionology, Academic Press, 1990.
An Introduction to Probability Downloaded from www.worldscientific.com