Download Solutions to counting problems

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
CmSc 175 Discrete Mathematics
Lesson 21: Solutions to Problems on Counting
1. Let A={a,b,c,d}
a. Compute the number of permutations of three elements of A.
P(4,3) = 4! / (4 – 3)! = 4! = 24
b. Compute the number of combinations of three elements of A.
C(4,3) = 4! / (3! * (4 – 3)!) = 4! / 3! = 4
2. In how many ways can we select a chairperson, vice-chairperson and a recorder from a group
of 11 persons?
P(11,3) = 11! / 8! = 11.10.9 = 990
We have 11 choices for the chairperson. Once we choose the chairperson, we have 10 choices for the
vice-chairperson (so far the number of choices is 11 * 10). Finally, we have 9 choices for the
recorder, thus the number of choices is 11 * 10 * 9 = 990
3. In how many ways can we select a committee of three from a group of 11 persons?
Here the order of the persons in the committee does not matter, so we have combinations of three
elements out of 11:
C(11,3) = 11! / (8! * 3!) = 11.10.9 / 3! = 990/6 = 165
In exercises 4-8 refer to a club consisting of 6 men and 7 women.
4. In how many ways can we select a committee of three men and four women?
Here the order does not matter, so we have combinations of 3 men out of 6: C(6,3), and
combinations of 4 women out of 7: C(7,4).
For each selection of 3 men, we have all possible selections of 4 women, therefore the total number
of selections is
C(6,3) * C(7,4)
C(6,3) = 6! / (3! * 3!) = (2*3*4*5*6) / 36 = 20
C(7,4) = 7! / (4! * 3!) = (2*3*4*5*6*7) / (6* 24) = 35
C(6,3) * C(7,4) = 20 * 35 = 700
1
5. In how many ways can we select a committee of four persons that has at least one woman?
There are two ways to solve this problem.
a) Consider all possible committees with at least one woman:
Women
Men
Choices
1
3
C(7,1) * C(6,3)
2
2
C(7,2) * C(6,2)
3
1
C(7,3) * C(6,1)
4
0
C(7,4) * C(6,0)
Then add all choices
C(7,1) = 7
C(7,2) = 7! / (2! * 5!) = (2*3*4*5*6*7) / (2*2*3*4*5) = 21
C(7,3) = 7! / (3! * 4!) = (2*3*4*5*6*7) / (2*3*2*3*4) = 35
C(7,4) = C(7,3) = 35
C(6,3) = 6!/(3! * 3!) = (2*3*4*5*6) / (2*3*2*3) = 20
C(6,2) = 6! / (2! * 4!) = (2*3*4*5*6) / (2*2*3 * 4) = 15
C(6,1) = 6
C(6,0) = 1
C(7,1) * C(6,3)
= 7 * 20
= 140
C(7,2) * C(6,2)
= 21 * 15
= 315
C(7,3) * C(6,1)
= 35 * 6
= 210
C(7,4) * C(6,0)
= 35 * 1
= 35
---------Total
700
b) All committees with at least one women are equal to the difference between all possible
committees and committees with only men.
All possible committees are C(13,4) = 13! (9! * 4!) = 10*11*12*13 / 2*3*4 = 5*11*13 = 715
Committees with only men are C(6,4) = 6! / (2! * 4!) = (2*3*4*5*6) / (2*2*3*4) = 15
Thus C(13,4) – C(6,4) = 715 – 15 = 700
2
6. In how many ways can we select a committee of four persons that has at most one man?
Consider all possible committees with at most one man:
Women
Men
Choices
3
1
C(7,3) * C(6,1)
4
0
C(7,4) * C(6,0)
C(7,3) * C(6,1) = 210 (computed in problem 5)
C(7,4) * C(6,0) = 35
Thus all possible committees with at most one man are 210 + 35 = 245
7. In how many ways can we select a committee of four persons that has persons of both sexes?
We can solve the problem in two ways as illustrated in problem 5. Here we choose the second way –
representing the choices as difference.
The number of committees with persons of both sexes is equal to the number of all possible committees
minus the sum of the choices of single-sex committees.
All possible committees are C(13,4) = 715
Committees consisting of women only are C(7,4) = 35
Committees consisting of men only are C(6,4) = C(6,2) = 15
715 – 35 – 15 = 665
8. In how many was can we select a committee of four persons so that Mabel and Ralph do not
server together?
The number of committees where Mabel and Ralph do not server together are equal to the number of all
possible committees minus the number of committees where they serve together.
All possible committees are 715
For the committees where they serve together, we need to select two persons out of 11, so their number
is
C(11,2) = 11! / (9! * 2!) = 10*11 /2 = 55
Thus the number of committees where Mabel and Ralph do not server together is 715 – 55 = 660
3
9. In how many ways can we select a committee of four Republicans, three Democrats and two
Independents from a group of 10 Republicans, 12 Democrats, and four Independents?
C(10,4) * C(12,3) * C(4,2)
10. How many eight-bit strings of 0's and 1's contain exactly three 0's?
Here we choose the positions of the 0’s in a string of length 8: C(8,3) = 8! / (3! * 5!) = 6*7*8 / 6 = 56
11. How may eight-bit strings of 0's and 1's contain three 0's in a row?
Here we choose the starting position of the three 0’s: 8 – 3 + 1 = 6
In exercises 12-20 find the number of 5 card hands from a standard deck of 52 cards that satisfy
the given conditions.
12. Containing all spades
The order of the cards in the hand does not matter, and there are 13 spades, so we have C(13,5)
13. All of the same suit
Given one particular suit, we C(13,5) choices. There are 4 suits, therefore the choices are 4*C(13,5)
14. Containing cards of exactly two suits
Given 2 suits, we have the following cases:
suit1
suit2
Choices
1
4
C(13,1) * C(13,4)
2
3
C(13,2) * C(13,3)
3
2
C(13,3) * C(13,2)
4
1
C(13,4) * C(13,1)
We can choose the two suits out of 4 suits in C(4,2) ways.
Thus the total number of choices is:
C(4,2) * (2* C(13,1) * C(13,4) + 2* (C(13,2) * C(13,3)))
4
15. Containing cards of all suits
There are 4 suits. In the hand, there will be 2 cards of the same suit and 3 cards from the other
three suits.
First we choose the suit that will have 2 cards in the hand. The choices are C(4,1) = 1
Next we choose 2 cards from that suit. The choices are C(13,2)
Finally we choose three cards of the remaining suits. The choices are independent: 13 x 13 x13
The total number of choices is
C(4,1) * C(13,2) * 133 = C(13,2) *2197 = 4*2197 * 13! / (11! * 2!) =
4* 2197 * 13 *12 / 2 = 2107 *13 *6 = 685464
16. Containing an Ace, 2, 3, 4 and 5 all of the same suit.
Since the cards are fixed, the only choice is for the suit. There are 4 suits, so the choices are 4
17. Consecutive and of the same suit. (assuming ace is the lowest card)
We can choose 5 consecutive cards in a given suit in 13 – 5 + 1 = 9 ways
There are 4 suits, thus the total number of choices is 4 * 9 = 36
18. Consecutive (assuming ace is the lowest)
For a fixed suit of each card, the choices of 5 consecutive cards are 13 – 5 + 1 = 9
Each of the 5 cards can be of any of the 4 suits, thus we have
45 * 9 = 1024 * 9 = 9216
19. Containing three of one kind and two of another kind. (full house)
The choices of the two kinds are permutations of 2 kinds out of 13: P(13,2) = 13*12 = 165
There are four cards of each kind. Thus for each choice of the 2 kinds we have choices that are
combinations C(4,2) for the 2 cards and C(4,3) for the 3 cards.
Thus the total number of choices is P(13,2) * C(4,2) * C(4,3)
20. Containing two of one kind, two of a second kind and one of a third kind.
Consider first choosing the two kinds with 2 cards of each kind. Since the order of the kinds does not
matter, the choices are C(13,2).
The fifth card can be of any of the remaining 11 kinds.
Thus for the choices of the kinds we have C(13,2)*11
2 cards of same kind can be chosen in C(4,2) ways, and one card can be chosen in 4 ways.
5
Thus the total number of choices is
11*C(13,2)*C(4,2)*C(4,2) *C(4,1) = 11*(13*6)*6*6*4 = 20592
In exercises 21-24 a coin is flipped 10 times.
21. How many outcomes are possible?
210
22. How many outcomes have exactly three heads?
We choose the position of the heads in the string C(10,3)
23. How many outcomes have at most three heads?
Outcomes with 0 heads:
Outcomes with 1 head:
Outcomes with 2 heads:
Outcomes with 3 heads:
C(10,0) = 1
C(10,1) = 10
C(10,2) = 45
C(10,3) = 120
The sum is 176
24. How many outcomes have a head on the fifth toss?
29
25. A palindrome is a string that reads the same backwards as forwards. Consider
palindromes of digits only (decimal digits 0, 1, 2, …, 9). How many different palindromes
are there of length 6? Of length 7?
The different palindromes of length 6 are 103
The second half of the string is the same as the first half written in reverse order, so once
we choose the first three digits, the string is determined. Each digit is chosen
independently of the other digits.
Thus we have Cartesian products 10 x 10 x 10 = 1000.
The different palindromes of length 7 are 104
The last three digits are the same as the first three digits written in reverse order.
We choose the first three digits and the middle digit, i.e. the first 4 digits.
Each digit is chosen independently of the other digits.
Thus we have Cartesian products 10 x 10 x 10 x 10 = 10,000
6
26. How many 4-digit numbers less than 6000 (decimal number system) can be built using
only odd digits? Assume that numbers do not start with leading zeros.
Let the number be D1D2D3D4, where Di is the corresponding digit.
a. 4-digit numbers
D1 can be one of 1, 3, 5.
D2, D3 and D4 can be one of 1, 3, 5, 7, 9.
Thus all possible 4-digit numbers less that 6000 with odd digits are
3 x 5 x 5 x 5 = 375
b. 3-digit numbers
D2, D3, and D4 can be one of 1, 3, 5, 7, 9.
Thus all possible 3-digit numbers less that 6000 with odd digits are
5 x 5 x 5 = 125
c. 2-digit numbers
D3, and D4 can be one of 1, 3, 5, 7, 9.
Thus all possible 2-digit numbers less that 6000 with odd digits are
5 x 5 = 25
d. 1-digit numbers
D4 can be one of 1, 3, 5, 7, 9.
Here we have 5 numbers.
Total: 375 + 125 + 25 + 5 = 530
27. How many 3-digit hexadecimal numbers are there less than F00, but greater than 999? How
many of them end in 1?
Let the number be D1D2D3, where Di is the corresponding digit.
The possible values of D1 are: A, B, C, D, and E
The possible values if D2 and D3 are any digit 0 to F
Thus all possible numbers of that type are
5 x 16 x 16 = 1280
Numbers that end in 1: 5 x 16 = 80
7
28. A computer password consists of 8 characters. Allowed characters are: Letters in the
English alphabet - lower and upper case, decimal digits 0, 1, .., 9, and the underscore
symbol. The first two characters must be lower case letters.
a. How many different passwords are possible?
Since each character in the password is independently chosen, the total number of
passwords is a Cartesian product.
The first and the second characters are chosen among 26 lower-case letters.
Each of the remaining 6 characters is chosen among 63 characters – 26 lower-case letters,
26 upper-case letter, 10 digits and the underscore symbol.
Thus we have: 26 x 26 x 63 x 63 x 63 x 63 x 63 x 63 = 262 x 636 = 42,265,887,493,284
b. How many passwords with no repeated characters are possible?
The choices for the first two characters are P(26,2).
Once the first two characters are chosen, the remaining 6 characters are permutations of 6
element out of 61 element (61 because we have to exclude the two selected lower-case
letters for the first two characters)
Thus we have all choices to be P(26,2)*P(61,6)
29. How many 3-letter strings formed using letters from A, B, C, D, or E, do not start with
the letter A, if letters may be repeated?
The first position is chosen among 4 letters, the remaining positions each is
chosen among 5 letters: 4 * 5 * 5 = 100
30. How many 3-letter strings formed using letters from A, B, C, D, or E, are there that
begin with A or B, if repetition of letters is not allowed?
There are 2 choices for the first position. The remaining two positions are
permutations of 2 elements over 4 elements:
2*P(4,2)
8