The Sum Rule
例一.
A number is chosen from the set of integers from 1 to 20 inclusive. If it is either an odd number or a multiple of 4, find the number of ways to choose this number.
Solution
from the sum rule there are 10 + 5 = 15 possible ways tochoose this number.
例二.
A customer can choose a mobile phone number from one of four lists. The fourlists contain 24, 15, 32 and 10 possible numbers, respectively. How many possiblenumbers are there to choose from?
Solution
Hence, there are 24 + 15 + 32 + 10 = 81 numbers to choosefrom.
例三.
A card is drawn at random from an ordinary pack of 52 playing cards. Find the number of ways that the card is a diamond or a heart.
Solution
Let S be the set of the pack of 52 cards, D be the set of diamond cards and H be the set of heart cards
13 + 13 = 26
The Product Rule
例一.
The seats in a mass lecture hall are to be labeled with a letter and a positive integernot greater than 10. How many seats can be labeled differently?
Solution
By the product rule, there are 26 × 10 = 260 ways to label a seat.Therefore, 260 seats can be labeled differently
例二.
A password on a computer system consists of six characters. Each of thesecharacters must be a digit. How many passwords are there?
SolutionEach of the six characters can be chosen in 10 ways, since each digit is from 0 to 9.Therefore, by the product rule, there are 106 = 1,000,000 different passwords.
例三.
Suppose the name of a variable in a computer language can be either a single letteror a letter followed by a digit. Find the number of possible names
Solution
26 + 260 = 286.
The Inclusion-Exclusion Principle
例一.
Count the number of bit strings of length ten which begin with a 1010 or end with a 00.
Solution
64 + 256 – 16 = 304, i.e. there is 304 number of bit stringsof length ten begin with a 1010 or end with a 00.
例二.
In a class of 40 students, 25 students take computer science and 30 students takeadditional mathematics. All the 40 students must take at least one of these subjects.How many students take both subjects?
Solution
C ∪ A = C + A - C ∩ A
40 = 25 + 30 - C ∩ A
C ∩ A = 15
i.e. 15 students take both subjects.
沒有留言:
張貼留言