MATH 13150: Freshman Seminar Unit 5 1. The Subtraction Principle in Counting

Transcription

MATH 13150: Freshman Seminar Unit 5 1. The Subtraction Principle in Counting
MATH 13150: Freshman Seminar
Unit 5
1. The Subtraction Principle in Counting
1.1. Basic idea. Suppose we ask ourselves the question:
QUESTION : How many states in the United States do not touch the Pacific Ocean?
One approach to solving this would be to list all fifty states and put a “Y” beside
each one that does not touch the Pacific, and then count all the “Y”’s. If you try
doing this, you’ll see how long it can take. Look at the start of the list:
Alabama Y, Alaska, Arizona Y, Arkansas Y, California, ....
A better approach is to realize that there are 50 states altogether, and further that
the answer to our question is:
(The total number of states) - (The number of states that do touch the Pacific)
Since there are 50 states altogether, and the only states that touch the Pacific are
California, Oregon, Washington, Alaska, and Hawaii, we see that the answer is
ANSWER: 50 - 5 = 45.
This argument illustrates the subtraction principle which says:
SUBTRACTION PRINCIPLE: The number of objects in a collection that satisfy
some condition equals the total number of objects that satisfy the condition minus
the number of objects that don’t satisfy the condition.
As another illustration, note that if we want to count the number of consonants in
the English language, the easiest way is to count the five vowels “A, E, I, O, U”, so
that there are
26 − 5 = 21 consonants.
1.2. Avoiding unpleasant license plates and other problems. EXAMPLE 1:
Suppose a license plate is to consist of 3 letters, following by 3 digits. How many
license plates are allowed if the letters “A”, “S”, “S” may not appear in that order
in a license plate (the state in question has people with an antipathy for donkeys in
the state government).
The subtraction principle helps here. Indeed, it tells us that
ANSWER = TOTAL # OF LICENSE PLATES
1
MINUS # OF LICENSE PLATES WITH A-S-S APPEARING IN SEQUENCE.
It is easy to count the total number of license plates. It is 263 × 103 , since there are
26 ways to choose each of the 3 letters, and 10 ways to choose each of the 3 digits.
Now we count the number of “A-S-S” license plates. The 3 letters are fixed, since the
first letter is A, the second letter is S, and the third letter is S. There are 10 ways
to choose each of the 3 digits, giving 1 × 1 × 1 × 10 × 10 × 10 = 103 ways to choose
these license plates.
We conclude that the answer to our problem is
263 × 103 − 103 = 17, 575, 000.
EXAMPLE 2: How many 4 letter English words are there with at least one vowel?
As before, a 4 letter English word is any sequence of 4 English letters, so SPTI and
SPIT both count. A 4 letter English word that does not have at least one vowel is a
word with all letters consonants. By the subtraction principle, the answer is:
ANSWER = TOTAL # OF 4 LETTER ENGLISH WORDS
MINUS # WITH ONLY CONSONANTS
The total number of 4 letter English words is 264 .
The total number of 4 letter English words with only consonants is 214 . Indeed, each
letter in the word can be filled in 21 ways, so the multiplication principle gives the
answer.
It follows that the answer to the problem of Example 2 is:
264 − 214 = 262, 495.
EXAMPLE 3 : How many numbers from 24 to 135 are not divisible by 3?
By the subtraction principle, the answer is:
The # of numbers from 24 to 135
minus the # of numbers from 24 to 135 divisible by 3.
Fortunately, in Unit 1, we learned how to count both of these. The number of numbers
from 24 to 135 is 135 − 24 + 1 = 112.
The number of numbers from 24 to 135 can be obtained by dividing each multiple of
3 from 24 to 135 by 3, giving the list:
24
135
,
8 = , 9, 10, 11, . . . , 45 =
3
3
which has 45 − 8 + 1 = 38 numbers.
This means that the answer to the problem of Example 3 is
112 − 38 = 104.
Note that we can count the number of odd numbers from 44 to 176 by this method,
since an odd number is a number that is not divisible by 2. Try it. You should get
the same answer as for problem 6 of Unit 1, i.e., 66.
1.3. Keeping fighting kids apart. QUESTION 1 : Suppose a camp counselor has
4 kids to line-up, and two of them, Duncan and Daniel are fighting. How many ways
can the counselor line up the kids so that Duncan and Daniel are not next to each
other?
To answer this question, use the subtraction principle to see that:
ANSWER = TOTAL # OF WAYS TO LINE UP 4 KIDS
MINUS # OF WAYS WITH DUNCAN NEXT TO DANIEL.
The total number of ways to line up 4 kids is 4! = 24, using the multiplication
principle.
Counting the number of ways that Duncan can be next to Daniel is a bit more
involved. We count them by adding up
NUMBER OF SUCH LINE-UPS WITH DUNCAN 1ST
+ NUMBER OF SUCH LINE-UPS WITH DUNCAN 2ND
+ NUMBER OF SUCH LINE-UPS WITH DUNCAN 3RD
+ NUMBER OF SUCH LINE-UPS WITH DUNCAN 4TH.
Since Duncan has to be 1st, 2nd, 3rd, or 4th, that takes care of all of the possibilities.
Let’s count the number of line-ups with Duncan 1st, and Daniel next to Duncan. To
be next to Duncan, Daniel has to be 2nd. There are two kids left, so there are 2 ways
to pick the 3rd kid, and one way to place the last kid in line. This gives 2 × 1 = 2
line-ups.
Now suppose Duncan is 2nd. Then there are two ways to place Daniel, either 1st,
or 3rd. Once Daniel has been given a place, there are two places left to fill. There
are two ways to fill one of the places, and one way to fill the last place. This gives
2 × 2 × 1 = 4 ways.
If Duncan is 3rd, there are still 4 ways to arrange the kids, as there are two ways to
place Daniel, and once Daniel has been placed, two ways to arrange the remaining
kids.
If Duncan is 4th, there are 2 ways to arrange the kids, as Daniel must be 3rd, and the
other two kids can be arranged in 2 ways. This is the mirror image of the situation
when Duncan is 1st.
This gives 2 + 4 + 4 + 2 = 12 ways total. This means the answer to our question is:
24 − 12 = 12.
QUESTION 2: Now suppose there are 10 kids, and the counselor has to line them
up so than Duncan and Daniel are not next to each other. How many ways are there
to do that?
We use the same approach. Again,
ANSWER = THE # OF WAYS TO LINE UP 10 KIDS
MINUS THE # OF WAYS TO LINE UP 10 KIDS SO DANIEL IS NEXT TO
DUNCAN.
The number of ways to line up 10 kids is 10!.
We calculate the number of ways to line up the 10 kids with Daniel next to Duncan
as:
NUMBER OF SUCH LINE-UPS WITH DUNCAN 1ST
+ NUMBER OF SUCH LINE-UPS WITH DUNCAN 2ND
+ NUMBER OF SUCH LINE-UPS WITH DUNCAN 3RD
+ NUMBER OF SUCH LINE-UPS WITH DUNCAN 4TH.
...
+ NUMBER OF SUCH LINE-UPS WITH DUNCAN 9TH
+ NUMBER OF SUCH LINE-UPS WITH DUNCAN 10th
Let’s count the number of ways with Duncan 1st. If Duncan is 1st, then Daniel must
be 2nd to be next to Duncan. There are 8 spaces left to fill, and they may be filled
in any order with the remaining 8 kids. Since there are 8! ways to arrange 8 kids in
order, that gives 8! line-ups with Duncan 1st.
It is not hard to see that there are also 8! ways with Duncan 10th.
Let’s count the number of ways with Duncan 2nd. If Duncan is 2nd, then Daniel
must be 1st or 3rd, so there are 2 places for Daniel to be, which gives 2 ways. Once
Daniel’s place is determined, there are 8 spaces left to be filled by 8 kids, so that gives
8! ways. This means there are 2 × 8! ways for Duncan to be 2nd.
The same reasoning shows that there are also 2 × 8! ways for Duncan to be 3rd, 4th,
5th, ..., 8th, or 9th.
Thus, if Duncan is anywhere from 2nd to 9th, there are 2 × 8! ways to line up the
kids. Since there are 8 possible places from 2nd to 9th, this gives 8 × 2 × 8! ways from
these places.
Thus, the number of ways for Duncan to be next to Daniel is:
8! + 8 × 2 × 8! + 8! = 18 × 8!.
It follows that the answer to the question is:
10! − 18 × 8! = (9 · 10) · 8! − 18 · 8! = 72 · 8!.
QUESTION: A class has 10 boys and 8 girls, and is picking a co-ed three person
committee, where co-ed means that the committee cannot be all boys or all girls.
How many committees can be formed?
To solve this, use the subtraction principle to note that:
(# of co-ed 3 person committees) = (Total # of 3 person committees)
MINUS (# of all boy 3 person committees ) MINUS (# of all girl 3 person committees).
18
To count these, note that the total number of 3 person committees is
, since
3
the class has 18 people altogether.
10
The number of all boy 3 person committees is
3 8
and the number of all girl 3 person committees is
.
3
It follows that our answer is:
18
10
8
ANSWER :
−
−
.
3
3
3
1.4. Multiple subtractions. Some subtraction problems are a bit more complicated.
QUESTION: How many states in the United States neither touch the Pacific Ocean
nor touch Idaho. California, Oregon, Washington, Alaska, and Hawaii (5 states) all
touch the Pacific Ocean. Montana, Wyoming, Utah, Nevada, Oregon, and Washington (6 states) all touch Idaho. Using the subtraction principle, we would just
subtract:
50 − 5 − 6 = 39
But WAIT! Oregon and Washington both touch the Pacific Ocean and touch Idaho.
That means that we subtracted these states twice. So we need to add those two states
back. The real answer should be:
50 − 5 − 6 + 2 = 41
states touch neither the Pacific Ocean nor Idaho.
So if we are subtracting multiple things we need to remember to add back anything
that got subtracted twice!
QUESTION: How many numbers are there from 3 to 20 that are not divisible by 2
or 5?
The answer is:
TOTAL NUMBER OF NUMBERS FROM 3 TO 20
MINUS THE # OF NUMBERS DIVISIBLE BY 2 OR 5 The total # of numbers
from 3 to 20 is 20 - 3 + 1 = 18, by the n-k+1 formula from unit 1.
FORMULA (*) : The # of numbers divisible by 2 or 5 is: The number of numbers
divisible by 2
+ the number of numbers divisible by 5
- the number of numbers divisible by 10 This takes some thought to justify. To see
why it works, list the numbers from 3 to 20:
3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20.
List the numbers divisible by 2:
4, 6, 8, 10, 12, 14, 16, 18, 20.
List the numbers divisible by 5:
5, 10, 15, 20.
Then if we count the numbers divisible by 2 or 5, we get:
4, 6, 8, 10, 12, 14, 16, 18, 20, 5, 10, 15, 20.
The numbers 10 and 20 appear twice on the list, but we don’t want to count them
twice. The way to fix this is to subtract off the numbers divisible by 10. This is
because numbers divisible by both 2 and 5 are the numbers divisible by 10. This
gives formula (*). The # of numbers from 3 to 20 divisible by 2 is 9.
The # of numbers from 3 to 20 divisible by 5 is 4.
The # of numbers from 3 to 20 divisible by 10 is 2.
Thus, formula (*) says that that there are:
9 + 4 − 2 = 11
numbers from 3 to 20 divisible by 2 or 5. It follows that there are 18−11 = 7 numbers
from 3 to 20 not divisible by 2 or 5, which answers QUESTION 1.
QUESTION 2: How many numbers from 35 to 811 are not divisible by 2 or 5.
The answer is:
TOTAL # OF NUMBERS FROM 35 TO 811
MINUS # OF NUMBERS FROM 35 TO 811 DIVISIBLE BY 2 OR 5.
The # of numbers from 35 to 811 is 811 − 35 + 1 = 777.
The same analysis as in the last problem shows the number of numbers from 35 to
811 divisible by 2 or 5 is:
# OF NUMBERS FROM 35 TO 811 DIVISIBLE BY 2 = 388
+ # OF NUMBERS FROM 35 TO 811 DIVISIBLE BY 5 = 156
MINUS # OF NUMBERS FROM 35 TO 811 DIVISIBLE BY 10 = 78
Since 388 + 156 − 78 = 466, the answer to our question is
777 − 466 = 311.
We counted the numbers divisible by 2, 5, and 10 by using the method of Unit 1.
QUESTION 3: How many 3 letter English words are there in which no letter appears
two or more times in a row?
We can solve this using multiple subtractions, but it is easier to separate the problem
into cases. Let’s see how.
First, we count the number A of 3 letter English words in which one letter occurs
exactly twice in a row.
Second, we count the number B of 3 letter English words in which one letter appears
exactly three times in a row.
Then A + B is the number of 3 letter English words in which the same letter appears
two or more times in a row.
The total # of 3 letter English words is easily seen to be 263 . Then the answer to
our question is 263 − (A + B).
We compute A. If a 3 letter English word has two letters in a row, it either looks
like XXY, or YXX, where X and Y represent any letter. Here XXY means the first
two letters are a single letter X, and the third letter is a different letter Y. There
are 26 ways to choose the letter “X” in XXY, and once “X” is chosen, there are
25 ways to choose the letter “Y”, since it can be any letter besides “X”. This gives
26 × 25 ways to choose XXY. Similarly, there are 26 × 25 ways to choose YXX. Thus,
A = 26 × 25 + 26 × 25.
We compute B. A 3 letter English word in which the same letter occurs 3 times in a
row looks like XXX, where X is any letter. There are 26 ways to choose X, so B=26.
Putting all this together, our answer is :
263 − (26 · 25 + 26 · 25 + 26) = 16, 250.
EXERCISES: Explain your answer.
(1) Suppose a math professor looks at his clean clothes and finds he has:
Three shirts, which are white, purple, and blue
Four pairs of pants, which are blue, orange, green, and yellow
Three baseball caps, which are blue, polka dot, and gray.
How many different outfits can he choose if he cannot wear a purple shirt
with orange pants?
(2) How many states in the United States of America do not begin with the letter
“R”?
(3) Suppose a license plate consists of 4 letters followed by 2 digits.
(a) How many license plates are there that do not begin with “D”.
(b) How many license plates are there where the four letters are not D-U-N-G
in sequence?
(c) How many license plates are there where the four letters are not D-U-N-G
in sequence, and the digits are not 6-9 in sequence?
(4) Suppose we have to line up 10 kids in order. How many ways are there to
do this if two of the kids, Tara and Chrissa, have to have at least two kids
between them?
(5) Suppose we have to line up 17 kids in order. How many ways are there to do
this if Tara and Chrissa cannot be next to each other?
(6) How many numbers are there from 5 to 186 that are not divisible by 2 or 7?
(7) How many numbers are there from 121 to 1236 that are not divisible by 3 or
5?
(8) Suppose a class with 23 students is to elect a president and vice-president,
and the same person cannot hold both offices. How many ways are there to
do it if two of the kids, Tara and Chrissa, cannot both be class officers?
(9) How many five letter English words are there in which no letter occurs four
or more times in a row?