counting basics: be careful of the boundary conditions try to come up with a general rule
TRANSCRIPT
Counting
Basics:
• Be careful of the boundary conditions
• Try to come up with a general rule
Example #1
How many integers are less than 600 but greater than 500?
• Be careful of the boundary, not to include 500 nor 600.
• Answer: 599 – 500 = 99
Example #2Jim has a yard that is 60 yard long and 30 yard wide. If he places a host at each corner and places other posts three yards apart along the edge. How many posts are placed surrounding the yard?
• Be careful not to over count corner posts
• Set the pattern: each line with one corner
1*3, 2*3, …10x3; total 10 posts
10 posts
1*3, 2*3, …, 20*3; total 20 posts
20 posts
• Answer: 20 + 10 + 20 + 10 = 60 posts
Venn Diagrams
• Useful when counting among categories that may have overlapping entries
• Working from inside-out helps
Example #3At a party gathering, 19 person have a brother, 15 person have a sister, 7 person have both a brother and a sister, and 6 person don't have any siblings at all. How many person are at the party?
• Recognizing there are 2 categories: having a brother, having a sister.
• Draw the Venn diagrams accordingly.
• Answer: 7 + 12 + 8 + 6 = 33
Only have a brother:19 – 7 = 12
Only havea sister:15 – 7 = 8
Have no brother nor sister: 6
Have bothbrother &sister: 7
Example #4Every student in a classroom has at least one pet. 30 have a cat, 28 have a dog, and 26 have fish. If 13 students have fist and a cat, 15 students have fish and a dog, 11 students have both a cat and a dog, and 4 students have a cat, a dog, and fish. How many students in the classroom?
• Recognizing there are 3 categories: have a cat, have a dog, or have fish. • Draw the Venn diagrams accordingly.
• Answer: 4 + 7 + 9+ 11 + 8+ 8 + 2 = 49
4
11 – 4 = 7
13 – 4 = 915 – 4 = 11
Dog only:30–7–4–11= 8
Cat only:28-7-4-9 = 8
Fish only:26 –4–9–11 = 2
Example #5How many of the smallest 1000 positive integers are divisible by 5, 6, or 7?
• Recognizing there are 3 categories: div by 5, div by 6, div by 7.
• Draw the Venn diagrams accordingly.
Answer: (div-by-5: 200) + (div-by-6: 166)+ (div-by-7: 142) - (div-by-5&6: 33) - (div-by-5&7: 28) - (div-by-6&7: 23) + (div-by-5&6&7: 4)
4
Div by5&6: 33
div by6&7: 23
div by5&7: 28
Div by 5 onlyDiv by 6 only
Div by 7 only
= 200 + 166 + 142 – 33 – 28 – 23 + 4 = 428
Bowling pins and handshakes
• How many pins in the diagram?
Answer: 1 + 2 + 3 + 4 = 10
• What about: 1 + 2 + 3 + … + 100 = ?
Example #6: 1 + 2 + 3 + … + 100 = ?
Assume S = 1 + 2 + 3 + … + 100
we can also write S = 100 + 99 + 98 + … + 1
pair them as shown in circles, we got:
2 * S = 101 * 100 Thus S = 101 * 1000 / 2 = 5050
Fundamental counting principle
If there are m ways that one event can happen, and n ways a second event can happen, then there are m*n ways that both events can happen.
Example #7How many 10 digit whole numbers use only the digits 1 and 0?
• Note that the first digit can’t be 0, and all other digits have 2 choices.
• Answer: 1 * 29 = 512
Example #8How many squares can be formed by 4 of the dots in the unit grid as vertices?
• Keeping organized.
• Recognize all possible category
Example #8
• # of unit square: 9• # of 2x2 square: 4• # of 3x3 square: 1• # of 2x2 diagonal square: 2
• Answer: 9 + 4 + 1 + 2 + 4 = 20• # of 1x1 diagonal square: 4
Factorials and permutations
n ! = n * (n – 1) * (n – 2 ) … * 2 * 1
Example:
How many different "words" can be formed by re-arranging the letters in the word "COUNT"?
Answer: 5! = 5 * 4 * 3 * 2 * 1 = 120
Example # 9
How many different 8 letter "words" can be formed by re-arranging the letters in the word "GEEEETRY"?
• Think of E1 and E2 as two different characters first, we got total # of words: 8!
• Then remove the duplicates, we get the answer: 8! / 2 = 20160
Permutation with restrictions
How many even five digit numbers contains each of the digits 1 through 5?
Working from the last digit, we got:
answer = 2 * 4 * 3 * 2 * 1 = 48
Combinations
• Permutation where the sequence of the elements doesn’t count.
• Can be calculated by removing the repeated ones from the permutation result.
Combination = (permutation of the whole set) / (permutation of the selected set)
Example #10
Remy wants to drink 3 different sodas from a list of 8 sodas. How many different soda combinations he can choose to drink?
• Permutation of the whole set: 8 * 7 * 6
• Permutation of selected set: 3 * 2 * 1
• # of combinations: (8 * 7 * 6) / (3 * 2 * 1)
• Answer: 56
Example #11Tracing the lines starting from A on the unit grid below, how many distinct 7-unit paths are there from A to B?
Example #11
Must move 3 Up-moves in seven moves, and 4 Right moves in seven moves. Thus the question becomes: How many ways to put 4 Rs in 7 slots.
Ways to put 4 Rs in 7 slots: 7 * 6 * 5 * 4 ; divide by the repeated ones: 4 * 3 * 2 * 1, we got the answer: 7*6*5*4 / (4*3*2*1) = 35
Complementary counting
Total # of desired = total # - the # that we don’t want
(Hint: use this strategy if the desired set is a union of different sets)
Example #11
Paul flits a fair coin eight times. In how many ways can he flip at least two heads?
Total count: 28; Count for no head: 1Count for 1 head: 8
Use complementary counting, the answer is: 28 – 1 – 8 = 247