Unit 5 - Counting and Discrete Probability - Complete
Unit 5 - Counting and Discrete Probability - Complete
Unit 5
5.1 Counting
1. If two cards are drawn, each from a separate deck of 52 cards, then in how many ways
can they be selected?
Solution: Here,
Since both the first and the second cards have to be drawn, so by product rule, two cards
can be drawn in k1 × k2 = 52 × 52 = 2704 ways.
2. How many 3-digit numbers can be formed using the digits 1, 3, 4, 5, 6, 8 and 9 with repe-
tition allowed and not allowed?
Solution: When repetition is allowed,
Since all three digits have to be selected to form 3-digit number, so by product rule, a
3-digit number with repetition allowed can be formed in k1 k2 k3 = 7 × 7 × 7 = 343 ways.
When repetition is not allowed,
2 × 2 × 2 × 2 × 2 × 2 = 26 = 64
4. How many bit strings of length ten begin and end with a 1?
Solution: To form a bit string of length ten that ends with a 1, there are 2 ways to select
the second to the ninth digit and 1 way to select the first and tenth digit. So using the
product rule, there are
1 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 × 1 = 256
II. The Sum Rule: Suppose that a task T can be broken into n disjoint subtasks T1 , T2 , · · · , Tn
i.e., none of the subtasks in T1 , · · · , Tn are same. Also suppose that the task T is completed
when exactly one among the subtasks T1 , · · · , Tn is completed. If the task Ti can be completed
in ki ways for each i = 1, · · · , n, then the sum rule says that the task T can be completed in
k1 + k2 + · · · + kn ways.
Examples:
1. In how many ways can one representative be chosen from classes 11 and 12 consisting of
49 and 34 students respectively?
Solution: Here
So by sum rule, number of ways to select one representative either from class 11 or class
12 is k1 + k2 = 49 + 34 = 83 ways.
2. (Example using the combined rules of sum and product) How many license plates can
be made using either two letters followed by four digits or two digits followed by four
letters?
Solution: By the product rule, the number of license plates with two letters followed by
four digits is
26 × 26 × 10 × 10 × 10 × 10 = 6760000
and the number of license plates with two digits followed by four letters is
10 × 10 × 26 × 26 × 26 × 26 = 45697600.
Since license plates can be one of these two types, so by the sum rule, the total number
of such license plates is
1. If a classroom has 8 students, then at least two of them must have birthdays on the same
weekday. To see why, consider the students as the objects and the 7 weekdays as the
boxes. Since the birthday of each of the 8 students must be on one of these 7 weekdays
and there are more students than number of weekdays, so by the pigeonhole principle,
there must be at least one weekday in which two of more students have their birthdays.
2. If any five distinct numbers are chosen from 1 to 8, then two of them must add to 9.
Explanation: There are only 4 ways to choose a pair of numbers from 1 to 8 so that they
add up to 9: {1, 8}, {2, 7}, {3, 6}, {4, 5}. Consider these as boxes. Now choose any five
numbers from 1 to 8. Consider these as objects. So there are more number of objects than
boxes. Since each of the five numbers chosen must belong to one of the above four pairs,
the pigeonhole principle tells us that two of the chosen numbers must belong to the same
pair i.e., the sum of those two numbers must be 9.
Theorem (The Generalized Pigeonhole Principle): If N objects are placed in k boxes, then
N
there is at least one box containing or more objects.
k
Proof: The proof is bycontradiction. Suppose N objects are placed in k boxes but
that none of
N N
the boxes contain or more objects i.e., all the boxes contains at most − 1 objects.
k k
N
So the total number of objects is at most k − 1 . But since dxe < x + 1 so
k
N N
k −1 <k + 1 − 1 = N.
k k
That is, the total number of objects is less than N which isfalse
because there were N number
N
of objects given. Therefore, at least one box must contain or more objects.
k
Note: If a number of objects are to be distributed in k boxes such that there is guarantee that at
least one box has m or more objects, then the minimum number of objects required is
k(m − 1) + 1.
Examples:
1. If 30 dictionaries in a library contains a total of 61327 pages, then how many minimum
pages at least one dictionary must have?
Solution: Here
2. In a group of 61 people, at least how many of them must have birthdays on the same
month?
Solution: Here,
So to guarantee that at least two students receive the same score, the class must have
minimum of k(m − 1) + 1 = 101(2 − 1) + 1 = 102 students.
4. How many numbers must be selected from the set {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} to guarantee
that at least one pair of these numbers add up to 11?
Solution: The pair of numbers that add up to 11 are {1, 10}, {2, 9}, {3, 8}, {4, 7}, {5, 6}.
So
So to guarantee that at least one pair of these numbers add up to 11, we must select
minimum of k(m − 1) + 1 = 5(2 − 1) + 1 = 6 numbers.
5. Find the minimum number of people in a group to be sure that three of them are born on
the same month.
Solution: Here,
6. Find the minimum number of students to guarantee that 50 of them obtain a same grade
where there are altogether 20 grades.
Solution: Here,
Proof: Since there are n distinct elements, the first element can be chosen in n ways. Then
there are n − 1 elements left from which the second element can be chosen i.e., there are n − 1
ways to choose the second element. Similarly, there are n − 2 ways to choose the third element
and proceeding similarly, there are n − r + 1 ways to choose the rth element. Therefore by
product rule, there are n(n − 1)(n − 2) · · · (n − r + 1) ways to choose r elements from the set
of n elements i.e.,
P (n, r) = n(n − 1)(n − 2) · · · (n − r + 1)
n(n − 1)(n − 2) · · · (n − r + 1)(n − r)! n!
= =
(n − r)! (n − r)!
Examples:
P (5, 5) = 5! = 120
ways.
3. How many permutations of the letters A, B, C, D, E, F, G, H are possible so that the letters
D, E and F are adjacent?
Solution: There are P (3, 3) = 3! ways of arranging the letters D, E and F. For each such
arrangement, there are P (6, 6) = 6! ways of arranging the letters A, B, C, G, H, X where
X denotes the arrangement of D, E, F. So there are a total of
3! × 6! = 6 × 720 = 4320
Proof: The r-permutations of the set can be obtained by first forming the C(n, r) number of
r-combinations of the set and then ordering the elements in each r-combination which can be
done in P (r, r) ways. Therefore
Pascal’s Triangle: The arrangement of the binomial coefficients in triangular form as below is
called Pascal’s triangle.
As is clearly seen in the figure above, the inner elements in each row of Pascal’s triangle is
obtained by applying the Pascal’s identity on the two elements above it.
Example:
1. How many ways are there to form a 6-member committee from 20 people?
Solution: We have
2. How many ways are there to form a 7-member committee containing 3 women and 4 men
from an available set of 20 women and 30 men?
Solution: We have,
C(10, 5) = 252.
k-th term in a binomial expansion of (x+y)n : There are altogether n+1 terms in the binomial
expansion of (x + y)n . The general term of this expansion is of the form
n
xn−r y r
r
where r can change from 0 to n. When r = 0, one gets the first term; when r = 1, one gets the
second term and so on. So the k term is obtained when r = k − 1 which is
n
xn−(k−1) y k−1 .
k−1
and
n n− n+1 n+1 n n−1 n+1
n+1 x 2 y 2 = n+1 x 2 y 2 .
2 2
n
Binomial Coefficients: The number of r-combinations of n elements i.e., occur as
r
coefficients in the expansion of the binomial expressions such as (a + b)n . Therefore such
numbers are called binomial coefficients.
Corollary 1: Let n be a nonnegative integer. Then
n
X n
= 2n .
k
k=0
n
n
X n
or, 2 = .
k
k=0
n
X
k n
Corollary 2: Let n be a positive integer. Then (−1) = 0.
k
k=0
Proof: From the binomial theorem, we know
n
n
X n
(x + y) = xn−k y k .
k
k=0
n
X n
or, 0 = (−1)k
k
k=0
n
X n
Therefore, (−1)k = 0.
k
k=0
n
X
k n
Corollary 3: Let n be a nonnegative integer. Then 2 = 3n .
k
k=0
Proof: From the binomial theorem, we have
n
n
X n
(x + y) = xn−k y k .
k
k=0
Combination with repetition: Given n distinct objects, one can take unordered arrangement
of r of those objects where those r objects are allowed to repeat. Such kind of combination is
known as r-combination with repetition.
For example, given three distinct objects a, b, c, the 2-combinations of these objects with repe-
tition allowed are aa, ab, bb, ba, cc, ca. These are C(3 + 2 − 1, 2) = C(4, 2) = 6 in number.
Theorem 2: The number of r-combinations of a set of n objects with repetition allowed is
C(n + r − 1, r).
Example:
1. Suppose that a library contains Maths, Physics and Chemistry books. If a student has to
select 6 books from the library, in how many ways can he/she do this without concerning
about the order of chosen books assuming that there are at least 6 copies of each book?
Solution: Here,
Permutation with indistinguishable objects: When there are n given objects which are not
necessarily distinct, then the permutation of those objects is called permutation with indis-
tinguishable objects. The number of possible permutations of those objects is given by the
following theorem:
Theorem 3: The number of different permutations of n objects where there are n1 indistin-
guishable objects of type 1, n2 indistinguishable objects of type 2 and so on nk indistinguishable
objects of type k, is given by
n!
.
n1 !n2 ! · · · nk !
Example:
1. How many distinct permutations can be formed from all the letters of the word EV ERGREEN ?
Solution: The total number of letters in the word EVERGREEN is n = 9 where
1. Find the first five terms of the sequence defined by the recurrence relation an = nan−1 +
a2n−2 , a0 = −1, a1 = 0.
Solution: Here, the given recurrence relation is
So
2. Determine whether the sequences {an } given below are the solutions of the recurrence
relation an = 8an−1 − 16an−2 .
a. an = 4n b. an = (−4)n c. an = 2.4n + 3n4n
Solution:
a. We have an = 4n . So an−1 = 4n−1 and an−2 = 4n−2 . Therefore
an−1 = (n − 1)2 = n2 − 2n + 1 = an − 2n + 1
and therefore
an = an−1 + 2n − 1
is the required recurrence relation.
a. an = an−1 + 3, a0 = 1
Solution: We have,
an = an−1 + 3
= (an−2 + 3) + 3 = an−2 + 2 × 3
= (an−3 + 3) + 2 × 3 = an−3 + 3 × 3
..
.
= an−n + n × 3
= a0 + 3n = 1 + 3n
Solution: We have,
an = 2nan−1
= 2n(2(n − 1)an−2 ) = 22 n(n − 1)an−2
= 22 n(n − 1)(2(n − 2)an−3 ) = 23 n(n − 1)(n − 2)an−3
..
.
= 2n n(n − 1)(n − 2) · · · [n − (n − 1)]an−n
= 2n n(n − 1)(n − 2) · · · 3.2.1.a0
= 2n n!.1 = 2n n!
1. The tower of Hanoi problem: There are three poles and n disks of different diameters
placed on the pole A. These n disks are to be moved to the pole C with same order of
arrangement of disks and obeying the following rules:
Find the number of moves required to move all n disks from pole A to pole C.
Solution: Let Hn denote the number of moves needed to solve the tower of Hanoi prob-
lem with n disks. Then to transfer n disks to pole C, we must first transfer the top n − 1
disks to pole B (this requires Hn−1 moves), transfer the remaining largest disk from pole
A to pole C (this requires 1 move) and then transfer n − 1 disks from pole B to pole C
(this again requires Hn−1 moves). Therefore,
Also, the number of moves required to transfer 1 disk from pole A to pole B is 1 i.e.,
H1 = 1. So we obtain the recurrence relation
Hn = 2Hn−1 + 1, H1 = 1.
Hn = 2Hn−1 + 1
= 2[2Hn−2 + 1] + 1 = 22 Hn−2 + 2 + 1
= 22 [2Hn−3 + 1] + 2 + 1 = 23 Hn−3 + 22 + 2 + 1
..
.
= 2n−1 Hn−(n−1) + 2n−2 + · · · + 2 + 1
= 2n−1 H1 + 2n−2 + · · · + 2 + 1
= 2n−1 + 2n−2 + · · · + 2 + 1
2n − 1
= = 2n − 1
2−1
Therefore Hn = 2n − 1.
2. Find a recurrence relation and give initial conditions for the number of bit strings of length
n that do not have two consecutive zeros.
Solution: Let an denote the number of bit strings of length n that do not have two con-
secutive zeros. Then an = bn + cn where bn is the number of bit strings of length n that
do not have two consecutive zeros and ends with a 1 and cn is the number of bit strings of
length n that do not have two consecutive zeros and ends with a 0.
Now x = x1 x2 · · · xn−1 xn is a bit string of length n ending with a 1 that does not contain
two consecutive zeros if and only if x1 x2 · · · xn−1 does not contain two consecutive zeros.
Therefore bn = an−1 . Also x = x1 x2 · · · xn−1 xn is a bit string of length n ending with a
0 that do not have two consecutive zeros if and only if xn−1 = 1 and x1 x2 · · · xn−2 does
not have two consecutive zeros. Therefore cn = bn−1 = an−2 . Hence an = bn + cn =
an−1 + an−2 . Clearly, a1 = 2 and a2 = 3 which are the required initial conditions.
an = c1 an−1 + c2 an−2
if and only if
an = α1 r1n + α2 r2n
for n = 0, 1, 2, · · · where α1 and α2 are constants.
Examples illustrating the use of Theorem 1:
1. Find the solution of the recurrence relation an = 5an−1 − 6an−2 , with a0 = 1 and a1 = 0.
Solution: Here the given recurrence relation is
an = α1 r1n + α2 r2n
or, an = α1 2n + α2 3n · · · · · · (2)
where α1 and α2 are some constants.
When n = 0, equation (2) give
a0 = α 1 + α 2
or, 1 = α1 + α2 · · · · · · (3)
When n = 1, equation (2) gives
a1 = 2α1 + 3α2
2. Find an explicit formula for Fibonacci numbers. OR Solve the recurrence relation fn =
fn−1 + fn−2 with f0 = 0 and f1 = 1.
Solution: The recurrence relation representing the Fibonacci numbers is
f0 = α1 + α2
or, 0 = α1 + α2 · · · · · · (3)
and when n = 1, equation (2) gives
√ ! √ !
1+ 5 1− 5
f 1 = α1 + α2
2 2
√ ! √ !
1+ 5 1− 5
or, 1 = α1 + α2 · · · · · · (4)
2 2
1 −1
Solving (3) and (4), we get α1 = √ and α2 = √ . (DO THE DETAILS YOURSELF)
5 5
Hence the explicit formula for the Fibonacci numbers is
√ !n √ !n
1 1+ 5 1 1− 5
fn = √ −√ .
5 2 5 2
a. an = an−1 + 6an−2 , a0 = 3, a1 = 6
b. an = 7an−1 − 10an−2 , a0 = 2, a1 = 1
c. an = 4an−2 , a0 = 0, a1 = 4
if and only if
an = α1 r1n + α2 r2n + · · · + αk rkn
for n = 0, 1, 2, · · · where α1 , α2 , · · · , αk are constants.
Examples illustrating the use of Theorem 2:
r3 − 2r2 − r + 2 = 0
or, r2 (r − 2) − 1(r − 2) = 0
or, (r2 − 1)(r − 2) = 0
or, (r − 1)(r + 1)(r − 2) = 0
So the characteristic roots are r1 = −1, r2 = 1 and r3 = 2. Therefore the solution {an }
of the recurrence relation must be of the form
an = α1 (−1)n + α2 1n + α3 2n
3 = α1 + α2 + α3 · · · · · · (3)
0 = α1 + α2 + 4α3 · · · · · · (5)
Solving (3), (4) and (5), we get α1 = −2, α2 = 6 and α3 = −1. (DO THE DETAILS
YOURSELF) Hence the solution {an } of the recurrence relation (1) is of the form
an = −2(−1)n + 6 − 2n = 2(−1)n+1 − 2n + 6.
Theorem 3:(Statement only) Let c1 and c2 be real numbers with c2 6= 0. Suppose that r2 −
c1 r − c2 = 0 has only one root r0 . A sequence {an } is a solution of the recurrence relation
an = c1 an−1 + c2 an−2
if and only if
an = r0n (α1 + α2 n)
for n = 0, 1, 2, · · · where α1 and α2 are constants.
Examples illustrating the use of Theorem 3:
1. Solve the recurrence relation an = 6an−1 − 12an−2 + 8an−3 with a0 = −5, a1 = 4 and
a2 = 88.
Solution: The given recurrence relation is
r3 − 6r2 + 12r − 8 = 0
an = c1 an−1 + c2 an−2 , a0 = d1 , a1 = d2
r2 − c1 r − c2 = 0.
STEP II: Solve the characteristic equation to find the characteristic roots r1 and r2 .
STEP III: There are two cases that arises depending upon the nature of the roots r1 and r2 .
Case A: r1 6= r2
In this case, the solution of the recurrence relation is of the form
an = α1 r1n + α2 r2n
an = (α1 + α2 n)r1n
r3 − c1 r2 − c2 r − c3 = 0.
STEP II: Solve the characteristic equation to find the characteristic roots r1 , r2 and r3 .
STEP III: There are three cases that arises depending upon the nature of the roots r1 , r2 and
r3 .
Case A: r1 , r2 and r3 are all distinct:
In this case, the solution of the recurrence relation is of the form
an = (α1 + α2 n + α3 n2 )r1n
where c1 , c2 , · · · , ck are real numbers and F (n) is a function not identically zero depending
only on n.
For example, an = an−1 + 2an−2 + n2 + n is a linear nonhomogeneous recurrence relation.
Associated homogeneous recurrence relation: Given a linear nonhomogeneous recurrence
relation
an = c1 an−1 + c2 an−2 + · · · + ck an−k + F (n),
the recurrence relation
an = c1 an−1 + c2 an−2 + · · · + ck an−k
is called the associated homogeneous recurrence relation.
For example, an = an−1 +2an−2 is the associated homogeneous recurrence relation of the linear
nonhomogeneous recurrence relation an = an−1 + 2an−2 + n2 + n.
(p)
Theorem 5: (Statement only) If {an } is a particular solution of the nonhomogeneous linear
recurrence relation with constant coefficients
I: If F (n) = p(n) where p(n) is a polynomial of degree m, then the particular solution
(p)
an is a complete polynomial (i.e., containing all the terms) of degree m as well. For
(p)
example, if F (n) = n3 + 2, then F (n) is a polynomial of degree 3 and therefore an =
c1 n3 + c2 n2 + c3 n + c4 is the particular solution where c1 , c2 , c3 , c4 are some constants.
(p)
II: If F (n) = an is an exponential function of n, then the form of particular solution an
depends upon two cases as below:
III: If F (n) = p(n)an where p(n) is a polynomial of degree m, then the form of particular
(p)
solution an again depends upon two cases as below:
Examples:
Solution: The associated homogeneous recurrence relation of the given recurrence rela-
tion is
an = −5an−1 − 6an−2 · · · · · · (2)
Solution: The associated homogeneous recurrence relation of the given recurrence rela-
(h) (h)
tion is an = −5an−1 − 6an−2 whose solution {an } is of the form an = (−1)n (α1 2n +
α2 3n ).
Since F (n) = 7n and 7 is not a characteristic root of the associated homogeneous recur-
(p)
rence relation, we let an = c7n be the particular solution of (1) where c is some constant.
Then from (1), we get
c7n = −5c.7n−1 − 6c.7n−2 + 7n
or, c72 = −5c.7 − 6c + 72
or, 49c = −35c − 6c + 49
or, 49c + 41c = 49
49
or, c =
90
(p) 49 n 7n+2
So an = 7 = is a particular solution of (1). Hence all solutions of (1) are of
90 90
the form
7n+2
an = (−1)n (α1 2n + α2 3n ) + .
90
5.3 Exercise
5. In how many ways can the letters of the word COCACOLA be arranged?
6. In how many ways can numbers on the clock face be arranged?
7. Find the number of ways in which a group of eight people can arrange themselves around
a circular table if two of them must sit together.
8. A competition distributes prizes to the top 5 players among 15 players. If two of the
players are guaranteed to be among the top five, then find the number of ways in which
the prize can be distributed among 15 players. What if two players are definitely not
going to be among the top five?
9. Compute the values of C(10, 4) and C(10, 6) using the formula.
10. Calculate C(15, 4). Hence find the value of C(15, 11) without using any calculation.
11. How many subsets of 5 elements can be made from a set with 11 distinct elements?
12. Determine the number of ways that a football team can be formed from a pool of 40
players.
13. If n is an even integer, how many bit strings are there of length n with equal number of
0’s and 1’s?
14. In how many ways can a committee consisting of three men and three women be formed
from seven men and five women?
15. In how many ways can 5 balls be chosen from an urn containing 8 red and 7 black balls
so that (i) they must all be of same color? (ii) three are red and two are black?
16. Prove that kC(n, k) = nC(n − 1, k − 1).
17. In how many ways can 5 balls be selected from a box containing red, green and blue balls
if the order in which the balls are selected does not matter and there are at least 5 balls of
each color?
8. Find the general term and the middle terms in the expansion of (2a + 3b)12 .
9
1
9. Find the middle term(s) in the expansion of 2x + 2 .
3x
15
a2
10. Find the middle terms of 2x2 − .
x
12
2 1
11. Find the term independent of x in the expansion of x + .
x
9
1
12. Find the term independent of x in the expansion of 2x + 2 .
3x
2 9
3x 1
13. Find the term independent of x in the expansion of − .
2 3x
n
X n
14. Use the binomial theorem to prove 2k = 3n .
k
k=0
6
15. Find the expansion of (1 + 2x) using Pascal’s triangle.
16. Find the expansion of (2x − 3)5 using Pascal’s triangle.
(d) an = nan−1 , a0 = 5.
(e) an = an−1 + 2, a0 = 3
(f) an = an−1 + 3n , a0 = 1.
(g) an = an−1 + n2 , a0 = 7
(h) an = ran−1 + s where r and s are constants.
111
(i) Pn = Pn−1 , P0 = 10, 000
100
(j) Hn = 2Hn−1 + 1, H1 = 1