with partial condensed solutions

Discrete Mathematics
Review Counting Problems — with condensed solutions
1. How many ways are there to select a group of 5 women from 16 husband/wife teams?
answer: 4368 = C(16, 5)
2. How many ways are there to arrange the 7 letters AAABBBB?
answer: 35 = 73
3. How many ways are there to arrange the 12 letters of AAABBBBCCCCC without having two C’s
together?
answer: 1, 960 = C(7, 4)C(8, 5). First arrange the A’s and B’s. Then choose 5 of the 8 interstices in
which to place the C’s.
4. How many ways are there to seat 10 people in a row?
answer: 3, 628, 800 = 10!
5. How many ways are there to seat 10 people at a round table?
answer: 362, 880 = 9!. The point to be aware of here is that if the table is rotated then the relative positions
of the people remains the same. So to set this problem up, first fix a seat where the first person is to sit. Then
there will be 9 possibilities for the person sitting to his or her left, then 8 choices to fill in the seat to the left of
the second person, and so on.
6. How many distinguishable dominoes are there? (Each of the two ends of domino has 0 to 6 dots on it.)
answer: 28 = C(8, 2). Think of arranging 6 bars to separate 7 compartments corresponding to the 7
digits from 0 to 7, then arrange two stars to represent the two sides of the domino.
7. How many ways can 14 men and 9 women be seated in a row so that no 2 women sit next to each other?
answer: 158, 334, 467, 844, 833, 280, 000 = 14! · C(15, 9) · 9!. Arrange the men first then choose 9 of
15 interstices in which to sit the women, and finally choose an ordering of the 9 women. (NOTE: The
original posted answer was calculated incorrectly.)
8. How many ways are there to select 10 cans of soda from 4 different brands?
answer: 286 = C(13, 3). (3 bars and 10 stars.)
9. How many ways can 22 cans of beer be handed out to 4 people if everyone must get at least one can?
answer: 1, 330 = C(21, 3). First give one can to each person. Then have 18 stars (for the remaining
cans) and 3 bars (creating compartments for the 4 people).
10. How many ways are there to pick 9 cans from a tub containing 8 cans of 57 different varieties of soda?
answer: 31, 966, 749, 823 = C(65, 9) − 57. (9 stars and 56 bars, but you can’t choose all 9 cans to have
the same brand.)
11. How many ways are there to distribute 5 apples and 8 oranges to 6 children?
answer: 324, 324 = C(10, 5)C(13, 8). First distribute the apples, then distribute the oranges.
12. How many ways are there to select some fruit from 5 apples and 8 oranges, taking at least one piece?
answer: 53 = 6 · 9 − 1
13. How many non-negative integers less than a billion have five 7’s?
answer: 826, 686 = C(9, 5)94 .
An integer less than a billion (which equals 109 ) can be viewed as a string of length nine consisting of integers
between 0 and 9. (Notice that in this problem it’s OK if the integer starts off with some 0’s since it is only
required to have 9 or fewer digits.) First pick five of the nine positions in which to place the 7’s then fill each of
the remaining four positions with one of the nine possible integers between 0 and 9 that aren’t equal to 7.
14. How many 5-letter words can be formed from the alphabet without repeating any letter?
answer: 7, 893, 600 = 26!/(26 − 5)! = 26!/21!
15. How many ways are there to pair off 8 women and 8 men at a dance?
answer: 40, 320 = 8!. (There are 8 choices for a partner for the first woman, then 7 choices for the second,
and so on.)
16. How many positive integer solutions are there to the equation w + x + y + z = 24?
answer: 1771 = C(23, 3).
Each of w − 1, x − 1, y − 1 and z − 1 is non-negative and (w − 1) + (x − 1) + (y − 1) + (z − 1) = 20. Now count
the number of strings of length 23 consisting of 3 bars and 20 stars (where the 3 bars create four compartments
where the number of stars respectively give the values for w − 1, x − 1, y − 1 and z − 1.)
17. How many ways are there to pick 12 letters from 12 A’s and 12 B’s?
answer: 13 = C(13, 1) which is the number of strings of length 13 with 1 bar and 12 stars (and the number
of *’s to the left of the bar determines the number of A’s to choose).
18. How many ways are there to pick 18 letters from 12 A’s and 12 B’s?
answer: 7 = C(7, 1). At least 6 A’s and 6 B’s must be taken. This leaves 6 letters to choose from 6 A’s and 6
B’s.
19. How many ways are there to pick 25 letters from 12 A’s, 12 B’s and 12 C’s?
answer: 78 = C(13, 11). First pick 11 letters from the 12 A’s, 12 B’s and 12 C’s. (The number of ways to do
this equals the number of strings of length 13 consisting of 2 bars and 11 stars, where the bars separate off three
compartments determining the number of A’s, B’s and C’s respectively.) What is left over after choosing these
11 letters will be the desired 25 letters with no more than 12 of each letter.
20. How many ways are there to select a dozen doughnuts chosen from 7 varieties with the restriction that
at least 1 doughnut of each variety is chosen?
answer: 462 = C(11, 6). (5 stars and 6 bars)
21. How many ways are there to assign 50 agents to 5 different countries so that
each country gets 10 agents?
50
answer: 48, 334, 775, 757, 901, 219, 912, 115, 629, 238, 400 = 10,10,10,10,10
22. How many ways are there to put 17 red balls into 12 distinguishable boxes with at least 1 ball in each
box?
answer: 4, 368 = C(16, 11) = C(16, 5)
23. How many ways can 9 dice fall (unordered)?
answer: 2, 002 = C(14, 5)
24. How many ways are there to arrange 5 C’s and 15 R’s with at least 2 R’s between any 2 C’s?
answer: 792 = C(12, 5)
25. How many ways are there to select 5 integers from {1, 2, . . . , 20} such that the (positive) difference
between any two of the five is at least 3?
answer: 792 = C(12, 5).
Think of arrangements with 5 stars (representing the five integers to be chosen) and 19 bars (representing 20
different boxes in which each integer is to be placed). The condition that the difference between two integers is
at least 3 means that we are only interested in arrangements that have at least 3 bars between any two successive
stars. So start by putting 3 bars between 5 stars, this leaves 7 bars to be placed in 5 possible positions.
26. How many possible outcomes (unordered) are there if k dice are tossed?
answer: C(k + 5, k)
27. How many bit strings of length 5 are there that either start with 000 or end with 111?
answer: 8
28. How many bit strings of length n where n > 5 are there that either start with 000 or end with 111?
answer: 2n−3 + 2n−3 − 2n−6 = 15 · 2n−6
29. How many 4-letter words are there with the letters in alphabetical order?
answer: 23, 751 = C(29, 25). Note that once we choose the letters to be used there is only one way to
arrange them in alphabetical order.
30. How many 4-letter words are there with no letter repeated and the letters in alphabetical order?
answer: 14, 950 = C(26, 4)
31. How many ways can we partition
18 persons into study groups of 5, 6 and 7?
18
answer: 14, 702, 688 = 5,6,7
32. How many ways can we partition 18 persons into study groups of 5, 5 and 4?
answer: 0
NOTE: This problem probably meant to ask about partions into study groups of size 5, 5 and 8, in which case
18
the answer would be 5,5,8
/2 = 5, 513, 508
33. How many ways can we partition
18 persons into 3 study groups of 6?
18
answer: 2, 858, 856 = 6,6,6
/3!
34. How many arrangements of 7 R’s and 11 B’s are there such that no two R’s are adjacent?
answer: 792 = C(12, 7) First put the B’s down. Then choose 7 out of the 12 interstices in which to
put the R’s.
35. How many ways are there to give each
of 5 children 4 of 20 distinguishable toys?
20
answer: 305, 540, 235, 000 = 4,4,4,4,4
36. How many ways can 10 men and 7 women sit in a row so that no two women are next to each other?
answer: 6, 035, 420, 160, 000 = 10!C(11, 7)7!
37. How many ways can 10 men and 7 women sit at a round table so that no two women are next to each
other?
answer: 219, 469, 824, 000 = 9!C(10, 7)7!
38. How many 3-letter words are there with no repeated letter if the middle letter is a vowel?
answer: 3, 000 = 5 · 25!/(25 − 2)! (This is not counting ‘y’ as a vowel.) Create such words in two steps:
first choosing the middle vowel and then choosing the other two letters.
39. How many 5-card poker hands are there with two pairs?
answer: 123, 552 = C(13, 2)C(4, 2)C(4, 2)C(44, 1)
First choose 2 of the 13 possible playing card denominations to identify the two pairs. (Since the two
pairs will have different denominations we will not end up with four of a kind.) Then choose 2 out of 4
cards to create the actual pairs for each of the two denominations, and finally choose 1 of the 44 cards
having denominations different from the two chosen ones.
40. How many arrangements of the letters
8 in MISSISSIPPI have at least two adjacent I’s?
11
7
answer: 27, 300 = 4,4,2,1
− 4,2,1
4
41. How many arrangements
8of the letters in MISSISSIPPI have no two I’s adjacent?
7
answer: 7, 350 = 4,2,1
4
42. How many arrangements of the letters in MISSISSIPPI have no P adjacent to an S? (Hint: Although it
is the same problem, it is easier to consider no
S adjacent to a P.)
6
C(8, 4).
answer: 4725 = C(5, 4)C(6, 2)C(7, 4) + 4,1,1
Consider two cases (1) where the two P’s are adjacent and (2) where they are not adjacent. In case (1), there
6
are 4,1,1
ways to put down one M, four I’s and one PP–once these are put down then we must choose how to
distribute four S’s in 5 interstices (two of the interstices are ruled out for being adjacent to the PP) and there
are C(8, 4) ways to do this (4 stars and 4 bars). In case (2) there are C(5, 4) ways to arrange one M and four
I’s, now choose two different interstices in which to put two P’s (there are C(6, 2) ways to do this) and finally
we must choose how to distribute four S’s in 4 interstices (four of the interstices are ruled out for being adjacent
to a P) and there are C(7, 4) ways to do this (4 stars and 3 bars).
43. How many possible outcomes are there if a pair of dodecahedral dice, with sides numbered 1 through
12, are thrown?
answer: 78 = C(13, 2)
44. How many different selections of fruit can be made from 5 oranges and 7 apples?
answer: 6 · 8 = 48
45. How many different words of at least one letter can be made from 3 A’s and 3 B’s?
answer: 68 = 2 + 22 + 23 + (24 − 2) + (25 − 2 − 10) + C(6, 3). (This represents counting the words of
length 1 through 6 separately and then adding them together using the addition principle.)
46. How many ways can we partition mn distinguishable objects into m piles of n objects each?
mn
answer: n,n,···
,n /m!
47. How many 5-letter words using only A’s, B’s, C’s and D’s are there that do not contain the word BAD?
answer: 976 = 45 − 3 · 42 (If BAD occurs then its either in positions 1-3, or 2-4 or 3-5, and so we
calculate the number of 5-letter words which do contain BAD as 3 · 42 .)
48. How many 10-letter words using only A’s, B’s, C’s and D’s are there that either start or end with BAD
are there?
answer: 32, 512 = 47 + 47 − 44 . (There are 44 words that both start and end with BAD, so we must
use PIE.)
49. How many 10-letter words using only A’s, B’s, C’s and D’s are there which have 3 A’s, 2 B’s and 3 C’s
but do not contain the word
AB?
10
8
8
answer: 11, 760 = 3,2,3,2
− 9 2,1,3,2
− 2,1,3,2
10
The total number of words with 3 A’s, 2 B’s, 3 C’s and 2 D’s is 3,2,3,2
however we must subtract off the number
N of words that do contain an AB. Notice that an AB can’t occur more than twice in the word since there are
only 2 B’s. Consider first the collection of words which have two occurrences of AB. If we think of each of these
words as containing 2 AB’s, 1 A, 0 B’s, 3 C’s and 2 D’s then we can see that the number of these words is
8
. Now let Nk denote the number of words that have an AB in the k and k + 1 positions where 1 ≤ k ≤ 9.
2,1,3,2
8
Then the remaining 8 positions will be filled with 2 A’s, 1 B, 3 C’s and 2 D’s and so Nk = 2,1,3,2
for each k.
8
However when we form the sum N1 + · · · + N9 to obtain 9 2,1,3,2
we will have counted each word that has two
8
AB’s in it exactly twice. So to obtain N we must subtract the number 2,1,3,2
of words with two AB’s.
50. How many bit strings of length twelve don’t include a ‘01’ substring?
answer: 13 (A string with this property must consist of a substring of 1’s followed by a substring of
0’s. The length of the initial string of 1’s is an integer between 0 and 12 inclusive. )
51. How many bit strings of length 12 don’t contain a ‘11’ substring?
answer: 377
There can be at most six 1’s in a string with this property. We can describe the set of strings satisfying the
property as the union of seven sets A0 , . . . , A7 , where Ak consists of strings whose number of 1’s equals k. Then
|Ak | = C(13 − k, 13 − 2k), and by the addition principle the number of strings in the union of the seven sets is
C(13, 13) + C(12, 11) + C(11, 9) + C(10, 7) + C(9, 5) + C(8, 3) + C(7, 1) = 377.
52. How many non-negative integer solutions are there to the equation
x1 + x2 + x3 + x4 + x5 + x6 = 32?
answer: 435, 897 = C(37, 5) (5 bars and 32 stars)
53. How many positive integer solutions are there to the equation
x1 + x2 + x3 + x4 + x5 + x6 = 32?
answer: 169, 911 = C(31, 5) (5 bars and 32 − 6 stars)
54. How many positive integer solutions are there to the inequality
x1 + x2 + x3 + x4 + x5 + x6 < 32?
(Hint: consider x1 + x2 + x3 + x4 + x5 + x6 + x7 = 32.)
answer: 736, 281 = C(31, 6) (6 bars and 32 − 7 stars)
55. How many non-negative integer solutions are there to the inequality
x1 + x2 + x3 + x4 + x5 + x6 < 32?
answer: 2, 324, 784 = C(37, 6) (6 bars and 32 − 1 stars as x7 must be positive)
56. How many arrangements of the letters
of RECURRENCERELATION
have no two vowels adjacent?
10
8
answer: 1, 309, 770, 000 = 4,2,2,1,1
C(11, 8) 4,1,1,1
57. How many arrangements of the letters of RECURRENCERELATION have the vowels in alphabetical
order?
10
answer: 1, 202, 947, 200 = C(18, 7) 4,2,2,1,1
. First choose 7 of the 18 positions in which to place the vowels
E,E,E,E,I,O,U(there is only one way to arrange them in alphabetic order). Then position the remaining letters
in the ten remaining slots.
58. How many ways can 8 persons, including Peter and Paul, sit in a row with Peter and Paul not sitting
next to each other?
answer: 30, 240 = 8! − 2 · 7! (First count the number of ways they can sit next to each other.)
59. How many ways can 8 persons, including Peter and Paul, sit at a round table with Peter and Paul
sitting next to each other?
answer: 1, 440 = 2 · 6! (Reserve the first two seats for Peter and Paul, and then arrange the rest in 6!
different ways moving around the table to the left. Then, to complete the sitting, we have two choices
for Peter and Paul according to whether Paul is to the left or to the right of Peter.)
60. How many ways can 4 persons of each of n nationalities stand in a row with each person standing next
to a fellow national?
2n
answer: 2,2,...,2
(4!)n = (2n)!(4!)n /2n
The number of pairs is 2n with each nationality represented twice. So the number of ways to arrange these pairs
2n
is 2,2,...,2
. Now we have the positions for the pairs laid out, but for each nationality there will be 4! different
ways to place the people for that nationality into the four positions slotted for them.
61. How many ways are there to distribute 30 green balls to 4 persons if Alice and Eve together get no more
than 20 and Lucky gets at least 7?
answer: 2464 = C(26, 3) − 66 − 46 − 24
Since Lucky automatically gets 7 balls there remain 23 balls to be distributed to 4 people. The total number
of ways to do this is C(26, 3) (think of equating each possible distribution with a string of 3 bars and 23 stars).
However in some of these distributions the number N of balls that Alice and Eve will end up with could be
21, 22 or 23; so for each of these cases we need to subtract off the number D of ways in which N balls can be
distributed among Alice and Eve, and 23 − N balls can be distributed to the other two. In the respective cases
where N is 21, 22 or 23, we will have D = 22 · 3 = 66, D = 23 · 2 = 46 or D = 24.