In this overall lesson we:
- Consider the rules of sum and product
- The inclusion / exclusion principle
- Learn to apply the pigeonhole principle in order to prove theorems
- How two simple formulate of permutations and combinations can help to breakdown an intricate problem into more manageable pieces
Riddle: A person plays at least one round of a video game a day for 30 days. If he or she plays 40 rounds in total, in the same sequence of consecutive days, he or she plays exactly 19 rounds of games.
Counting:
How many ways can you pick an outfit if you have 5 pairs of trousers and 7 shirts? (The answer is very clearly just 35)
The Product Rule:
- There are
nways of completing the first task - There are
mways of completing the second task
This means that there are(m)(n)ways of completing this entire job.
So, if a job can be split into two tasks, then there are n ways to do the first task, and then m ways to do the second, so the total number of possible ways to do the tasks is the product of m and n.
The natural next question is what if there is more than just two different tasks? Well, you can consider this task a combination of two of these elements, and then this makes a total number of combinations for each of those two elements. Then, you simply just multiply the new task by the product of the two other tasks. So in a given way if you have 3, 5, 2 for a task, then the different number of combinations is 3*5*2=30 different combinations.
Product Rule: If there are ways of completing task . Then this means that there:
ways of completing this job, this is where k represents the different number of tasks and a given represents the value of a given task
Example:
- How many sequences of 5 letters can you make using the English Alphabet?
Well there is basically an array of 5 where each of the values in the array can be one of 26 letters, this means that you would have 5 different tasks and they each have a value of 26, so you end up with 26*26*26*26*26 = 26^5 = 118813776, meaning there is 118813776 different possible combinations.
- How many sequences of 5 letters can you make, where the first 3 letters are from English alphabet, followed by 2 digits.
Well this one is the same array of 5, meaning that there is once again 5 tasks of choosing a different character. The first three remain the same option of 26, but then the last two become different values between 0-9, giving you ten possible options, so you end up with 26*26*26*10*10 = 26^3 * 10^2 which is then equal to about 1757600 different possible combinations
Either / Or:
Now instead of a combination of two different tasks, imagine that you have a total sum of different options for a candidate or something. So 13 shirts and 7 pairs of pants, and you want to donate one to charity. How can you figure out the total number of options that you have? Well you just add the two together, and so you have 20 choices.
The Sum Rule:
If a job can be one in n ways OR in m ways, then the job can be completed in a total of m+n ways
Complex Counting:
- How many valid passwords are there?
- It has to be five to seven characters drawn from uppercase letters or digits. Every password must contain at least one uppercase letter.
The idea of every password must contain at least one uppercase letter means one or more capital letters, and this is the complement/opposite of a password with no letters at all.
We also understand that the passwords can have a length of 5, 6, or 7
So given this, you can split this up in this way:
- For passwords with a length of 5, we know that each value can have 1 of (26+10=)36 different options. So we have
36^5of all possible combinations. However, we have the rule that there must be at least one uppercase letter, meaning no all digit values are allowed, so this takes away10^5different options. So we know we have different possible combinations - With this, we can do that same for a value of 6 and 7, in the sense that now we have
36^6-10^6=2,175,782,336and36^7-10^7=78,354,164,096 - Given this, since we know we can have
5 OR 6 OR 7options, the rule of addition clearly applies here, so we add all of these values up and get different possible passwords.
Modification of the Sum Rule:
Imagine that we have two different menus to choose an option to each from, but some of the items are on both menus, so, what is the total number of different options that you can have to eat from.
My take:
Well logically speaking, you only count any of the duplicates once, and you know exactly what does that? Sets, you simply take a union of the two items (with their representation of sets), and then the total number of items in the set is the value of different options that you have.
The Subtraction Rule: / Inclusion-Exclusion Principle: If a choice can be made from two lists containing n and m items, then the number of ways to make this choice is n+m - # of items in common in the two lists.
So basically this is saying that the total number of different options that you have is the sum of all of the different options available in each item, minus the values that they share, given that each of those should only be counted once. So for the above menu example, the answer is 5+5-2 which is 8 different choices.
Example:
How many integers less than 100 are divisible by either 2 or 3. (Integers in the sense of values greater than zero)
- First, to calculate the number of integers between 1-99 that are divisible by 2, we can divide
99/2=45.5then floor it45This is because all values that are even are divisible by two. - With this logic we can then do the same with 3, getting
99/3=33, and so we know that 33 values are divisible by3. - There are numbers however that are divisible by both 2 and 3, and these are numbers divisible by
6, so we end up with99/6=16.5=16, and these are out values in common. - So we end up with
45+33-16, which gives us66numbers.
For a value where the inclusion can be between more than two given sets, what you do is you do the division and what not just the same and then round down. Then for each of the given values you have to do the subtraction for each one, and then add back the overlap between that, so:
How many positive integers less than 100 are divisible by either 2, 3, or 5?:
- First divide
99by each value then floor it:- 99 / 2 = 49
- 99 / 3 = 33
- 99 / 5 = 19
- Now, you have to subtract the overlaps for each of the integers:
- (2)(3) = 6, so 99 / 6 = 16
- (2)(5) = 10, so 99 / 10 = 9
- (5)(3) = 15, so 99 / 15 = 6
- Now you need to find the overlap for the numbers that are divisible by all three:
- (5)(3)(2) = 30, so 99 / 30 = 3
Then finally: 49 + 33 + 19 - 16 - 9 - 6 + 3 = 73 total possible values.
The Pigeonhole principle:
More pigeons than pigeonholes:
- Suppose that there are 10 pigeons, and they ll decide to rest in a set of 9 pigeon holes.
- What will the pigeonholes look like?
There is a large number of different configurations for the ways in which the pigeons could fit into the holes. Say we want to spread the pigeons more equally though, so you put one pigeon in each hole, and then only one remains, meaning it has to sit with another pigeon
The Pigeonhole principle: if there are k+1 or more objects to be placed in k boxes, there is at least one box containing more than one object. This is also known as Dirichlet drawer principle
Example:
- If 5 cards are drawn from a standard deck of 52 cards, then at least two of them are of the same suit.
- If there are more than 367 students in a class, at least 2 of them share the same birthday
- If you pick seven countries at random, at least 2 of them are on the same continent (assuming you do not count Antarctica as a continent)
The Generalized Pigeonhole Principle: If there are N objects to be placed in k boxes, there is at least one box containing at least ⌈N/k⌉ objects.
This is proved using proof of contradiction although they say it is out of the scope of this topic.
Pigeonhole Principle Examples:
- In a group of 4 integers, show that there are at least 2 with the same remainder when divided by 3.
- Remainders when divided by 3:
0, 1, 2Therefore, given this a integer can only have one of these three remainders. Now notice that we have only 3 possible remainders, but four objects, which means we can apply the pigeonhole principle. So at least two integers will have the same remainder
- Remainders when divided by 3:
- You have a bag that contains 7 blue balls, and 4 red balls. How many balls must be selected to guarantee that 3 balls are of the same color.
- So how many balls can you pick up to avoid three of the same color? Well two blue ones, and two red ones. Meaning that as soon as a fifth is selected, then it is either blue or red. So
ceil(x/2)=3sox=5Where 2 is the number of boxes, and 3 is the number we need to assume we have in a box
- So how many balls can you pick up to avoid three of the same color? Well two blue ones, and two red ones. Meaning that as soon as a fifth is selected, then it is either blue or red. So
- Select 5 integers from
{1, 2, 3, 4, 5, 6, 7, 8}, show that at least 2 integers add up to 9- There is four total integer combinations that add up to 9. This means that there are only 4 integers that when selected would not add up to nine. Thus, if 5 integers are selected, at least 2 of them would have to add up to
9, therefore we apply the pigeonhole principle.
- There is four total integer combinations that add up to 9. This means that there are only 4 integers that when selected would not add up to nine. Thus, if 5 integers are selected, at least 2 of them would have to add up to
- Assume there are
npeople in the room; every pair is either friends or not. Show that there are at least 2 people with the same number of friends.- Possibilities of number of friends is either
1, 2, ..., n-1or0, 1, 2,..., n-2, this is because you cannot be friends with yourself, hence then-1There is also another case however, as if there is a person with no friends, then nobody can be their friend either, meaning we getn-2 - No matter however, because no matter what the case is, we will always have either n-1 or n-2 boxes, and n objects which are the people, so the pigeon hole principle still applies.
- Possibilities of number of friends is either
So I would say the best way to really figure these out is find out the number of possible options that you have that can go into each box, and then divide that by the number of boxes which is usually defined in the frame, and then ceiling function that bitch fr. Basically just find out what the limit is before you go over that limit and then add one.
Book Work:
This essential reading covers the subjects that you have studied in Week 5. It contains detailed explanations and a variety of examples to enable you to understand concepts such as counting principles, inclusion–exclusion and the Pigeonhole Principle. We strongly recommend that you to first watch the videos and then study the essential reading.
- Read Koshy, Chapter 3.4.
Book Reading:
Suppose that there are m pigeons and they try to root inside of n pigeon holes, where m > n obviously given basic logic, this means that there must be at least 1 pigeon hole that houses at least 2 pigeons:
The pigeon hole principle: Let f: X → Y where X and Y are finite sets, |X| = n |Y| = m and m > n (The domain is more than that co-domain), then there exists at least two distinct elements x1 and x2 in X such that f(x1) = f(x2).
Proof
- Let
X = {x1, ... , xm}. Now, suppose thefis an injective function. This means that each output in the function has exactly one input, so iff(a) = f(b), then a must equal b. But back to the proof, given thisf(x1), ... f(xm)are all distinct elements in the set ofY. However, this contradicts the assumption thatm > n, because you cannot have more inputs than outputs and have a one to ratio between the two. Therefore, f is NOT INJECTIVE, and there must be at least two elements such thatf(x1) = f(x2), and hence the theorem of the pigeon hole.
This by all means is very logical and simple if you really think about it, but it does get to be pretty important eventually, it can be restated as follows:
- If
mobjects are placed intonboxes, then at least one box must contain two or more objects, wherem > n.
This is also sometimes referred to as the Dirichlet Box Principle after the German guy who used it a bunch in this work on number theory. And even though it looks to be simple, you need to be pretty careful in what you choose as the pigeons and the boxes, and that is what can make it pretty hard.
Example:
Question:
- Suppose we select 367 students from campus, show that at least two of them must have the same birthday.
Solution:
- The maximum number of days that we end up with in a given year is 366, and this is because of a leap year. This means that the total number of unique birthdays that we can have is 366, meaning that with 367 students, there must be at least two with the same birthday. This is because given 366 boxes, we have 367 items, so we have more items than boxes and given the pigeonhole principle that means there must be at least one box with at least two items
- Mathematically: Let
Abe the set of students andBbe the set of days, where|A| = m = 367and|B| = n = 366. Now letf: A →Bdefined byf(a) = birthday of student a. Since we understand that our domain is larger than our co-domain becausem > n, we can apply the pigeon hole principle, meaning that there should be at least two studentsa1 and a2such thatf(a1) = f(a2). That is to say, that at least two students have the same birthday.
Generalized Pigeon Hole Principle:
Generalized Pigeon Hole Principle: If m pigeons are assigned to n pigeon holes, there must be a pigeonhole containing at least ⌊(m-1)/n⌋ + 1 pigeons.
Proof By Contradiction:
- Suppose that NO pigeonhole contains more than
⌊(m-1)/n⌋ + 1pigeons. Then: - maximum number of pigeons =
n * ⌊(m-1)/2⌋ ≤ n * ((m-1)/n) = m-1 - This then contradicts our assumption that there is
m-1pigeons










