0% found this document useful (0 votes)
45 views41 pages

Solved Exercises

The document provides solutions to various counting problems involving positive integers between given ranges. It uses principles of divisibility and the floor function to determine the number of integers divisible by given factors, as well as the inclusion-exclusion principle to count integers divisible by multiple factors. Sample problems include counting integers between 1000 and 9999 that have distinct digits (4536) and integers between 100 and 999 that are divisible by 3 or 4 (450).

Uploaded by

Ali Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views41 pages

Solved Exercises

The document provides solutions to various counting problems involving positive integers between given ranges. It uses principles of divisibility and the floor function to determine the number of integers divisible by given factors, as well as the inclusion-exclusion principle to count integers divisible by multiple factors. Sample problems include counting integers between 1000 and 9999 that have distinct digits (4536) and integers between 100 and 999 that are divisible by 3 or 4 (450).

Uploaded by

Ali Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

NABEEL MUJAHID

MPHIL-21-34
CH # 04: COUNTING
SECTION 4.1 The Basics of Counting

Q # 18 (22):
How many positive integers less than 1000
a) are divisible by 7?
b) are divisible by 7 but not by 11?
c) are divisible by both 7 and 11?
d) are divisible by either 7 or 11?
e) are divisible by exactly one of 7 and 11?
f) are divisible by neither 7 nor 11?
g) have distinct digits?
h) have distinct digits and are even?

Solution:
a) Every seventh number is divisible by 7. Therefore,
999
(Numbers divisible by 7) = 𝐴1 = ⌊ ⌋ = 142
7

Note that we use the floor function, because the 𝑘 𝑡ℎ multiple of 7 does not occur until the
number 7k has been reached.
b) For solving this part and the next four parts, we need to use the principle of inclusion–
exclusion. Just as in part (a),
999
(Numbers divisible by 11) = 𝐴2 = ⌊ 11 ⌋ = 90
999
(Numbers divisible by both 7 and 11) = |𝐴1 ⋂𝐴2 | = ⌊ 77 ⌋ = 12 (the multiples of 77 are the

numbers we seek).
If we take these 12 numbers away from the 142 numbers divisible by 7, we see that there
are 130 numbers in our range divisible by 7 but not 11.
(Numbers divisible by 7 but not by 11) = 𝐴1 − |𝐴1 ⋃𝐴2 | = 142 − 12 = 130
999
c) (Numbers divisible by both 7 and 11) = |𝐴1 ⋂𝐴2 | = ⌊ 77 ⌋ = 12

d) By the principle of inclusion–exclusion, the answer, using the data from part (b), is
(Divisible by either 7 or 11) = (Divisible by 7) + (Divisible by 11) – (Divisible by 7 & 11)
|𝐴1 ⋃𝐴2 | = |𝐴1 | + |𝐴2 | − |𝐴1 ⋂𝐴2 |
= 142 + 90 − 12 = 220

e) If we subtract from the answer to part (d) the number of numbers divisible by both 7 and 11,
we will have the number of numbers divisible by neither of them; So, the answer is
220 − 12 = 208
f) If we subtract the answer to part (d) from the total number of positive integers less than 1000,
we will have the number of numbers divisible by exactly one of them; So, the answer is
999 − 220 = 779
g) If we assume that numbers are written without leading 0’s, then we should break the problem
down into three cases—one-digit numbers, two-digit numbers and three-digit numbers. Clearly
there are 9 one-digit numbers, and each of them has distinct digits. There are 90 two-digit
numbers (10 through 99), and all but 9 of them have distinct digits, so there are 81 two-digit
numbers with distinct digits.
An alternative way to compute this is to note that the first digit must be 1 through 9 (9
choices), and the second digit must be something different from the first digit (9 choices out of
the 10 possible digits), so by the product rule, we get 9 ∙ 9 = 81 choices in all. This approach
also tells us that there are 9 ∙ 9 ∙ 8 = 648 three-digit numbers with distinct digits (again, work
from left to right—in the ones place, only 8 digits are left to choose from).
So, the final answer is 9 + 81 + 648 = 738.
h) It turns out to be easier to count the odd numbers with distinct digits and subtract from our
answer to part (g), so let us proceed that way. There are 5 odd one-digit numbers. For two-digit
numbers, first choose the ones digit (5 choices), then choose the tens digit (8 choices), since
neither the ones digit value nor 0 is available); therefore, there are 40 such two-digit numbers.
(Note that this is not exactly half of 81.)
For the three-digit numbers, first choose the ones digit (5 choices), then the hundreds
digit (8 choices), then the tens digit (8 choices, giving us 320 in all. So, there are

5 + 40 + 320 = 365

odd numbers with distinct digits. Thus, the final answer is

738 − 365 = 373

Q # 19 (23):
How many positive integers between 100 and 999 inclusive;
a) are divisible by 7?
b) are odd?
c) have the same three decimal digits?
d) are not divisible by 4?
e) are divisible by 3 or 4?
f) are not divisible by either 3 or 4?
g) are divisible by 3 but not by 4?
h) are divisible by 3 and 4?

Solution:
This problem deals with the set of positive integers between 100 and 999, inclusive. Note that
there are exactly 999 − 100 + 1 = 900 such numbers.
A second way to see this is to note that to specify a three-digit number, we need to
choose the first digit to be nonzero (which can be done in 9 ways) and then the second
and third digits (which can each be done in 10 ways), for a total of 9 ∙ 10 ∙ 10 = 900 ways, by
the product rule.
A third way to see this (perhaps most relevant for this problem) is to note that a number
of the desired form is a number less than or equal to 999 (and there are 999 such numbers) but
not less than or equal to 99 (and there are 99 such numbers); therefore, there are

999 − 99 = 900

numbers in the desired range.


a) Every seventh number - 7, 14, and so on-is divisible by 7. Therefore, the number of positive
integers less than or equal to n and divisible by 7 is ⌊𝑛/7⌋ the floor function is used-we have to
round down-because the first six positive integers are not multiples of 7;
For example, there are only ⌊20/7⌋ = 2 multiples of 7 less than or equal to 20). So, we
999 99
find that there are ⌊ ⌋ = 142 multiples of 7 not exceeding 999, of which ⌊ 7 ⌋ = 14 do not
7

exceed 99. Therefore, there are exactly


142 − 14 = 128
numbers in the desired range divisible by 7.
b) This is similar to part (a), with 7 replaced by 2, but with the added twist that we want to count
the numbers not divisible by 2. Mimicking the analysis in part (a), we see that there are
⌊999/2⌋ = 499 even numbers not exceeding 999, and therefore 999 − 499 = 500 odd ones;
99
there are similarly 99 − ⌊ 2 ⌋ = 50 odd numbers less than or equal to 99.

Therefore, there are 500 − 50 = 450 odd numbers between 100 and 999 inclusive.

c) There are just 9 possible digits that a three-digit number can start with. If all of its digits are to
be the same, then there is no choice after the leading digit has been specified.
Therefore, there are 9 such numbers.

d) This is similar to part {b), except that 2 is replaced by 4. Following the analysis there, we find
999
that there are 999 − ⌊ ⌋ = 750 positive integers less than or equal to 999 not divisible by 4,
4
99
and 99 − ⌊ 4 ⌋ = 75 such positive integers less than or equal to 99.

Therefore, there are 750 − 75 = 675 three-digit integers not divisible by 4.

e) The method is similar to that used in the earlier parts. There are
999 99
Three-digit numbers divisible by 3 = 𝐴1 = ⌊ ⌋ − ⌊ 3 ⌋ = 300
3
999 99
Three-digit numbers divisible by 4 = 𝐴2 = ⌊ ⌋ − ⌊ 4 ⌋ = 225
4
999 99
Numbers divisible by both 3 and 4 = |𝐴1 ⋂𝐴2 | = ⌊ 12 ⌋ − ⌊12⌋ = 75

i.e., divisible by 12. In order to count each number divisible by 3 or 4 once and only once, we
need to add the number of numbers divisible by 3 to the number of numbers divisible by 4, and
then subtract the number of numbers divisible by both 3 and 4 so as not to count them twice.
(Divisible by either 3 or 4) = (Divisible by 3) + (Divisible by 4) – (Divisible by 3 & 4)
|𝐴1 ⋃𝐴2 | = |𝐴1 | + |𝐴2 | − |𝐴1 ⋂𝐴2 |
= 300 + 225 − 75 = 450.

f) Integers not divisible by either 3 or 4 = (Total integers) – (Integers divisible by either 3 or 4)


= 900 − 450 = 450

g)
Numbers divisible by 3 but not by 4 = (Numbers divisible by 3) – (Numbers divisible by 3 & 4)
= 300 − 75 = 225
999 99
h) Numbers divisible by both 3 and 4 (divisible by 12) = |𝐴1 ⋂𝐴2 | = ⌊ 12 ⌋ − ⌊12⌋ = 75

Q # 20 (24):
How many positive integers between 1000 and 9999 inclusive;
a) are divisible by 9?
b) are even?
c) have distinct digits?
d) are not divisible by 3?
e) are divisible by 5 or 7?
f) are not divisible by either 5 or 7?
g) are divisible by 5 but not by 7?
h) are divisible by 5 and 7?

Solution:
It will be useful to note first that there are exactly 9000 numbers between 9999 and 1000.
a) Every ninth number is divisible by 9,
9000
Numbers divisible by 9 = ⌊ ⌋ = 1000
9

b) Every other number is even,


9000
Numbers which are even = ⌊ ⌋ = 4500
2

c) We can reason from left to right. There are 9 choices for the first (left-most) digit (since it
cannot be a 0), then 9 choices for the second digit (since it cannot equal the first digit), then, in a
similar way, 8 choices for the third digit, and 7 choices for the right-most digit.
Therefore, there are 9 ∙ 9 ∙ 8 ∙ 7 = 4536 ways to specify such a number. In other words, there are
4536 such numbers.
Note that this coincidentally turns out to be almost exactly half of the numbers in the range.

d) Every third number is divisible by 3,


9000
Numbers divisible by 3 = ⌊ ⌋ = 3000.
3

Numbers not divisible by 3 = Total numbers – Numbers divisible by 3


= 9000 − 3000 = 6000
9000
e) Numbers divisible by 5 = 𝐴1 = ⌊ ⌋ = 1800
5
9000
Numbers divisible by 7 = 𝐴2 = ⌊ ⌋ = 1285
7
9000
Numbers divisible by both 5 & 7= |𝐴1 ⋂𝐴2 | = ⌊ ⌋ = 257
35

(Divisible by either 5 or 7) = (Divisible by 5) + (Divisible by 7) – (Divisible by 5 & 7)


|𝐴1 ⋃𝐴2 | = |𝐴1 | + |𝐴2 | − |𝐴1 ⋂𝐴2 |
= 1800 + 1285 − 257 = 2828.

f) Since we just found that 2828 of these numbers are divisible by either 5 or 7, it follows that
the rest of them, are not.
(Numbers not divisible by 5 or 7) = (Total numbers) – (Numbers divisible by 5 or 7)
= 9000 − 2828 = 6172

g)
Numbers divisible by 5 but not by 7 = (Numbers divisible by 5) – (Numbers divisible by 5 & 7)
= 1800 − 257 = 1543
9000
h) Numbers divisible by both 5 & 7= |𝐴1 ⋂𝐴2 | = ⌊ ⌋ = 257
35

Q # 21 (25):
How many strings of three decimal digits;
a) do not contain the same digit three times?
b) begin with an odd digit?
c) have exactly two digits that are 4s?
Solution:
This problem involves 1000 possible strings, since there is a choice of 10 digits for each of the
three positions in the string.

a) This is most easily done by subtracting from the total number of strings the number of strings
that violate the condition. Clearly there are 10 strings that consist of the same digit three times
(000, 111, … , 999).
Therefore, there are 1000 − 10 = 990 strings that do not.

b) If we must begin our string with an odd digit, then we have only 5 choices for this digit. We
still have 10 choices for each of the remaining digits. Therefore, there are 5 ∙ 10 ∙ 10 = 500 such
strings.
Alternatively, we note that by symmetry exactly half the strings begin with an odd digit
(there being the same number of odd digits as even ones). Therefore, half of the 1000 strings, or
500 of them, begin with an odd digit.
c) Here we need to choose the position of the digit that is not a 4 (3 ways) and choose that digit
(9 ways).
Therefore, there are 3 ∙ 9 = 27 such strings.

Q # 30 (34):
How many different functions are there from a set with 10 elements to sets with the following
numbers of elements?
a) 2 b) 3 c) 4 d) 5

Solution:
In each case the answer is 𝑛10 , where n is the number of elements in the codomain, since there
are n choices for a function value for each of the 10 elements in the domain.
a) 210 = 1024

b) 310 = 59,049

c) 410 = 1,048,576

d) 510 = 9,765,625

Q # 31 (35):
How many one-to-one functions are there from a set with five elements to sets with the following
number of elements?
a) 4 b) 5 c) 6 d) 7

Solution:
For each part of this problem, we need to find the number of one-to-one functions from a set
with 5 elements to a set with k elements. To specify such a function, we need to make 5 choices,
in succession, namely the values of the function at each of the 5 elements in its domain.
Therefore, the product rule applies.
The first choice can be made in k ways, since any element of the codomain can be the image of
the first element of the domain. After that choice has been made, there are only k - 1 elements of
the codomain available to be the image of the second element of the domain, since images must
be distinct for the function to be one-to-one.
Similarly, for the third element of the domain, there are 𝑘 − 2 possible choices for a
function value. Continuing in this way, and applying the product rule, we see that there are
𝑘(𝑘 − 1)(𝑘 − 2)(𝑘 − 3)(𝑘 − 4)
one-to-one functions from a set with 5 elements to a set with k elements.

a) By the analysis above the answer is 4 ∙ 3 ∙ 2 ∙ 1 = 0.

what we would expect since there are no one-to-one functions from a set to a strictly smaller set.

b) By the analysis above the answer is 5 ∙ 4 ∙ 3 ∙ 2 ∙ 1 = 120.

c) By the analysis above the answer is 6 ∙ 5 ∙ 4 ∙ 3 ∙ 2 = 720.

d) By the analysis above the answer is 7 ∙ 6 ∙ 5 ∙ 4 ∙ 3 = 2520.

Q # 34 (38):
How many partial functions (see Section 1.8) are there from a set with five elements to sets with
each of these number of elements?
a) 1 b) 2 c) 5 d) 9

Solution:
By our solution to Exercise 39, the answer is (𝑛 + 1)5 in each case, where n is the number of
elements in the codomain.
a) 25 = 32
b) 35 = 243

c) 65 = 7776

d) 105 = 100,000

Q # 53 (69):
a) Suppose that a popular style of running shoe is available for both men and women. The
woman’s shoe comes in sizes 6, 7, 8, and 9, and the man’s shoe comes in sizes 8, 9, 10, 11, and
12. The man’s shoe comes in white and black, while the woman’s shoe comes in white, red, and
black. Use a tree diagram to determine the number of different shoes that a store has to stock to
have at least one pair of this type of running shoe for all available sizes and colors for both
men and women.
b) Answer the question in part (a) using counting rules.

Solution:
a) The tree shown here enumerates the possible outcomes. First, we branch on gender, then on
size, and finally on color. There are 22 ends, so the answer to the question is 22.

b) First, we apply the sum rule: the number of shoes is the sum of the number of men's shoes and
the number of women's shoes.
Next, we apply the product rule. For a woman's shoe we need to specify size (4 choices)
and then for each choice of size, we need to specify color (3 choices).
Therefore, there are 4 ∙ 3 = 12 possible women's models.
Similarly, there are 5 ∙ 2 = 10 men's models.
Therefore, the answer is 12 + 10 = 22.

Q # 58 (74):
Data are transmitted over the Internet in datagrams, which are structured blocks of bits. Each
datagram contains header information organized into a maximum of 14 different fields
(specifying many things, including the source and destination addresses) and a data area that
contains the actual data that are transmitted. One of the 14 header fields is the header length
field (denoted by HLEN), which is specified by the protocol to be 4 bits long and that specifies
the header length in terms of 32-bit blocks of bits. For example, if HLEN = 0110, the header
is made up of six 32-bit blocks. Another of the 14 header fields is the 16-bit-long total length
field (denoted by TOTAL LENGTH), which specifies the length in bits of the entire datagram,
including both the header fields and the data area. The length of the data area is the total
length of the datagram minus the length of the header.
a) The largest possible value of TOTAL LENGTH (which is 16 bits long) determines the
maximum total length in octets (blocks of 8 bits) of an Internet datagram. What is this value?
b) The largest possible value of HLEN (which is 4 bits long) determines the maximum total
header length in 32-bit blocks. What is this value? What is the maximum total header length in
octets?
c) The minimum (and most common) header length is 20 octets. What is the maximum total
length in octets of the data area of an Internet datagram?
d) How many different strings of octets in the data area can be transmitted if the header length is
20 octets and the total length is as long as possible?

Solution:
a) The largest value of TOTAL LENGTH is 216 − 1, since this would be the number represented
by a string of 16 1’s. So, the maximum length of a datagram is 65,535 octets (or bytes).

b) The largest value of HLEN is 24 − 1 = 15, since this would be the number represented by a
string of four 1’s. So, the maximum length of a header is 15 32-bit blocks. Since there are four 8-
bit octets (or bytes) in a block, the maximum length of the header is 4 ∙ 15 = 60 octets.

c) We saw in part (a) that the maximum total length is 65,535 octets. If at least 20 of these must
be devoted to the header, the data area can be at most 65,515 octets long.
d) There are 28 = 256 different octets, since each bit of an octet can be 0 or 1. In part (c) we saw
that the data area could be at most 65,515 octets long. So, the answer is 25665515 , which is a
huge number (approximately 7 × 10157775 , according to a computer algebra system).

SECTION 4.3 Permutations and Combinations

Q # 1:
List all the permutations of {a, b, c}.

Solution:
Permutations are ordered arrangements. Thus, we need to list all the ordered arrangements of all
3 of these letters. There are 6 such: a,b,c; a,c,b; b,a,c; b,c,a; c,a,b; and c,b,a.
Note that we have listed them in alphabetical order.

Q # 2:
How many different permutations are there of the set {a, b, c, d, e, f, g}?

Solution:

7!
𝑃(7,7) = = 7! = 5040
(7 − 7)!

Q # 3:
How many permutations of {a, b, c, d, e, f, g} end with a?

Solution:
If we want the permutation to end with a, then we may as well forget about the a, and just count
the number of permutations of {b, c, d, e, f, g}. Each permutation of these 6 letters, followed by
a, will be a permutation of the desired type, and conversely.
6!
Therefore, the answer is 𝑃(6,6) = (6−6)! = 6! = 720.

Q # 4:
Let S = {1, 2, 3, 4, 5}.
a) List all the 3-permutations of S.
b) List all the 3-combinations of S.

Solution:
There are 10 combinations (𝐶(5,3) = 10) and 60 permutations (𝑃(5,3) = 60). We list them in
the following way. Each combination is listed, without punctuation, in increasing order, followed
by the five other permutations involving the same numbers, in parentheses, without punctuation.
123 (132 213 231 312 321) 124 (142 214 241 412 421) 125 (152 215 251 512 521)
134 (143 314 341 413 431) 135 (153 315 351 513 531) 145 (154 415 451 514 541)
234 (243 324 342 423 432) 235 (253 325 352 523 532)
245 (254 425 452 524 542) 345 (354 435 453 534 543)

Q # 5:
Find the value of each of these quantities.
a) 𝑃(6,3) b) 𝑃(6,5)
c) 𝑃(8,1) d) 𝑃(8,5)
e) 𝑃(8,8) f) 𝑃(10,9)

Solution:
We simply plug into the formula 𝑃(𝑛, 𝑟) = 𝑛(𝑛 − 1)(𝑛 − 2) … (𝑛 − 𝑟 + 1), given in Theorem l.
𝑛!
Note that there are r terms in this product, starting with n. This is the same as 𝑃(𝑛, 𝑟) = (𝑛−𝑟)! ,

but the latter formula is not as nice for computation, since it ignores the fact that each of the
factors in the denominator cancels one factor in the numerator. Thus, to compute 𝑛! and (𝑛 − 𝑟)!
and then to divide is to do a lot of extra arithmetic.
Of course, if the denominator is 1, then there is no extra work, so we note that
𝑃(𝑛, 𝑛) = 𝑃(𝑛, 𝑛 − 1) = 𝑛!

a) 𝑃(6,3) = 6 ∙ 5 ∙ 4 = 120

b) 𝑃(6,5) = 61 = 720

c) 𝑃(8,1) = 8

d) 𝑃(8,5) = 8 ∙ 7 ∙ 6 ∙ 5 ∙ 4 = 6720

e) 𝑃(8,8) = 8! = 40,320

f) 𝑃(10,9) = 10! = 3,628,800

Q # 6:
Find the value of each of these quantities.
a) 𝐶(5,1) b) 𝐶(5,3)
c) 𝐶(8,4) d) 𝐶(8,8)
e) 𝐶(8,0) f) 𝐶(12,6)

Solution:

a) 𝐶(5,1) = 5
4
b) 𝐶(5,3) = 𝐶(5,2) = 5 ∙ 2 = 10

8∙7∙6∙5
c) 𝐶(8,4) = = 70
4∙3∙2

d) 𝐶(8,8) = 1

e) 𝐶(8,0) = 1
12∙11∙10∙9∙8∙7
f) 𝐶(12,6) = = 924
6∙5∙4∙3∙2

Q # 7:
Find the number of 5-permutations of a set with nine elements.

Solution:
This is 𝑃(9,5) = 9 ∙ 8 ∙ 7 ∙ 6 ∙ 5 = 15,120 by Theorem l.

Q # 8:
In how many different orders can five runners finish a race if no ties are allowed?

Solution:

𝑃(5.5) = 5! = 120

Q # 9:
How many possibilities are there for the win, place, and show (first, second, and third) positions
in a horse race with 12 horses if all orders of finish are possible?
Solution:

We need to pick 3 horses from the 12 horses in the race, and we need to arrange them in order
(first, second, and third), in order to specify the win, place, and show. Thus, there are
𝑃(12,3) = 12 ∙ 11 ∙ 10 = 1320
possibilities.
Q # 10:
There are six different candidates for governor of a state. In how many different orders can the
names of the candidates be printed on a ballot?

Solution:

𝑃(6,6) = 6! = 720

Q # 11:
How many bit strings of length 10 contain;
a) exactly four 1s?
b) at most four 1s?
c) at least four 1s?
d) an equal number of 0s and 1s?

Solution:

a) To specify a bit string of length 10 that contains exactly four l's, we simply need to choose the
four positions that contain the l's. There are
10!
𝐶(10,4) = = 210
4! (10 − 4)!
ways to do that.

b) To contain at most four l's means to contain four l's, three l's, two l's, one 1, or no l's.
Reasoning as in part (a), we see that there are
𝐶(10,4) + 𝐶(10,3) + 𝐶(10,2) + 𝐶(10,1) = 210 + 120 + 45 + 10 + 1 = 386
such strings.

c) To contain at least four l's means to contain four l's, five l's, six l's, seven l's, eight l's, nine l's,
or ten l's. Reasoning as in part (b), we see that there are
𝐶(10,4) + 𝐶(10,5) + 𝐶(10,6) + 𝐶(10,7) + 𝐶(10,8) + 𝐶(10,9) + 𝐶(10,10)
= 210 + 252 + 210 + 120 + 45 + 10 + 1 = 848
such strings. A simpler approach would be to figure out the number of ways not to have at least
four l's (i.e., to have three l's, two l's, one 1, or no l's) and then subtract that from 210 , the total
number of bit strings of length 10. This way we get
1024 − (120 + 45 + 10 + 1) = 848
Fortunately, the same answer as before. Solving a combinatorial problem in more than one way
is a useful check on the correctness of the answer.

d) To have an equal number of 0's and l's in this case means to have five l's. Therefore, the
answer is 𝐶(10,5) = 252. Incidentally, this gives us another way to do part (b). If we don't have
an equal number of 0's and l's, then we have either at most four l's or at least six l's. By
symmetry, having at most four l's occurs in half of these cases. Therefore, the answer to part (b)
is

210 − 𝐶(10,5)
= 386
2

as above.

Q # 12:
How many bit strings of length 12 contain;
a) exactly three 1s?
b) at most three 1s?
c) at least three 1s?
d) an equal number of 0s and 1s?

Solution:

a) To specify a bit string of length 12 that contains exactly three 1’s, we simply need to choose
the three positions that contain the 1’s. There are
𝐶(12,3) = 220

ways to do that.

b) To contain at most three 1’s means to contain three 1’s, two 1’s, one 1, or no 1’s. Reasoning
as in part (a), we see that there are
𝐶(12,3) + 𝐶(12,2) + 𝐶(12,1) + 𝐶(12,0) = 220 + 66 + 12 + 1 = 299

such strings.

c) To contain at least three 1’s means to contain three 1’s, four 1’s, five 1’s, six 1’s, seven 1’s,
eight 1’s, nine 1’s, 10 1’s, 11 1’s, or 12 1’s. We could reason as in part (b), but we would have
too many numbers to add. A simpler approach would be to figure out the number of ways not to
have at least three 1’s (i.e., to have two 1’s, one 1, or no 1’s) and then subtract that from 212 , the
total number of bit strings of length 12. This way we get
4096 − (66 + 12 + 1) = 4017.
d) To have an equal number of 0’s and 1’s in this case means to have six 1’s. Therefore, the
answer is 𝐶(12,6) = 924.

Q # 14:
In how many ways can a set of two positive integers less than 100 be chosen?

Solution:

98
𝐶(99,2) = 99. = 4851
2

Q # 15:
In how many ways can a set of five letters be selected from the English alphabet?

Solution:

We assume that a combination is called for, not a permutation, since we are told to select a set,
not form an arrangement. We need to choose 5 things from 26, so there are
26 ∙ 25 ∙ 24 ∙ 23 ∙ 22
𝐶(26,5) = = 65,780
5!
ways to do so.

Q # 16:
How many subsets with an odd number of elements does a set with 10 elements have?

Solution:
We need to compute
C(10, 1) + C(10, 3) + (10, 5) + C(10, 7) + C(10, 9) = 10 + 120 + 252 + 120 + 10 = 512.
(In the next section we will see that there are just as many subsets with an odd number of
elements as there are subsets with an even number of elements (Exercise 31 in Section 6.4).
Since there are 210 = 1024 subsets
in all, the answer is 1024/2 = 512, in agreement with our computation.)

Q # 17:
How many subsets with more than two elements does a set with 100 elements have?
Solution:
We know that there are 2100 subsets of a set with 100 elements. All of them have more than two
elements except the empty set, the 100 subsets consisting of one element each, and the
𝐶(100,2) = 4950 subsets with two elements. So,
Number of subsets less than two elements = 4950 + 100 + 1 = 5051
Therefore, the answer is 2100 − 5051 ≈ 1.3 × 1030

Q # 22:
How many permutations of the letters ABCDEFGH contain;
a) the string ED?
b) the string CDE?
c) the strings BA and FGH?
d) the strings AB, DE, and GH?
e) the strings CAB and BED?
f) the strings BCA and ABF?

Solution:
a) If ED is to be a substring, then we can think of that block of letters as one superletter, and the
problem is to count permutations of seven items—the letters A, B, C, F, G, and H, and the
superletter ED.
Therefore, the answer is 𝑃(7,7) = 7! = 5040.

b) Reasoning as in part (a), we see that the answer is 𝑃(6,6) = 6! = 720.

c) As in part (a), we glue BA into one item and glue FGH into one item. Therefore, we need to
permute five items, and there are 𝑃(5,5) = 5! = 120 ways to do it.

d) This is similar to part (c). Glue AB into one item, glue DE into one item, and glue GH into
one item, producing five items, so the answer is 𝑃(5,5) = 5! = 120.

e) If both CAB and BED are substrings, then CABED has to be a substring. So, we are really just
permuting four items: CABED, F, G, and H. Therefore, the answer is 𝑃(4,4) = 4! = 24.

f) There are no permutations with both of these substrings, since B cannot be followed by both C
and F at the same time.

Q # 25:
One hundred tickets, numbered 1, 2, 3, … 100, are sold to 100 different people for a drawing.
Four different prizes are awarded, including a grand prize (a trip to Tahiti). How many ways are
there to award the prizes if;
a) there are no restrictions
b) the person holding ticket 47 wins the grand prize?
c) the person holding ticket 47 wins one of the prizes?
d) the person holding ticket 47 does not win a prize?
e) the people holding tickets 19 and 47 both win prizes?
f) the people holding tickets 19, 47, and 73 all win prizes?
g) the people holding tickets 19, 47, 73, and 97 all win prizes?
h) none of the people holding tickets 19, 47, 73, and 97 wins a prize?
i) the grand prize winner is a person holding ticket 19, 47, 73, or 97?
j) the people holding tickets 19 and 47 win prizes, but the people holding tickets 73 and 97 do
not win prizes?

Solution:
a) Since the prizes are different, we want an ordered arrangement of four numbers from the set of
the first 100 positive integers. Thus, there are 𝑃(100,4) = 94,109,400 ways to award the prizes.

b) If the grand prize winner is specified, then we need to choose an ordered set of three tickets to
win the other three prizes. This can be done is 𝑃(99,3) = 941,094 ways.

c) We can first determine which prize the person holding ticket 47 will win (this can be done in 4
ways), and then we can determine the winners of the other three prizes, exactly as in part (b).
Therefore, the answer is

𝑃(99,3) + 𝑃(99,3) + 𝑃(99,3) + 𝑃(99,3) = 4 ∙ 𝑃(99,3) = 3,764,376.

d) This is the same calculation as in part (a), except that there are only 99 viable tickets.
Therefore, the answer is 𝑃(99,4) = 90,345,024. Note that this answer plus the answer to part
(c) equals the answer to part (a), since the person holding ticket 47 either wins a prize or does not
win a prize.
e) This is similar to part (c). There are 𝑃(4,2) = 4 ∙ 3 = 12 ways to determine which prizes
these two lucky people will win, after which there are 𝑃(98,2) = 9506 ways to award the other
two prizes. Therefore, the answer is

12 ∙ 𝑃(98,2) = 12 ∙ 9506 = 114,072.

f) This is like part (e). There are 𝑃(4,3) = 24 ways to choose the prizes for the three people
mentioned, and then 97 ways to choose the other winner. This gives 24 ∙ 97 = 2328 ways in all.

g) Here it is just a matter of ordering the prizes for these four people, so the answer is
𝑃(4,4) = 24

h) This is similar to part (d), except that this time the pool of viable numbers has only 96
numbers in it. Therefore, the answer is 𝑃(96,4) = 79,727,040.

i) There are four ways to determine the grand prize winner under these conditions. Then there are
𝑃(99,3) ways to award the remaining prizes. This gives an answer of

4 ∙ 𝑃(99,3) = 3,764,3764.

j) First, we need to choose the prizes for the holder of 19 and 47. Since there are four prizes,
there are 𝑃(4,2) = 12 ways to do this. Then there are 96 people who might win the remaining
prizes, and there are 𝑃(96,2) = 9120 ways to award these prizes. Therefore, the answer is

12 × 9120 = 109,440

Q # 27:
A club has 25 members.
a) How many ways are there to choose four members of the club to serve on an executive
committee?
b) How many ways are there to choose a president, vice president, secretary, and treasurer of the
club, where no person can hold more than one office?

Solution:
a) Since the order of choosing the members is not relevant (the offices are not differentiated), we
need to use a combination. The answer is clearly

25!
𝐶(25,4) = = 12,650
4! (25 − 4)!
b) In contrast, here we need a permutation, since the order matters (we choose first a president,
then a vice president, then a secretary, then a treasurer). The answer is clearly

25!
𝑃(25,4) = = 303,600
(25 − 4)!

Q # 31:
The English alphabet contains 21 consonants and five vowels. How many strings of six
lowercase letters of the English alphabet contain;
a) exactly one vowel?
b) exactly two vowels?
c) at least one vowel?
d) at least two vowels?

Solution:
We need to be careful here, because strings can have repeated letters.
a) We need to choose the position for the vowel and this can be done in 𝐶(6,1) = 6 ways. Next,
we need to choose the vowel to use, and this can be done in 5 ways. Each of the other five
positions in the string can contain any of the 21 consonants. So, there are 215 ways to fill the rest
of the string. Therefore, the answer is

6 ∙ 5 ∙ 215 = 122,523,030

b) We need to choose the position for the vowels, and this can be done in 𝐶(6,2) = 15 ways (we
need to choose two positions out of six). We need to choose the two vowels (52 ways). Each of
the other four positions in the string can contain any of the 21 consonants, so there are 214 ways
to fill the rest of the string. Therefore, the answer is

15 ∙ 52 ∙ 214 = 72,930,375.

c) The best way to do this is to count the number of strings with no vowels and subtract this from
the total number of strings. We obtain

266 − 216 = 223,149,655.

d) As in part (c), we will do this by subtracting from the total number of strings, the number of
strings with no vowels and the number of strings with one vowel (this latter quantity having been
computed in part (a)). We obtain
266 − 216 − 6.5. 215 = 223149655 − 122523030 = 100,626,625.
Q # 33:
Suppose that a department contains 10 men and 15 women. How many ways are there to form a
committee with six members if it must have the same number of men and women?

Solution:
We are told that we must select three of the 10 men and three of the 15 women. This can be done
in
𝐶(10,3) ∙ 𝐶(15,3) = 54,600
ways.

SECTION 4.4 Binomial Coefficients and Identities

Q # 7:
What is the coefficient of 𝑥 9 in (2 − 𝑥)19 ?

Solution:
By the binomial theorem the term involving 𝑥 9 in the expansion of (2 + (−𝑥))19 is
19 10
( ) 2 (−𝑥)9 .
9
Therefore, the coefficient is

19 19
( ) 210 (−1)9 = −210 ( ) = −94,595,072.
9 9

Q # 10:
1
Give a formula for the coefficient of 𝑥 𝑘 in the expansion of (𝑥 + 𝑥)100 , where k is an integer.

Solution:
1
By the binomial theorem, the typical term in this expansion is (100
𝑗
) 𝑥100−𝑗 (𝑥)𝑗 , which can be

rewritten as (100
𝑗
) 𝑥100−2𝑗 . As j runs from 0 to 100, the exponent runs from 100 down to −100 in

decrements of 2. If we let k denote the exponent, then solving 𝑘 = 100 − 2𝑗 for j we obtain
𝑗 = (100 − 𝑘)/2. Thus, the values of k for which 𝑥 𝑘 appears in this expansion are
100
−100, −98, … , −2, 0, 4, … , 100, and for such values of k the coefficient is ((100−𝑘)/2. ).
Q # 12:
The row of Pascal’s triangle containing the binomial coefficients (10
𝑘
), 0 ≤ 𝑘 ≤ 10, is:
1 10 45 120 210 252 210 120 45 10 1
Use Pascal’s identity to produce the row immediately following this row in Pascal’s triangle.

Solution:
We just add adjacent numbers in this row to obtain the next row (starting and ending with 1, of
course):
1 11 55 165 330 462 462 330 165 55 11 1

Q # 22:
Prove the identity
𝑛 𝑟 𝑛 𝑛−𝑘
( )( ) = ( )( )
𝑟 𝑘 𝑘 𝑟−𝑘
whenever n, r, and k are nonnegative integers with r ≤ n and k ≤ r,
a) using a combinatorial argument.
b) using an argument based on the formula for the number of r-combinations of a set with n
elements.

Solution:
a) Suppose that we have a set with n elements, and we wish to choose a subset A with k elements
and another, disjoint, subset with 𝑟 − 𝑘 elements. The left-hand side gives us the number of ways
to do this, namely the product of the number of ways to choose the r elements that are to go into
one or the other of the subsets and the number of ways to choose which of these elements are to
go into the first of the subsets. The right-hand side gives us the number of ways to do this as
well, namely the product of the number of ways to choose the first subset and the number of
ways to choose the second subset from the elements that remain.

b) On the one hand,


𝑛 𝑟 𝑛! 𝑟! 𝑛!
( )( ) = ∙ =
𝑟 𝑘 𝑟! (𝑛 − 𝑟)! 𝑘! (𝑟 − 𝑘)! 𝑘! (𝑛 − 𝑟)! (𝑟 − 𝑘)!
and on the other hand
𝑛 𝑛−𝑘 𝑛! (𝑛 − 𝑘)! 𝑛!
( )( )= ∙ =
𝑘 𝑟−𝑘 𝑘! (𝑛 − 𝑘)! (𝑟 − 𝑘)! (𝑛 − 𝑟)! 𝑘! (𝑛 − 𝑟)! (𝑟 − 𝑘)!
Q # 23:
Show that if n and k are positive integers, then
𝑛
𝑛+1 (𝑛 + 1)(𝑘−1)
( )=
𝑘 𝑘
Use this identity to construct an inductive definition of the binomial coefficients.

Solution:
This identity can be proved algebraically or combinatorically. Algebraically, we compute as
follows, starting with the right-hand side (we use twice the fact that (𝑥 + 1)𝑥! = (𝑥 + 1)!):
𝑛
(𝑛 + 1)(𝑘−1) (𝑛 + 1) 𝑛
= ( )
𝑘 𝑘 𝑘−1
(𝑛 + 1) 𝑛!
= ∙
𝑘 (𝑘 − 1)! (𝑛 − (𝑘 − 1))!
(𝑛 + 1)!
=
(𝑘 − 1)! (𝑛 − (𝑘 − 1))! 𝑘
(𝑛 + 1)!
=
𝑘! (𝑛 − (𝑘 − 1))!
(𝑛 + 1)!
=
𝑘! ((𝑛 + 1) − 𝑘)!
𝑛+1
= ( )
𝑘
For a combinatorial argument, we need to construct a situation in which both sides count the
same thing. Suppose that we have a set of 𝑛 + 1 people, and we wish to choose k of them.
Clearly there are (𝑛+1
𝑘
) ways to do this. On the other hand, we can choose our set of k people by
first choosing one person to be in the set (there are 𝑛 + 1 choices), and then choosing 𝑘 − 1
𝑛
additional people to be in the set, from the n people remaining. This can be done in (𝑘−1) ways.
𝑛
Therefore, apparently there are (𝑛 + 1)(𝑘−1) ways to choose the set of k people.
However, we have overcounted: there are k ways that every such set can be
chosen, since once we have the set, we realize that any of the k people could have been chosen
𝑛
(𝑛+1)(𝑘−1)
first. Thus, we have overcounted by a factor of k, and the real answer is (we correct for
𝑘

the overcounting by dividing by k).


Comparing our two approaches, one yielding the answer (𝑛+1
𝑘
), and the other yielding the
𝑛
(𝑛+1)(𝑘−1)
answer , we conclude that
𝑘
𝑛
𝑛+1 (𝑛 + 1)(𝑘−1)
( )=
𝑘 𝑘
Finally, we are asked to use this identity to give a recursive definition of the (𝑛𝑘)'s. Note that this

identity expresses (𝑛𝑘) in terms of (𝑗𝑖 ) for values of i and j less than n and k, respectively (namely

𝑖 = 𝑛 − 1 and 𝑗 = 𝑘 − 1). Thus, the identity will be the recursive part of the definition. We need
the base cases to handle 𝑛 = 0 or 𝑘 = 0. Our full definition becomes
1 𝑖𝑓 𝑘 = 0
𝑛 0 𝑖𝑓 𝑘 > 0 𝑎𝑛𝑑 𝑛 = 0
( )=
𝑘 𝑛 ∙ (𝑛−1
𝑘−1
)
{ 𝑖𝑓 𝑛 > 0 𝑎𝑛𝑑 𝑘 > 0
𝑘
Actually, if we assume (as we usually do) that 𝑘 ≤ 𝑛, then we do not need the second line of the
definition. Note that (𝑛𝑘) = 0 for 𝑛 < 𝑘 under the definition given here, which is consistent with
the combinatorial definition, since there are no ways to choose k different elements from a set
with fewer than k elements.

Q # ∗27:
Prove the hockeystick identity
𝑟
𝑛+𝑘 𝑛+𝑟+1
∑( )=( )
𝑘 𝑟
𝑘=0

whenever 𝑛 and 𝑟 are positive integers,


a) using a combinatorial argument.
b) using Pascal’s identity.

Solution:
The reason this is called the "hockey stick identity" is that the binomial coefficients being
summed lie along a line in Pascal's triangle, and the sum is the entry in the triangle that, together
with that line, forms a shape vaguely resembling a hockey stick.

a) We need to find something to count so that the left-hand side of the equation counts it in one
way and the right-hand side counts it in a different way. After much thought, we might try the
following.
We will count the number of bit strings of length 𝑛 + 𝑟 + 1 containing exactly r 0's and 𝑛 + 1
l's. There are (𝑛+𝑟+1
𝑟
) such strings, since a string is completely specified by deciding which r of
the bits are to be the 0's. To see that the left-hand side of the identity counts the same thing, let
𝑙 + 1 be the position of the last 1 in the string. Since there are 𝑛 + 1 1 's, we know that 𝑙 cannot
be less than 𝑛. Thus, there are disjoint cases for each 𝑙 from 𝑛 to 𝑛 + 𝑟. For each such 𝑙, we
completely determine the string by deciding which of the 𝑙 positions in the string
before the last 1 are to be 0's. Since there are n l's in this range, there are 𝑙 − 𝑛 0's. Thus, there
𝑙
are (𝑙−𝑛 ) ways to choose the positions of the 0's.
Now by the sum rule the total number of bit strings will be
𝑛+𝑟
𝑙
∑( )
𝑙−𝑛
𝑙=𝑛

By making the change of variable 𝑘 = 𝑙 − 𝑛, this transforms into the left-hand side, and we are
finished.

b) We need to prove this by induction on r; Pascal's identity will enter at the crucial step. We let
P(r) be the statement to be proved. The basis step is clear, since the equation reduces to
𝑛+0 𝑛+0+1
( )=( )
0 0
𝑛 𝑛+1
( )=( )
0 0
which is the true proposition 1=1.
Assuming the inductive hypothesis, assume that P(r) statement is true, that is
𝑟
𝑛+𝑘 𝑛+𝑟+1
∑( )=( )
𝑘 𝑟
𝑘=0

we derive P(r + 1) in the usual way:


𝑟+1 𝑟
𝑛+𝑘 𝑛+𝑘 𝑛+𝑟+1
∑( ) = ∑( )+( )
𝑛 𝑘 𝑟+1
𝑘=0 𝑘=0
𝑛+𝑟+1 𝑛+𝑟+1
=( )+( ) (𝑏𝑦 𝑡ℎ𝑒 𝑖𝑛𝑑𝑢𝑐𝑡𝑖𝑣𝑒 ℎ𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑖𝑠)
𝑟 𝑟+1
𝑛 + (𝑟 + 1) + 1
=( ) (𝑏𝑦 𝑃𝑎𝑠𝑐𝑎𝑙 ′ 𝑠 𝑖𝑑𝑒𝑛𝑡𝑖𝑡𝑦)
𝑟+1
Q # 33:
In this exercise we will count the number of paths in the 𝑥𝑦 plane between the origin (0, 0) and
point (𝑚, 𝑛), where 𝑚 and 𝑛 are nonnegative integers, such that each path is made up of a series
of steps, where each step is a move one unit to the right or a move one unit upward. (No moves
to the left or downward are allowed.) Two such paths from (0,0) to (5,3) are illustrated here.

a) Show that each path of the type described can be represented by a bit string consisting of m 0s
and n 1s, where a 0 represents a move one unit to the right and a 1 represents a move one unit
upward.
b) Conclude from part (a) that there are

𝑚+𝑛
( )
𝑛

paths of the desired type.

Solution:
a) Clearly a path of the desired type must consist of 𝑚 moves to the right and n moves up.
Therefore, each such path can be represented by a bit string consisting of 𝑚 0's and 𝑛 l's, with the
0's representing moves to the right and the l's representing moves up. Note that the total length of
this bit string is 𝑚 + 𝑛.

b) We know from this section that the number of bit strings of length m + n containing exactly n
l's is (𝑚+𝑛
𝑛
), since one need only specify the positions of the l's. Note that this is the same as
𝑚+𝑛
( )
𝑛

Q # 39:
Determine a formula involving binomial coefficients for the nth term of a sequence if its initial
terms are those listed. [Hint: Looking at Pascal’s triangle will be helpful. Although infinitely
many sequences start with a specified set of terms, each of the following lists
is the start of a sequence of the type desired]
a) 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, . . .
b) 1, 4, 10, 20, 35, 56, 84, 120, 165, 220, . . .
c) 1, 2, 6, 20, 70, 252, 924, 3432, 12870, 48620, . . .
d) 1, 1, 2, 3, 6, 10, 20, 35, 70, 126, . . .
e) 1, 1, 1, 3, 1, 5, 15, 35, 1, 9, . . .
f) 1, 3, 15, 84, 495, 3003, 18564, 116280, 735471, 4686825, . . .

Solution:
a) This looks like the third negatively sloping diagonal of Pascal's triangle, starting with the
leftmost entry in the second row and reading down and to the right. In other words, the 𝑛𝑡ℎ term
of this sequence is

𝑛+1 𝑛+1
( )=( )
𝑛−1 2

b) This looks like the fourth negatively sloping diagonal of Pascal's triangle, starting with the
leftmost entry in the third row and reading down and to the right. In other words, the 𝑛𝑡ℎ term of
this sequence is

𝑛+2 𝑛+2
( )=( )
𝑛−1 3

c) These seem to be the entries reading straight down the middle of the Pascal's triangle. Only
every other row has a middle element. The first entry in the sequence is (00), the second is (21),

the third is (42), the fourth is (63) and so on. In general, then, the nth term is

2𝑛 − 2
( )
𝑛−1

d) These seem to be the entries reading down the middle of the Pascal's triangle. Only every
other row has an exact middle element, but in the other rows, there are two elements sharing the
middle. The first entry in the sequence is (00) , the second is (10), the third is (21) , the fourth is

(31), the fifth is (42), the sixth is (52) and so on. In general, then, the 𝑛𝑡ℎ term is

𝑛−1
( 𝑛−1 )
⌊ 2 ⌋

e) One pattern here is a wandering through Pascal's triangle according to the following rule. The
𝑛𝑡ℎ term is in the 𝑛𝑡ℎ row of the triangle. We increase the position in that row as we go down,
but as soon as we are about to reach the middle of the row, we jump back to the start of the next
row.
For example, the fifth term is the first entry in row 5; the sixth term is the second entry in row 6;
the seventh term is the third entry in row 7; the eighth term is the fourth entry in row 8. The next
entry following that pattern would take us to the middle of the ninth row, so instead we jump
back to the beginning, and the ninth term is the first entry of row 9. To come up with a formula
here, we see that the 𝑛𝑡ℎ entry is (𝑛−1
𝑘−1
) for a particular k;
let us determine k as a function of n. A little playing around with the pattern reveals that k is n
minus the largest power of 2 less than n (where for this purpose we consider 0 to be the largest
power of 2 less than 1).
For example, the 14𝑡ℎ term has k = 14 - 8 = 6, so it is (13
5
) = 1287

f) The terms seem to come from every third row, so the 𝑛𝑡ℎ term is (3𝑛−3
𝑘
) for some k. A little

observation indicates that in fact these terms are (00), (31), (62), (39), (12
4
) and so on. Thus the 𝑛𝑡ℎ
term is
3𝑛 − 3
( )
𝑛−1
SECTION 4.5 Generalized Permutations and Combinations

Q # 1:
In how many different ways can five elements be selected in order from a set with three elements
when repetition is allowed?

Solution:
Since order is important here, and since repetition is allowed, this is a simple application of the
product rule. There are 3 ways in which the first element can be selected, 3 ways in which the
second element can be selected, and so on, with finally 3 ways in which the fifth element can be
selected, so there are 35 = 243 ways in which the 5 elements can be selected.
The general formula is that there are 𝑛𝑘 ways to select k elements from a set of n elements, in
order, with unlimited repetition allowed.

Q # 2:
In how many different ways can five elements be selected in order from a set with five elements
when repetition is allowed?

Solution:
There are 5 choices each of 5 times, so the answer is 55 = 3125.

Q # 3:
How many strings of six letters are there?

Solution:
Since we are considering strings, clearly order matters. The choice for each position in the string
is from the set of 26 letters. Therefore, using the same reasoning as in Exercise 1, we see that
there are 266 = 308,915,776 strings.

Q # 5:
How many ways are there to assign three jobs to five employees if each employee can be given
more than one job?

Solution:
We assume that the jobs and the employees are distinguishable. For each job, we have to decide
which employee gets that job. Thus, there are 5 ways in which the first job can be assigned, 5
ways in which the second job can be assigned, and 5 ways in which the third job can be assigned.
Therefore, by the multiplication principle (just as in Exercise 1) there are 53 = 125 ways in
which the assignments can be made. (Note that we do not require that every employee get at least
one job.)

Q # 6:
How many ways are there to select five unordered elements from a set with three elements when
repetition is allowed?

Solution:
Here 𝑛 = 3, 𝑎𝑛𝑑 𝑟 = 5,
So, by Theorem 2 there are

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(3 + 5 − 1,5) = 𝐶(7,5) = 21

ways to do so.

Q # 7:
How many ways are there to select three unordered elements from a set with five elements when
repetition is allowed?

Solution:
Since the selection is to be an unordered one.
Here 𝑛 = 5, 𝑎𝑛𝑑 𝑟 = 3,
So, by Theorem 2 there are
7∙6∙5
𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(5 + 3 − 1,3) = 𝐶(7,3) = = 35
3∙2
ways to do so.
(Equivalently, this problem is asking us to count the number of nonnegative integer solutions to

𝑥1 + 𝑥2 + 𝑥3 + 𝑥4 + 𝑥5 = 3

where 𝑥𝑖 , represents the number of times that the 𝑖 𝑡ℎ element of the 5-element set gets selected.)

Q # 8:
How many different ways are there to choose a dozen donuts from the 21 varieties at a donut
shop?

Solution:
Here 𝑛 = 21, 𝑎𝑛𝑑 𝑟 = 12,
So, by Theorem 2 there are

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(21 + 12 − 1,12) = 𝐶(32,12) = 225,792,840


ways.

Q # 9:
A bagel shop has onion bagels, poppy seed bagels, egg bagels, salty bagels, pumpernickel
bagels, sesame seed bagels, raisin bagels, and plain bagels. How many ways are there to choose;
a) six bagels?
b) a dozen bagels?
c) two dozen bagels?
d) a dozen bagels with at least one of each kind?
e) a dozen bagels with at least three egg bagels and no more than two salty bagels?
Solution:
Let 𝑏1 , 𝑏2 … 𝑏8 be the number of bagels of the 8 types listed (in the order listed) that are selected.
Order does not matter: we are presumably putting the bagels into a bag to take home, and the
order in which we put them there is irrelevant.

a) If we want to choose 6 bagels, then we are asking for the number of nonnegative solutions to
the equation 𝑏1 + 𝑏2 + ⋯ + 𝑏8 = 6.
Theorem 2 applies, with 𝑛 = 8 𝑎𝑛𝑑 𝑟 = 6, giving us the answer

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(8 + 6 − 1,6) = 𝐶(13,6) = 1716

b) This is the same as part (a), except that 𝑟 = 12 rather than 6 and 𝑛 = 8. Thus, there are

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(8 + 12 − 1,12) = 𝐶(19,12) = 𝐶(19,7) = 50,388

ways to make the selection. (Note that 𝐶(19,7) was easier to compute than 𝐶(19,12), and since
they are equal, we chose the latter form.)

c) This is the same as part (a), except that 𝑟 = 24 rather than 6 and 𝑛 = 8. Thus, there are

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(8 + 24 − 1,24) = 𝐶(31,24) = 𝐶(31,7) = 2,629,575

ways to make the selection.

d) This one is more complicated. Here we want to solve the equation 𝑏1 + 𝑏2 + ⋯ + 𝑏8 = 12,
subject to the constraint that each 𝑏𝑖 ≥ 1. We reduce this problem to the form in which Theorem
2 is applicable with the following trick. Let 𝑏𝑖′ = 𝑏𝑖 − 1; then 𝑏𝑖′ represents the number of bagels
of type i, in excess of the required 1, that are selected. If we substitute 𝑏𝑖 = 𝑏𝑖′ + 1 into the
original equation, we obtain

(𝑏1′ + 1) + (𝑏2′ + 1) + ⋯ + (𝑏8′ + 1) = 12

which reduces to

𝑏1′ + 𝑏2′ + ⋯ + 𝑏8′ = 4

In other words, we are asking how many ways are there to choose the 4 extra bagels (in excess of
the required 1 of each type) from among the 8 types, repetitions allowed.
So, by Theorem 2 with 𝑛 = 8 and 𝑟 = 4, the number of solutions is

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(8 + 4 − 1,4) = 𝐶(11,4) = 330

e) This final part is even trickier. First let us ignore the restriction that there can be no more than
2 salty bagels (i.e., that 𝑏4 ≤ 2). We will take into account, however, the restriction that there
must be at least 3 egg bagels (i.e., that 𝑏3 ≥ 3). Thus, we want to count the number of solutions
to the equation

𝑏1 + 𝑏2 + ⋯ + 𝑏8 = 12

subject to the condition that 𝑏𝑖 ≥ 0 for all 𝑖 and 𝑏3 ≥ 3.


As in part (d), we use the trick of choosing the 3 egg bagels at the outset, leaving only 9
bagels free to be chosen; equivalently, we set 𝑏3′ = 𝑏3 − 3, to represent the extra egg bagels,
above the required 3, that are chosen. Now Theorem 2 applies to the number of solutions of

𝑏1 + 𝑏2 + 𝑏3′ + ⋯ + 𝑏8 = 9

So, with 𝑛 = 8 and 𝑟 = 9 there are

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(8 + 9 − 1,9) = 𝐶(16,9) = 𝐶(16,7) = 11,440

ways to make this selection.


Next, we need to worry about the restriction that 𝑏4 ≤ 2. We will impose this restriction by
subtracting from our answer so far, the number of ways to violate this restriction (while still
obeying the restriction that 𝑏3 ≥ 3). The difference will be the desired answer. To violate the
restriction means to have 𝑏4 ≥ 3.
Thus, we want to count the number of solutions to

𝑏1 + 𝑏2 + ⋯ + 𝑏8 = 12

With 𝑏3 ≥ 3 and 𝑏4 ≥ 3. Using the same technique as we have just used, this is equal to the
number of nonnegative solutions to the equation

𝑏1 + 𝑏2 + 𝑏3′ + 3 + 𝑏4′ + 3 + 𝑏5 … + 𝑏8 = 12

𝑏1 + 𝑏2 + 𝑏3′ + 𝑏4′ + 𝑏5 … + 𝑏8 = 6

(The 6 on the right being 12 − 3 − 3).


By Theorem 2 with 𝑛 = 8 and 𝑟 = 6 there are
𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(8 + 6 − 1,6) = 𝐶(13,6) = 1716

ways to make this selection.

Therefore, our final answer is 11,440 − 1716 = 9724.

Q # 11:
How many ways are there to choose eight coins from a piggy bank containing 100 identical
pennies and 80 identical nickels?

Solution:
This can be solved by common sense. Since the pennies are all identical and the nickels are all
identical, all that matters is the number of each type of coin selected. We can select anywhere
from 0 to 8 pennies (and the rest nickels); since there are nine numbers in this range, the answer
is 9. (The number of pennies and nickels is irrelevant, as long as each is at least eight.) If we
wanted to use a high-powered theorem for this problem, we could observe that Theorem 2
applies, with 𝑛 = 2 (there are two types of coins) and 𝑟 = 8. The formula gives

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(2 + 8 − 1,8) = 𝐶(9,8) = 9

Q # 12:
How many different combinations of pennies, nickels, dimes, quarters, and half dollars can a
piggy bank contain if it has 20 coins in it?

Solution:
There are 5 things to choose from, repetitions allowed, and we want to choose 20 things, order
not important.
Therefore, by Theorem 2 with 𝑛 = 5 and 𝑟 = 20 the answer is

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(5 + 20 − 1,20) = 𝐶(24,20) = 𝐶(24,4) = 10,626

Q # 14:
How many solutions are there to the equation;

𝑥1 + 𝑥2 + 𝑥3 + 𝑥4 = 17

where 𝑥1 , 𝑥2 , 𝑥3 and 𝑥4 are non-negative integers?


Solution:
By Theorem 2 with 𝑛 = 4 and 𝑟 = 17 the answer is

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(4 + 17 − 1,17) = 𝐶(20,17) = 𝐶(20,3) = 1140

Q # 15:
How many solutions are there to the equation
𝑥1 + 𝑥2 + 𝑥3 + 𝑥4 + 𝑥5 = 21
where 𝑥𝑖 , 𝑖 = 1,2,3,4,5 is a non-negative integer such that
a) 𝑥1 ≥ 1?
b) 𝑥𝑖 ≥ 2 for , 𝑖 = 1,2,3,4,5?
c) 0 ≤ 𝑥1 ≤ 10?
d) 0 ≤ 𝑥1 ≤ 3, 1 ≤ 𝑥2 < 4, 𝑎𝑛𝑑 𝑥3 ≥ 15?

Solution:
a) Let 𝑥1 = 𝑥1′ + 1; thus 𝑥1′ is the value that 𝑥1 has in excess of its required 1. Then the problem
asks for the number of nonnegative solutions to

𝑥1′ + 1 + 𝑥2 + 𝑥3 + 𝑥4 + 𝑥5 = 21

𝑥1′ + 𝑥2 + 𝑥3 + 𝑥4 + 𝑥5 = 20

By Theorem 2 with 𝑛 = 5 and 𝑟 = 20 there are

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(5 + 20 − 1,20) = 𝐶(24,20) = 𝐶(24,4) = 10,626


of them.

b) Substitute 𝑥𝑖 = 𝑥𝑖′ + 2 into the equation for each i; thus 𝑥𝑖′ is the value that 𝑥𝑖 has in excess of
its required 2. Then the problem asks for the number of nonnegative solutions to

𝑥1 + 𝑥2 + 𝑥3 + 𝑥4 + 𝑥5 = 21

𝑥1′ + 2 + 𝑥2′ + 2 + 𝑥3′ + 2 + 𝑥4′ + 2 + 𝑥5′ + 2 = 21

𝑥1′ + 𝑥2′ + 𝑥3′ + 𝑥4′ + 𝑥5′ = 11

By Theorem 2 with 𝑛 = 5 and 𝑟 = 11 there are

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(5 + 11 − 1,11) = 𝐶(15,11) = 𝐶(15,4) = 1365


of them.

c) With 𝑛 = 5 and 𝑟 = 21 there are

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(5 + 21 − 1,21) = 𝐶(25,21) = 𝐶(25,4) = 12650

solutions with no restriction on 𝑥1 . The restriction on 𝑥1 will be violated if 𝑥1 ≥ 11. Following


the procedure in part (a), we find that there are

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(5 + 10 − 1,10) = 𝐶(14,10) = 𝐶(14,4) = 1001

solutions in which the restriction is violated. Therefore, there are

12650 − 1001 = 11,649

solutions of the equation with its restriction.

d) First let us impose the restrictions that 𝑥3 ≥ 15 and 𝑥2 ≥ 1. Then the problem is equivalent to
counting the number of solutions to

𝑥1 + 𝑥2′ + 1 + 𝑥3′ + 15 + 𝑥4 + 𝑥5 = 21

𝑥1 + 𝑥2′ + 𝑥3′ + 𝑥4 + 𝑥5 = 21 − 16

𝑥1 + 𝑥2′ + 𝑥3′ + 𝑥4 + 𝑥5 = 5

subject to the constraints that 𝑥1 ≤ 3 and 𝑥2′ ≤ 2 (the latter coming from the original restriction
that 𝑥2 < 4).
Note that these two restrictions cannot be violated simultaneously. Thus, if we count the number
of solutions to
𝑥1 + 𝑥2′ + 𝑥3′ + 𝑥4 + 𝑥5 = 5

subtract the number of its solutions in which 𝑥1 ≥ 4, and subtract the numbers of its solutions in
which 𝑥2′ ≥ 3, then we will have the answer.
By Theorem 2 there are

𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(5 + 5 − 1,5) = 𝐶(9,5) = 126

solutions of the unrestricted equation.


Applying the first restriction reduces the equation to
𝑥1 + 𝑥2′ + 𝑥3′ + 𝑥4 + 𝑥5 = 5

𝑥1′ + 4 + 𝑥2′ + 𝑥3′ + 𝑥4 + 𝑥5 = 5

𝑥1′ + 𝑥2′ + 𝑥3′ + 𝑥4 + 𝑥5 = 1

which has
𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(5 + 1 − 1,1) = 𝐶(5,1) = 5

solutions.
Applying the second restriction reduces the equation to
𝑥1 + 𝑥2′ + 𝑥3′ + 𝑥4 + 𝑥5 = 5

𝑥1 + 𝑥2′′ + 3 + 𝑥3′ + 𝑥4 + 𝑥5 = 5

𝑥1 + 𝑥2′′ + 𝑥3′ + 𝑥4 + 𝑥5 = 2

which has
𝐶(𝑛 + 𝑟 − 1, 𝑟) = 𝐶(5 + 2 − 1,2) = 𝐶(6,2) = 15
solutions.
Therefore, the answer is
126 − 5 − 15 = 106
CH # 06: Advanced Counting Techniques
Section 6.1: Recurrence Relations

Q # 22 (6):
a) Find a recurrence relation for the number of strictly increasing sequences of positive integers
that have 1 as their first term and 𝑛 as their last term, where 𝑛 is a positive integer. That is,
sequences 𝑎1 , 𝑎2 , … , 𝑎𝑘 , where 𝑎1 = 1, 𝑎𝑘 = 𝑛, and 𝑎𝑗 < 𝑎𝑗+1 for 𝑗 = 1, 2, … , 𝑘 − 1.
b) What are the initial conditions?
c) How many sequences of the type described in (a) are there when 𝑛 is an integer with 𝑛 ≥ 2?
Solution:
a) Let 𝑠𝑛 be the number of such sequences. A string ending in 𝑛 must consist of a string ending
in something less than 𝑛, followed by an 𝑛 as the last term. Therefore, the recurrence relation is
𝑠𝑛 = 𝑠𝑛−1 + 𝑠𝑛−2 + ⋯ + 𝑠2 + 𝑠1
Here is another approach, with a more compact form of the answer. A sequence ending in 𝑛 is
either a sequence ending in 𝑛 − 1, followed by 𝑛 (and there are clearly 𝑠𝑛−1 of these), or else it
does not contain 𝑛 − 1 as a term at all, in which case it is identical to a sequence ending in 𝑛 − 1
in which the 𝑛 − 1 has been replaced by an 𝑛 (and there are clearly 𝑠𝑛−1 of these as well).
Therefore 𝑠𝑛 = 2𝑠𝑛−1 .
Finally, we notice that we can derive the second form from the first (or vice versa) algebraically
(for example, 𝑠4 = 2𝑠3 = 𝑠3 + 𝑠3 = 𝑠3 + 𝑠2 + 𝑠2 = 𝑠3 + 𝑠2 + 𝑠1 ).
b) We need two initial conditions if we use the second formulation above, 𝑠1 = 1 and 𝑠2 = 1
(Otherwise, our argument is invalid, because the first and last terms are the same). There is one
sequence ending in 1, namely the sequence with just this 1 in it, and there is only the sequence 1,
2 ending in 2. If we use the first formulation above, then we can get by with just the initial
condition 𝑠1 = 1.
c) Clearly the solution to this recurrence relation and initial condition is 𝑠𝑛 = 2𝑛−2 for all 𝑛 ≥ 2.

Q # 42 (26):
a) Find a recurrence relation for the number of ways to completely cover a 2 × 𝑛 chessboard
with 1 × 2 dominoes. [Hint: Consider separately the coverings where the position in the top right
corner of the chessboard is covered by a domino positioned horizontally and where it is covered
by a domino positioned vertically.]
b) What are the initial conditions for the recurrence relation in part (a)?
c) How many ways are there to completely cover a 2 × 17 checkerboard with 1 × 2 dominoes?
Solution:
Let an be the number of coverings.
a) We follow the hint. If the right-most domino is positioned vertically, then we have a covering
of the leftmost 𝑛 − 1 columns, and this can be done in 𝑎𝑛−1 ways. If the right-most domino is
positioned horizontally, then there must be another domino directly beneath it, and these together
cover the last two columns. The first 𝑛 − 2 columns therefore will need to contain a covering by
dominoes, and this can be done in 𝑎𝑛−2 ways.
Thus, we obtain the Fibonacci recurrence 𝑎𝑛 = 𝑎𝑛−1 + 𝑎𝑛−2 .
b) Clearly 𝑎1 = 1 and 𝑎2 = 2.
c) The sequence we obtain is just the Fibonacci sequence, shifted by one. The sequence is thus
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, … ,
So, the answer to this part is 2584.

Q # 45 (29):
Let 𝑆(𝑚, 𝑛) denote the number of onto functions from a set with 𝑚 elements to a set with 𝑛
elements. Show that 𝑆(𝑚, 𝑛) satisfies the recurrence relation
𝑛−1
𝑚
𝑆(𝑚, 𝑛) = 𝑛 − ∑ 𝐶(𝑛, 𝑘)𝑆(𝑚, 𝑘)
𝑘=1

Whenever 𝑚 ≥ 𝑛 and 𝑛 > 1, with the initial condition 𝑆(𝑚, 1) = 1.


Solution:
If the codomain has only one element, then there is only one function (namely the function that
takes each element of the domain to the unique element of the codomain). Therefore when 𝑛 = 1
we have 𝑆(𝑚, 𝑛) = 𝑆(𝑚, 1) = 1, the initial condition we are asked to verify. Now assume that
𝑚 ≥ 𝑛 > 1, and we want to count 𝑆(𝑚, 𝑛), the number of functions from a domain with 𝑚
elements onto a codomain with 𝑛 elements. The form of the recurrence relation we are supposed
to verify suggests that what we want to do is to look at the non-onto functions. There are 𝑛𝑚
functions from the m-set to the n-set altogether (by the product rule, since we need to choose an
element from the n-set, which can be done in n ways, a total of m times).
Therefore, we must show that there are ∑𝑛−1
𝑘=1 𝐶(𝑛, 𝑘)𝑆(𝑚, 𝑘) functions from the domain to the

codomain that are not onto.


First, we use the sum rule and break this count down into the disjoint cases determined by the
number of elements-let us call it 𝑘-in the range of the function. Since we want the function not to
be onto, 𝑘 can have any value from 1 to 𝑛 − 1, but 𝑘 cannot equal 𝑛. Once we have specified 𝑘,
in order to specify a function we need to first specify the actual range, and this can be done in
𝐶(𝑛, 𝑘) ways, namely choosing the subset of 𝑘 elements from the codomain that are to constitute
the range;
and second choose an onto function from the domain to this set of 𝑘 elements. This latter task
can be done in 𝑆(𝑚, 𝑘) ways, since (and here is the key recursive point) we are defining 𝑆(𝑚, 𝑘)
to be precisely this number.
Therefore, by the product rule there are 𝐶(𝑛, 𝑘)𝑆(𝑚, 𝑘) different functions with our original
domain having a range of 𝑘 elements, and so by the sum rule there are ∑𝑛−1
𝑘=1 𝐶(𝑛, 𝑘)𝑆(𝑚, 𝑘)

non-onto functions from our original domain to our original codomain.


Note that this two-dimensional recurrence relation can be used to compute 𝑆(𝑚, 𝑛) for any
desired positive integers 𝑚 and 𝑛. Using it is much easier than trying to list all onto functions.

Q # 48 (32):
In the Tower of Hanoi puzzle, suppose our goal is to transfer all 𝑛 disks from peg 1 to peg 3, but
we cannot move a disk directly between pegs 1 and 3. Each move of a disk must be a move
involving peg 2. As usual, we cannot place a disk on top of a smaller disk.
a) Find a recurrence relation for the number of moves required to solve the puzzle for n disks
with this added restriction.
b) Solve this recurrence relation to find a formula for the number of moves required to solve the
puzzle for 𝑛 disks.
c) How many different arrangements are there of the 𝑛 disks on three pegs so that no disk is on
top of a smaller disk?
d) Show that every allowable arrangement of the 𝑛 disks occurs in the solution of this variation
of the puzzle.
Solution:
We let an be the number of moves required for this puzzle.
a) In order to move the bottom disk off peg 1, we must have transferred the other 𝑛 − 1 disks to
peg 3 (since we must move the bottom disk to peg 2); this will require 𝑎𝑛−1 steps. Then we can
move the bottom disk to peg 2 (one more step). Our goal, though, was to move it to peg 3, so
now we must move the other 𝑛 − 1 disks from peg 3 back to peg 1, leaving the bottom disk
quietly resting on peg 2. By symmetry, this again takes 𝑎𝑛−1 steps.
One more step lets us move the bottom disk from peg 2 to peg 3. Now it takes 𝑎𝑛−1 steps to
move the remaining disks from peg 1 to peg 3.
So, our recurrence relation is 𝑎𝑛 = 3𝑎𝑛−1 + 2. The initial condition is of course that 𝑎0 = 0.
b) Computing the first few values, we find that 𝑎1 = 2, 𝑎2 = 8, 𝑎3 = 26, 𝑎𝑛𝑑 𝑎4 = 80.
It appears that 𝑎𝑛 = 3𝑛 − 1. This is easily verified by induction: The base case is
𝑎0 = 30 − 1 = 1 − 1 = 0,
and
3𝑎𝑛−1 + 2 = 3 ∙ (3𝑛−1 − 1) + 2 = 3𝑛 − 3 + 2 = 3𝑛 − 1 = 𝑎𝑛
c) The only choice in distributing the disks is which peg each disk goes on, since the order of the
disks on a given peg is fixed. Since there are three choices for each disk, the answer is 3𝑛 .
d) The puzzle involves 1 + 𝑎𝑛 = 3𝑛 arrangements of disks during its solution—the initial
arrangement and the arrangement after each move. None of these arrangements can repeat a
previous arrangement, since if it did so, there would have been no point in making the moves
between the two occurrences of the same arrangement.
Therefore, these 3𝑛 arrangements are all distinct. We saw in part (c) that there are exactly 3𝑛
arrangements, so every arrangement was used.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy