https://slides.com/georgelee/ics141-basics-counting/live
Suppose a procedure can be broken down into a sequence of two tasks. If there are m ways to do task 1 and n ways to do task 2, then there are m*n ways to do the procedure.
Poker has a hand with 5 cards. How many total poker hands are there?
How many ways are there to make a royal flush? A straight flush?
Given a task, if the task can be done in either m ways or n ways, where neither of the ways overlap, then there are m + n ways to do the task.
There are 5 letter grades and 3 status codes that may be put on your transcript for this class. How many possible values are there for this class on your transcript?
When doing the sum rule, if there are tasks that overlap with each other, you must subtract it out to avoid double counting.
This is the Inclusion-Exclusion principle
If you have two colors of socks in a drawer, how many socks do you need to pull out to guarantee that you have two socks of the same color?
"If I have 21 pigeons and 20 pigeonholes, then there must be at least one hole that has two pigeons".
Formally: If k is a positive integer and k + 1 or more objects are placed into k boxes, then there is at least one box containing two or more of the objects.
If N objects are placed into k boxes, then there is one box with at least ⌈N/k⌉ objects.
Example: How many students must be in a class to ensure that 5 of them get the same letter grade?
There are five possible grades and we need a box with at least 5. So we have ⌈N/5⌉ = 5. The smallest integer is
5 * 4 + 1 = 21.
Chapter 6.2 Example 10:
During a month with 30 days, a baseball team plays at least one game a day, but no more than 45 games. Show that there must be a period of some number of consecutive days during which the team must play exactly 14 games.