GOA COLLEGE OF ENGINEERING “BHAUSAHEB BANDODKAR TECHNICAL EDUCATION COMPLEX" FARMAGUDI, PONDA- GOA - INDIA S.E.(COMPUTER/IT)(SEM.-IV) COUNTING TECHNIQUES DEVELOPED BY MATHEMATICS FACULTY DEPARTMENT OF SCIENCE & HUMANITIES GOA COLLEGE OF ENGINEERING COUNTING TECHNIQUES TOPICS TO BE COVERED: ➢SUM AND PRODUCT RULE ➢PERMUTATIONS AND COMBINATIONS,DERANGEMENTS ➢PIGEONHOLE PRINCIPLE ➢PRINCIPLE OF INCLUSION EXCLUSION ➢BINOMIAL THEOREM BASICS OF COUNTING • Sum Rule: If an event can occur in m ways and another event can occur in n ways, and if these two events cannot occur simultaneously, then one of the two events can occur in 𝒎 + 𝒏 ways. • Example 1: If there are 9 boys and 10 girls in a class, there are 9 + 10 = 19 ways of selecting one student as a class representative. • Example 2: A student can choose a computer project from one of three lists. The three lists contain 23, 15, and 19 possible projects respectively. How many possible projects are there to choose from? Total number of possible projects = 23 + 15 + 19 = 57 BASICS OF COUNTING • Product Rule: If an event can occur in m ways and a second event can occur in n ways, and if these two events are independent, then the two events can occur simultaneously 𝒎 ∙ 𝒏 ways. Example 1: When buying a PC system, you have the choice of • 3 models of the basic unit: B1, B2, B3 ; • 2 models of keyboard: K1, K2 ; • 2 models of printer: P1, P2 . The basic unit can be chosen in 3 ways The keyboard can be chosen in 2 ways The printer can be chosen in 2 ways The number of distinct systems that can be purchased = 3∙2∙2=12 BASICS OF COUNTING Example 2: A PIN is a sequence of any 4 digits(repetitions allowed). How many different PINs are possible? The first digit can be chosen in 10 ways (any digit from 1 to 10) The second digit can be chosen in 10 ways The third digit can be chosen in 10 ways The last digit can be chosen in 10 ways By product rule, there are 10∙10∙10∙10 = 10,000 PINs possible. Example 3: A book shelf holds 5 different Mathematics books, 6 different computer science books and 10 different Statistics books. Therefore, there are (i) 5+6+10 =21 ways of selecting any one book (ii) 5∙6∙10 = 300 ways of selecting 3 books one in each subject BASICS OF COUNTING Example 4: A six person committee composed of Rahul, Sarvesh, Joseph, Ashok, Seema and Maria is to select a chairperson, secretary and treasurer. a. In how many ways can this be done? Solution: The chairperson can be selected in 6 ways, the secretary can be selected in 5 ways and the treasurer 4 ways. Therefore, total number of possibilities = 6 ∙5 ∙4=120 b. In how many ways can this be done if either Rahul or Maria must be chairperson? Solution: If Rahul is chairperson, there are 5 ∙4=20 ways to select remaining officers. Similarly, If Maria is chairperson, there are 5 ∙4=20 ways to select remaining officers. By sum rule, there are 20+20=40 possibilities. BASICS OF COUNTING c. In how many ways can this be done if Seema must hold one of the post? Solution: If Seema is chairperson, there are 5 ∙4=20 ways to select remaining officers. If Seema is secretary, there are 5 ∙4=20 ways to select remaining officers. Similarly, If Seema is treasurer, there are 5 ∙4=20 ways to select remaining officers. By sum rule, there are 20+20+20=60 possibilities. d. In how many ways can this be done if both Sarvesh and Joseph must hold posts? Solution: Sarvesh can hold any of the three posts in 3 ways. Joseph can hold any one of remaining two posts in 2 ways The remaining post can be taken in 4 ways By product rule, there are 3∙2∙4 = 24 possibilities. PERMUTATIONS AND COMBINATIONS • A permutation of a n distinct objects 𝑥1 , 𝑥2 , ⋯ 𝑥𝑛 is an ordering of the n objects in a row. • Example: The permutations of {a,b,c}: abc acb bac bca cab cba • For any integer n with n≥1, the number of permutations of a set with n elements is n!. • An r- permutation of n distinct elements 𝑥1 , 𝑥2 , ⋯ 𝑥𝑛 is an ordering of relement subset of 𝑥1 , 𝑥2 , ⋯ 𝑥𝑛 and is denoted by P(n,r). 𝑃 𝑛, 𝑟 = 𝑛 𝑛 − 1 𝑛 − 2 ⋯ 𝑛 − 𝑟 + 1 = 𝑛! (𝑛−𝑟)! • Example: The 2-permutations of {a,b,c}: ab ba ac ca bc cb • The permutation of n objects in a circle is (𝑛 − 1)! PERMUTATIONS AND COMBINATIONS • An r-combination of a n distinct objects 𝑥1 , 𝑥2 , ⋯ 𝑥𝑛 is an unordered selection of an r-element subset of 𝑥1 , 𝑥2 , ⋯ 𝑥𝑛 and is denoted by 𝑛 C(n,r) or 𝑟 . • 𝐶 𝑛, 𝑟 = 𝑛! 𝑟!(𝑛−𝑟)! • Example: The 2-combinations of {a,b,c}: ab ac bc • Note: (i) 𝑛 0 = 𝑛 𝑛 =1 (ii) 𝐶 𝑛, 𝑟 = 𝐶 𝑛, 𝑛 − 𝑟 • Note: In general, when order matters, we count the number of permutations , and when order does not matter, we count the number of combinations. PERMUTATIONS AND COMBINATIONS Example 1: From a set of 5 books, in how many ways can 4 books be arranged in a bookshelf? Solution: The number of ways to arrange 4 books from a set of 5 books is 5 𝑃4 = 5! 1! = 120 Example 2: A committee of 5 can be chosen from 9 people in 9𝐶5 = 9! 5!∙4! = 126 Example 3: The number of three distinct letter words that can be formed from the letters of “MAST” is 4𝑃3 = 4! 1! = 24 Example 4: The number of distinct five card hands that can be delt from a deck of 52 cards is 52𝐶5 = 52! 5!∙47! = 2598960 PERMUTATIONS AND COMBINATIONS Example 5: In how many ways can the English letters be arranged so that there are exactly 10 letters between a and z? Solution: There are P(24,10) to select 10 English letters excluding a and z. Since we can choose either a or z to come first, then there are 2∙P(24,10) arrangements of the 12-letter block. For the remaining 14 letters, there are P(15,15)=15! possible arrangements. In all, there are 2 ∙ P(24,10) ∙ 15! arrangements Example 6: Find the number of ways in which 6 boys and 6 girls can be arranged in a row under the following conditions: a. All boys are to be seated together and all girls are to be seated together. Solution: Consider the group of 6 boys as one unit and the group of 6 girls as one unit. We have to find the number of arrangements of these two units and the internal arrangement of the boys and girls Total number of arrangements = 6! ∙ 6! ∙ 2! = 1036800 PERMUTATIONS AND COMBINATIONS b. Boys and girls take their seats alternately. Solution: The 6 boys can be arranged in 6! ways. The 6 girls can be arranged between the 6 boys in 6! ways. Since we can start with a boy or girl, for each of these arrangements, there are two ways. Total number of arrangements = 6! ∙ 6! ∙ 2! = 1036800 c. Two girls should not be seated together The 6 boys can be arranged in 6! ways. Place the girls between the boys in seven places in 7𝑃2 ways Total number of arrangements = 6! ∙ 7𝑃6 = 3628800 d. Boys occupy the extreme positions Two boys can be seated in the extreme positions in 6𝑃2 ways. The remaining students can be arranged in 10! Ways Total number of arrangements = 10! ∙ 6𝑃2 = 108864000 PERMUTATIONS AND COMBINATIONS Example 7: In how many ways can 3 diamonds and 2 clubs be selected from a pack of cards? Solution: There are 13 diamonds and 13 clubs in a pack of cards. Thus, the number of ways to select 3 cards is 13𝐶3 ∙ 13𝐶2 = 22308 Example 8: Find the number of diagonals of a polygon having n sides. Solution: The number of ways to join two points in a polygon of n sides is 𝑛𝐶2 . The number of diagonals = 𝑛𝐶2 − 𝑛. Example 9: There are 5 girls and 4 boys in a group. Find the number of ways in which a committee of 5 students can be formed under the following conditions: a. There is no restriction Solution: Number of ways to form the committee = 9𝐶5 = 126 PERMUTATIONS AND COMBINATIONS b. There are two boys in the committee Solution: Since there are two boys, remaining three are girls Number of ways to form the committee = 4𝐶2 ∙ 5𝐶3 = 60 c. There are at least two girls in the committee Solution: (i) 2 girls, 3 boys = 5 𝐶2 ∙ 4𝐶3 = 40 (ii) 3 girls, 2 boys = 5𝐶3 ∙ 4𝐶2 = 60 (iii)4 girls, 1 boy = 5𝐶4 ∙ 4𝐶1 = 20 (iv) all 5 girls = 5𝐶5 = 1 Number of ways to form the committee = 40 + 60 + 20 + 1 = 121 d. There are at most two girls in the committee Solution: (i) 2 girls, 3 boys = 5 𝐶2 ∙ 4𝐶3 = 40 (ii) 1 girl, 4 boys = 5𝐶1 ∙ 4𝐶4 = 5 Number of ways to form the committee = 40 + 5 = 45 GENERALIZED PERMUTATIONS AND COMBINATIONS Theorem: The number of r-permutations of a set of n objects with repetition allowed is 𝑛𝑟 . Example: The number of strings of length 4 that can be generated from the set 𝑎, 𝑏, 𝑐, 𝑑, 𝑒, 𝑓 if repetition is allowed= 64 = 1296 Theorem: The number of different permutations of n objects where there are n1 𝑛! indistinguishable objects of type 1, n2 of type 2, and … nk of type k is 𝑛1 !𝑛2 !⋯𝑛𝑘 ! • An equivalent ways of interpreting this theorem is the number of ways to distribute n distinguishable objects into k distinguishable boxes so that ni objects are place into box i for i=1,2,3,…,k Example 1: How many permutations of the word ‘MISSISSIPPI’ are there? Solution: ‘MISSISSIPPI’ has 4 distinct letters: M,I,S,P with 1,4,4,2 occurrences respectively 11! Therefore, the number of permutations= 4!∙4!∙2! DERANGEMENTS • A derangement is a permutation of the elements of a set, such that no element appears in its original position. • Number of derangements of a set of n elements, which we write Dn, is given by 𝐷𝑛 = 𝑛 (−1) σ 𝑛! 𝑖=0 𝑖! 𝑖 = 𝑛! 1 1 − 1! 1 + 2! 1 − 3! + ⋯+ (−1)𝑛 𝑛! ≈ 𝑛! 𝑒 Example 1: In how many ways 6 letters can be placed in 6 envelopes such that no letter is placed in its corresponding envelope? Solution: Number of ways = 𝐷6 = 6! 1 − 1 1! + 1 2! − 1 3! + 1 4! − 1 5! + 1 6! = 265 GENERALIZED PERMUTATIONS AND COMBINATIONS • Theorem: There are 𝑛+𝑟−1 r-combinations from a set with n elements 𝑟 when repetition of elements is allowed Example 1: The number of ways to select three balls from a bag that contain 6 balls of 4 different colors, if repetition is allowed is 4+3−1 = = 20 3 3 Example 2: There are some cans of Coke, Pepsi and sprite in a refrigerator. In how many ways can 5 cans be selected? Solution: Here n = 3 and 𝑟 = 5. Therefore, the total combinations are 3+5−1 7 = = 21 5 5 GENERALIZED PERMUTATIONS AND COMBINATIONS Example 3: How many solutions does the equation 𝑥1 + 𝑥2 + 𝑥3 = 10 have if 𝑥1 , 𝑥2 , 𝑥3 are non-negative integers? Solution: The problem is similar to finding number of ways to select 10 objects from a set of 3 objects where each element can be repeated any number of times. Here n = 12 3 and 𝑟 = 10. Therefore, the total combinations are 3+10−1 = = 66 10 10 Example 4: How many solutions does the equation 𝑥1 + 𝑥2 + 𝑥3 + 𝑥4 = 30 have if 𝑥1 ≥ 2, 𝑥2 ≥ 4, 𝑥3 ≥ 5 𝑎𝑛𝑑 𝑥4 ≥ 6 are integers? Solution: Let 𝑥1 = 𝑦1 + 2 , 𝑥2 = 𝑦2 + 4, 𝑥3 = 𝑦3 + 5 and 𝑥4 = 𝑦4 + 6 . Then the given equation is equivalent to 𝑦1 + 2 + 𝑦2 + 4 + 𝑦3 + 5 + 𝑦4 + 6 = 30 or 𝑦1 + 𝑦2 + 𝑦3 + 𝑦4 = 13 16 Here n = 4 and 𝑟 = 13. Therefore, the total combinations are 4+13−1 = = 560 13 13 PIGEONHOLE PRINCIPLE • If n pigeonholes are occupied by n+1 or more pigeons, then at least one pigeonhole is occupied by more than one pigeon. • If n pigeons are assigned to m pigeonholes and 𝑚 < 𝑛, then at least one pigeonhole contains two or more pigeons. • Dirichlet’s box principle: 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 • A function f from a set with k + 1 or more elements to a set with k elements is not a one-to-one function. • It is seemingly simple but very powerful • The difficulty comes in where and how to apply it PIGEONHOLE PRINCIPLE More pigeons than pigeonholes PIGEONHOLE PRINCIPLE Example 1: In a group of 13 children there are at least two who were born in the same month. Consider 13 children – 13 pigeons 12 months – 12 pigeonholes Therefore, by Pigeonhole principle, there are at least two who are born in the same month. Example 2: In a group of 27 English words, there must be at least two that begin with the same alphabet. Consider 27 English words – 27 pigeons 26 Alphabets – 26 pigeonholes Therefore, by Pigeonhole principle, there are at least two who that begin with the same alphabet. Example 3: Show that if any 5 numbers from 1 to 8 are chosen, then the sum of at least one pair among them is 9. Solution: Construct pairs of numbers from 1 to 8 that add to 9. PIGEONHOLE PRINCIPLE 1,8 , 2,7 , 3,6 4,5 There are four such pairs. Consider these four pairs as 4 pigeonholes and the 5 numbers to be chosen as 5 pigeons By pigeonhole principle, two numbers will belong to the same pair and these numbers add to 9. Example 4: If 51 numbers are chosen from the integers between 1 and 100, prove that 2 of the chosen numbers are consecutive. Solution: There are 50 pairs of consecutive numbers 1,2 , 3,4 , 5,6 , ⋯ 99,100 Consider these 50 pairs as 50 pigeonholes and the 51 numbers chosen as 51 pigeons. By pigeonhole principle, two numbers will belong to the same pair and these numbers are consecutive. PIGEONHOLE PRINCIPLE Example 5: Show that in any set of 11 integers, there are at least two integers whose difference is divisible by 10. Solution: The possible remainders on dividing a number by 10 are 0, 1, 2, 3, … ,9. Consider these 10 remainders as 10 pigeonholes and 11 integers as 11 pigeons. If we divide the 11 integers by 10, by Pigeonhole principle, at least two of the integers will have the same remainder. Let 𝑎1 and 𝑎2 be these integers . 𝑎1 = 10𝑞1 + 𝑟 and 𝑎2 = 10𝑞2 + 𝑟 ∴ 𝑎1 − 𝑎2 = 10(𝑞1 −𝑞2 ) i.e. 𝑎1 − 𝑎2 = 10𝑚 ∴ 𝑎1 − 𝑎2 is divisible by 10. PIGEONHOLE PRINCIPLE Example 6: Every positive integer n can be written as 𝑛 = 2𝑘 ∙ 𝑚 where m is odd and k is a non-negative integer. Using this fact or otherwise, show that if 101 integers are chosen from the set {1, 2, 3, … ,200}, then at least one of them is a multiple of some other number in the chosen collection of numbers. Solution: Since there are 101 integers(pigeons) but only 100 odd numbers between 1 to 200(pigeonholes) that can be odd parts of these numbers, by pigeonhole principle, there will be at least two integers with the same odd part. Let 𝑛1 and 𝑛2 be these integers . 𝑛1 = 2𝑘1 ∙ 𝑚 and 𝑛2 = 2𝑘2 ∙ 𝑚 for some 𝑘1 , 𝑘2 > 0. If 𝑘1 > 𝑘2 , 𝑛1 𝑛2 = 2𝑘1 −𝑘2 = 𝑝(integer) ⟹ 𝑛1 is a multiple of 𝑛2 If 𝑘1 < 𝑘2 , 𝑛2 𝑛1 = 2𝑘2 −𝑘1 = 𝑞(integer) ⟹ 𝑛2 is a multiple of 𝑛1 PIGEONHOLE PRINCIPLE Example 7: Show that in any room of n persons 𝑛 ≥ 2 who have been doing handshaking, there will be at least two persons who have shaken hand the same number of times. Solution: Minimum number of handshakes any person can have is 0 Maximum number of handshakes any person can have is n-1. Consider number of handshakes as pigeonholes and n persons as n pigeons. The labels on pigeonholes will go from 0 to n-1 i.e we have n pigeons and n pigeonholes. But, it is not possible for the 0th and (n-1)th hole to be occupied together, because if one person has not shaken hands with anybody, then there cannot be any other person who have shaken hands with every other person. Thus, we have (n-1) holes occupied at any given time. Hence, by pigeonhole principle, at least two of the holes have at least two occupants, which shows that there are at least two persons with the same number of handshakes. PIGEONHOLE PRINCIPLE Example 8:Use the pigeonhole principle to show that if any 5 points are chosen at random within a square of length 2, there are at least two points whose distance apart is at most 2 units. 1 1 Solution: Divide the square into 4 smaller sub-squares 2 by bisecting each side and joining these points. 1 1 1 Consider these 4 sub-squares as 4 pigeonholes and the 5 points as 5 pigeons. 1 1 Hence, by pigeonhole principle, at least two points 1 1 1 will be in the same sub-square and the distance between them will be at most 2 units. 1 1 PIGEONHOLE PRINCIPLE Example 9: Consider 5 distinct points (xi, yi) with integer values, where i = 1, 2, 3, 4, 5. Show that the midpoint of at least one pair of these five points also has integer coordinates. Solution: The midpoint of a segment from (a,b) to (c,d) is ( (a+c)/2, (b+d)/2 ) Note that the midpoint will be integers if a and c have the same parity: are either both even or both odd. Same applies to integers b and d. There are four parity possibilities which we consider 4 pigeonholes (even, even), (even, odd), (odd, even), (odd, odd) Since we have 5 points(5 pigeons), by the pigeonhole principle, there must be two points that have the same parity possibility Thus, the midpoint of those two points will have integer coordinates. PIGEONHOLE PRINCIPLE PRACTICE PROBLEMS 1. Use pigeonhole principle to show that, if any five points are randomly placed in an equilateral triangle of length 2 cms, then there are atleast two points which are at most 1 cm apart. 2. Suppose 30 balls are numbered from 1 to 30 and placed in a large box. Show that, if 18 balls are drawn randomly , there must be a pair among them whose sum of the numbers appearing on the balls drawn is 35. EXTENDED PIGEONHOLE PRINCIPLE • If n pigeons occupy k pigeonholes where 𝑛 > 𝑘, then there is at least one pigeonhole 𝑛 containing pigeons. 𝑘 • If k pigeonholes are occupied by 𝑛𝑘 + 1 pigeons, where n is a positive integer, then at least one pigeonhole is occupied by 𝑛 + 1 or more pigeons. Example 1: Amongst 100 people, there must be at least same month. 100 12 = 9, who were born in the Example 2: If 9 books are to be arranged on 4 shelves, then there must be at least one shelf containing at least 3 books. Solution: 9 books – 9 pigeons 4 shelves – 4 pigeonholes 9 By extended pigeonhole principle, at least one shelf will contain = 3 books 4 EXTENDED PIGEONHOLE PRINCIPLE Example 3: Suppose 8 integers from 1 to 20 are selected at random. From these eight integers, if we form groups of three, then show that at least two groups will have the same sum. Solution: There are 8𝐶3 = 56 groups of three (56 pigeons) that can be formed from the 8 integers. Minimum sum possible = 1+2+3=6 Maximum sum possible =18+19+20=57 There are 52 sums possible which are considered 52 pigeonholes By extended pigeonhole principle, at least 56 52 = 2 groups will have the same sum. EXTENDED PIGEONHOLE PRINCIPLE Example 3: What is the minimum number of students required in a discrete Math class to be sure that at least six will receive the same grade, if there are five possible grades, A, B, C, D, and F? Solution: Let n be the number of students(pigeons) required 5 grades - 5 pigeonholes 𝑛 5 = 6 ⟹ n=26 OR 𝑘 = 5 and 𝑛 + 1 = 6 ⟹ 𝑛 = 5 Therefore, number of students(pigeons)= 𝑛𝑘 + 1 = 5 ∙ 5 + 1 = 26 EXTENDED PIGEONHOLE PRINCIPLE Example 4: A bowl contains 10 red and 10 yellow balls. How many balls must be selected to ensure 3 balls of the same color? Solution: Let n be the number of balls(pigeons) to be selected 2 colors - 2 pigeonholes 𝑛 2 = 3 ⟹ n=5 OR 𝑘 = 2 and 𝑛 + 1 = 3 ⟹ 𝑛 = 2 Therefore, number of balls(pigeons) to be selected = 𝑛𝑘 + 1 = 2 ∙ 2 + 1 = 5 PRINCIPLE OF INCLUSION-EXCLUSION • Let A and B be finite sets and 𝑛(𝐴) denotes the number of elements in A. Then 𝑛 𝐴 ∪ 𝐵 = 𝑛 𝐴 + 𝑛 𝐵 − 𝑛(𝐴 ∩ 𝐵) Note: (i) 𝑛 𝐴 − 𝐵 = 𝑛 𝐴 ∩ 𝐵ത = 𝑛 𝐴 − 𝑛(𝐴 ∩ 𝐵) (ii) 𝑛 𝐵 − 𝐴 = 𝑛 𝐴ҧ ∩ 𝐵 = 𝑛 𝐵 − 𝑛(𝐴 ∩ 𝐵) (iii) 𝑛 𝐴ҧ ∩ 𝐵ത = 𝑛 𝑈 − 𝑛(𝐴 ∪ 𝐵) • If A, B and C are three sets, then 𝑛 𝐴 ∪ 𝐵 ∪ 𝐶 = 𝑛 𝐴 + 𝑛 𝐵 + 𝑛 𝐶 − 𝑛 𝐴 ∩ 𝐵 − 𝑛 𝐴 ∩ 𝐶 − 𝑛 𝐵 ∩ 𝐶 + 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶) • In general, if 𝐴1 , 𝐴2 , 𝐴3 , ⋯ , 𝐴𝑛 are n finite sets, then 𝑛 =𝑖𝑛ڂ1 𝐴𝑖 = σ𝑛𝑖=1 𝑛(𝐴𝑖 ) − σ𝑛𝑖,𝑗=1 𝑛 𝐴𝑖 ∩ 𝐴𝑗 + σ𝑛𝑖,𝑗,𝑘=1 𝑛 𝐴𝑖 ∩ 𝐴𝑗 ∩ 𝐴𝑘 𝑖<𝑗 − ⋯ + (−1)𝑛+1 𝑛 =𝑖𝑛ځ1 𝐴𝑖 𝑖<𝑗<𝑘 PRINCIPLE OF INCLUSION-EXCLUSION Example 1: How may bit strings of length eight start with 1 or end with 00? Solution: Let A be the set of bit strings of length eight that start with 1 𝑛 𝐴 = 27 = 128 Let B be the set of bit strings of length eight that end with 00 𝑛 𝐵 = 26 = 64 𝑛 𝐴 ∩ 𝐵 = 25 = 32 𝑛 𝐴 ∪ 𝐵 = 𝑛 𝐴 + 𝑛 𝐵 − 𝑛 𝐴 ∩ 𝐵 = 128 + 64 − 32 = 160 Note: The number of positive integer from 1 to n divisible by k is 𝑛 𝑘 The number of positive integer from 1 to n divisible by k and l is 𝑛 𝐿𝐶𝑀(𝑘,𝑙) PRINCIPLE OF INCLUSION-EXCLUSION Example 3: In a class of 75 students, the number of students who passed in Mathematics is equal to the number of students who passed in Electronics. The total number of students who passed in exactly one subject is 60. It was also found that 5 students did not pass any subject. Find the number of students who passed in (i) both the subjects (ii) Mathematics only Solution: Let A be the set of students who passed in Mathematics Let B be the set of students who passed in Electronics 𝑛 𝑈 = 75; 𝑛 𝐴 = 𝑛 𝐵 𝑛 𝐴 ∩ 𝐵ത + 𝑛 𝐴ҧ ∩ 𝐵 = 60 ; 𝑛 𝐴ҧ ∩ 𝐵ത = 5 𝑛 𝐴 ∪ 𝐵 = 𝑛 𝑈 − 𝑛 𝐴ҧ ∩ 𝐵ത = 75 − 5 = 70 𝑛 𝐴 ∪ 𝐵 = 𝑛 𝐴 ∩ 𝐵ത + 𝑛 𝐴ҧ ∩ 𝐵 + 𝑛 𝐴 ∩ 𝐵 (i) 70 = 60 + 𝑛 𝐴 ∩ 𝐵 ⟹ 𝑛 𝐴 ∩ 𝐵 = 10 𝑛 𝐴 ∪ 𝐵 = 𝑛 𝐴 + 𝑛 𝐵 − 𝑛 𝐴 ∩ 𝐵 ⟹ 𝑛 𝐴 ∪ 𝐵 = 2𝑛 𝐴 − 𝑛 𝐴 ∩ 𝐵 ⟹ 𝑛 𝐴 = 40 (ii) 𝑛 𝐴 ∩ 𝐵ത = 𝑛 𝐴 − 𝑛 𝐴 ∩ 𝐵 = 40 − 10 = 30 PRINCIPLE OF INCLUSION-EXCLUSION Example 3: A large software development company employs 100 computer programmers. Of them, 45 are proficient in Java, 30 in C#, 20 in Python, six in C# and Java, one in Java and Python, five in C# and Python, and just one programmer is proficient in all three languages above. Determine the number of computer programmers that are not proficient in any of these three languages. Solution: Let A be the set of computer programmers proficient in Java Let B be the set of computer programmers proficient in C# Let C be the set of computer programmers proficient in Python 𝑛 𝑈 = 100; 𝑛 𝐴 = 45, 𝑛 𝐵 = 30, 𝑛 𝐶 = 20 𝑛 𝐴 ∩ 𝐵 = 6 , 𝑛 𝐴 ∩ 𝐶 = 1 , 𝑛 𝐵 ∩ 𝐶 = 5, 𝑛 𝐴 ∩ 𝐵 ∩ 𝐶 = 1 𝑛 𝐴 ∪ 𝐵 ∪ 𝐶 = 𝑛 𝐴 + 𝑛 𝐵 + 𝑛 𝐶 − 𝑛 𝐴 ∩ 𝐵 − 𝑛 𝐴 ∩ 𝐶 − 𝑛 𝐵 ∩ 𝐶 + 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶) = 45 + 30 + 20 − 6 − 1 − 5 + 1 = 84 𝑛 𝐴ҧ ∩ 𝐵ത ∩ 𝐶ҧ = 𝑛 𝑈 − 𝑛 𝐴 ∪ 𝐵 ∪ 𝐶 = 100 − 84 = 16 PRINCIPLE OF INCLUSION-EXCLUSION Example 2: How many integers between 1 and 300 (inclusive) are divisible by (i) at least one of 3,5,7? (ii) none of 3,5,7? Solution: Let A = {nZ | (1 n 300) (3|n)} B = {nZ | (1 n 300) (5|n)} C = {nZ | (1 n 300) (7|n)} 𝑛 𝐴 = 300/3 = 100 𝑛 𝐴 ∩ 𝐵 = 300/15 = 20 𝑛 𝐵 = 300/5 = 60 𝑛 𝐴 ∩ 𝐶 = 300/21 =14 𝑛 𝐶 = 300/7 = 42 𝑛 𝐵 ∩ 𝐶 = 300/35 = 8 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶) = 300/105 = 2 Therefore, 𝑛 𝐴 ∪ 𝐵 ∪ 𝐶 = 𝑛 𝐴 + 𝑛 𝐵 + 𝑛 𝐶 − 𝑛 𝐴 ∩ 𝐵 − 𝑛 𝐴 ∩ 𝐶 − 𝑛 𝐵 ∩ 𝐶 + 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶) = 100 + 60 + 42 - (20+14+8) + 2 = 162 (ii) 𝑛 𝐴ҧ ∩ 𝐵ത ∩ 𝐶ҧ = 𝑛 𝑈 − 𝑛 𝐴 ∪ 𝐵 ∪ 𝐶 = 300 − 162 = 138 PRINCIPLE OF INCLUSION-EXCLUSION Example 4: At a construction site, Jorge is in charge of hiring skilled workers for the project. Out of 80 candidates that he interviewed, he found that 45 were painters, 50 were electricians, 50 were plumbers, 15 had skills in all three areas, and all of them had skills in at least one of these areas. If he hired everyone who was skilled in exactly 2 areas, how many candidates were hired? Solution: Let A be the set of workers who are painters Let B be the set of workers who are electricians Let C be the set of workers who are plumbers 𝑛 𝑈 = 80 = 𝑛 𝐴 ∪ 𝐵 ∪ 𝐶 ; 𝑛 𝐴 = 45, 𝑛 𝐵 = 50, 𝑛 𝐶 = 50, 𝑛 𝐴 ∩ 𝐵 ∩ 𝐶 = 15 𝑛 𝐴 ∪ 𝐵 ∪ 𝐶 = 𝑛 𝐴 + 𝑛 𝐵 + 𝑛 𝐶 − 𝑛 𝐴 ∩ 𝐵 − 𝑛 𝐴 ∩ 𝐶 − 𝑛 𝐵 ∩ 𝐶 + 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶) 80 = 45 + 50 + 50 − 𝑛 𝐴 ∩ 𝐵 − 𝑛 𝐴 ∩ 𝐶 − 𝑛 𝐵 ∩ 𝐶 + 15 𝑛 𝐴 ∩ 𝐵 + 𝑛 𝐴 ∩ 𝐶 + 𝑛 𝐵 ∩ 𝐶 = 160 − 80 = 80 𝑛 𝐴 ∩ 𝐵 ∩ 𝐶ҧ + 𝑛 𝐴 ∩ 𝐵ത ∩ 𝐶 + 𝑛 𝐴ҧ ∩ 𝐵 ∩ 𝐶 = 𝑛 𝐴 ∩ 𝐵 − 𝑛 𝐴 ∩ 𝐵 ∩ 𝐶 + 𝑛 𝐴 ∩ 𝐶 −𝑛 𝐴 ∩ 𝐵 ∩ 𝐶 + 𝑛 𝐵 ∩ 𝐶 − 𝑛 𝐴 ∩ 𝐵 ∩ 𝐶 = 𝑛 𝐴 ∩ 𝐵 + 𝑛 𝐴 ∩ 𝐶 + 𝑛 𝐵 ∩ 𝐶 − 3𝑛 𝐴 ∩ 𝐵 ∩ 𝐶 = 80 − 3 × 15 = 35 candidates were hired PRINCIPLE OF INCLUSION-EXCLUSION Example 5: Find the number of primes not exceeding 100? Solution: We first find the number of composites not exceeding 100 using the fact that if n > 1 is a composite number, then n has a prime divisor not exceeding 𝑛. 100 = 10 and the prime factors less than or equal to 10 are 2, 3, 5, 7. Any composite number not exceeding 100 must be divisible by at least one of 2, 3, 5, 7 Let A be the set of integers not exceeding 100 divisible by 2 Let B be the set of integers not exceeding 100 divisible by 3 Let C be the set of integers not exceeding 100 divisible by 5 Let D be the set of integers not exceeding 100 divisible by 7 𝑛 𝐴 = 100/2 = 50 𝑛 𝐵 = 100/3 = 33 𝑛 𝐶 = 100/5 = 20 𝑛 𝐷 = 100/7 = 14 𝑛 𝐴 ∩ 𝐵 = 100/6 = 16 𝑛 𝐴 ∩ 𝐶 = 100/10 =10 𝑛 𝐴 ∩ 𝐷 = 100/14 =7 𝑛 𝐵 ∩ 𝐶 = 100/15 = 6 𝑛 𝐵 ∩ 𝐷 = 100/21 = 4 𝑛 𝐶 ∩ 𝐷 = 100/35 = 2 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶) = 100/30 = 3 𝑛(𝐴 ∩ 𝐵 ∩ 𝐷) = 100/42 = 2 𝑛(𝐴 ∩ 𝐶 ∩ 𝐷) = 100/70 = 1 𝑛(𝐵 ∩ 𝐶 ∩ 𝐷) = 100/105 = 0 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶 ∩ 𝐷) = 100/210 = 0 PRINCIPLE OF INCLUSION-EXCLUSION 𝑛 𝐴∪𝐵∪𝐶∪𝐷 =𝑛 𝐴 +𝑛 𝐵 +𝑛 𝐶 +𝑛 𝐷 −𝑛 𝐴∩𝐵 −𝑛 𝐴∩𝐶 −𝑛 𝐴∩𝐷 −𝑛 𝐵 ∩ 𝐶 − 𝑛 𝐵 ∩ 𝐷 − 𝑛 𝐶 ∩ 𝐷 + 𝑛 𝐴 ∩ 𝐵 ∩ 𝐶 + 𝑛 𝐴 ∩ 𝐵 ∩ 𝐷 +𝑛 𝐴 ∩ 𝐶 ∩ 𝐷 + 𝑛 𝐵 ∩ 𝐶 ∩ 𝐷 − 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶 ∩ 𝐷) = 50 + 33 + 20 + 14 − 16 − 10 − 7 − 6 − 4 − 2 + 3 + 2 + 1 + 0 − 0 = 78 𝑛 𝐴 ∪ 𝐵 ∪ 𝐶 ∪ 𝐷 includes the numbers 2, 3, 5, 7 which are not composite. Number of composites not exceeding 100 = 78 − 4 = 74 Also, 1 is neither prime nor composite. Therefore, number of primes not exceeding 100 = 99 − 74 = 25 PASCAL’S IDENTITY Theorem: Let 𝑛, 𝑘 ∈ 𝑍 + with 𝑛 ≥ 𝑘. Then 𝑛 𝑘−1 Proof: + 𝑛 𝑘 𝑛 𝑘−1 = + 𝑛+1 𝑘 𝑛 𝑘 = = 𝑛! 𝑛! + 𝑛− 𝑘−1 ! (𝑘−1)! 𝑛−𝑘 ! 𝑘! 𝑛− 𝑘−1 𝑛! 𝑛! + 𝑛−𝑘 ! (𝑘−1)! 𝑛−𝑘 ! 𝑘(𝑘−1)! = 𝑛! 1 𝑛−𝑘 ! (𝑘−1)! 𝑛− 𝑘−1 = 𝑛! 𝑘+𝑛−𝑘+1 𝑛−𝑘 ! (𝑘−1)! 𝑘 𝑛− 𝑘−1 = = = + 𝑛! 𝑛+1 𝑛−𝑘 ! (𝑘−1)! 𝑘 𝑛− 𝑘−1 (𝑛+1)! 𝑛+1−𝑘 ! 𝑘! 𝑛+1 𝑘 1 𝑘 BINOMIAL THEOREM Theorem: Let x and y be variables and 𝑛 ∈ 𝑍 + . Then (𝑥 + 𝑦)𝑛 = σ𝑛𝑖=0 𝑛𝑖 𝑥 𝑛−𝑖 𝑦 𝑖 = 𝑛0 𝑥 𝑛 + 𝑛1 𝑥 𝑛−1 𝑦 + Proof: Let P(n): (𝑥 + 𝑦)𝑛 = 𝑛 = 1 (𝑥 + 𝑦)1 = 𝑥 + 𝑦 = ∴ P(1) is true Assume P(k) is true 𝑛 0 1 0 (𝑥 + 𝑦)𝑘+1 = 𝑘 0 + 𝑥 𝑘−2 𝑦 2 + 𝑘 3 𝑥1 + (𝑥 + 𝑦)𝑘 = 𝑘0 𝑥 𝑘 + 𝑘1 𝑥 𝑘−1 𝑦 + Multiply both sides with (𝑥 + 𝑦) (𝑥 + 𝑦) ∙ (𝑥 + 𝑦)𝑘 = (𝑥 + 𝑦) 𝑛 𝑛−1 𝑥 𝑦 1 1 1 𝑦 1 𝑥𝑛 + 𝑘 2 𝑥𝑘 + 𝑘 1 𝑥 𝑘−1 𝑦 + 𝑘 2 𝑛 2 𝑛 2 𝑥 𝑛−2 𝑦 2 + 𝑥 𝑛−2 𝑦 2 + 𝑛 3 𝑥 𝑘−3 𝑦 3 + ⋯ + 𝑥 𝑘−2 𝑦 2 + 𝑘 3 𝑛 3 𝑘 𝑘−1 𝑥 2 𝑦 𝑘−1 + 𝑘 𝑘−1 𝑥𝑦 𝑘 + 𝑘 𝑘 𝑥𝑦 𝑘 + 𝑘 𝑘 𝑦 𝑘+1 𝑛 𝑛 𝑥 𝑛−3 𝑦 3 + ⋯ + 𝑘 𝑘−1 𝑥𝑦 𝑘−1 + 𝑥 𝑘−3 𝑦 3 + ⋯ + 𝑘 𝑘+1 𝑘 𝑘 𝑘 𝑘 𝑘 𝑘−1 2 𝑘 𝑘−1 2 𝑘 𝑘−2 3 𝑥 + 𝑥 𝑦+ 𝑥 𝑦+ 𝑥 𝑦 + 𝑥 𝑦 + 𝑥 𝑦 0 0 1 1 2 2 +⋯+ 𝑛 𝑛 𝑥 𝑛−3 𝑦 3 + ⋯ + 𝑘 𝑘−1 𝑘 𝑘 𝑦𝑛 𝑦𝑛 𝑦𝑘 𝑥𝑦 𝑘−1 + 𝑘 𝑘 𝑦𝑘 BINOMIAL THEOREM (𝑥 + 𝑦)𝑘+1 = = = 𝑘 𝑘+1 𝑘 𝑘 𝑘 𝑘 𝑘 𝑘 𝑘 𝑘−1 2 𝑘 𝑥 + + 𝑥 𝑦 + + 𝑥 𝑦 + ⋯ + + 𝑥𝑦 0 0 1 1 2 𝑘−1 𝑘 𝑘+1 𝑘−1 2 𝑘+1 𝑘 𝑘 𝑘+1 𝑥 𝑘+1 + 𝑘+1 𝑥 𝑦 + 𝑥 𝑦 + ⋯ + 𝑥𝑦 + 𝑦 1 2 𝑘 𝑘+1 𝑘+1 𝑘+1 𝑘 𝑘+1 𝑘−1 2 𝑘+1 𝑘+1 𝑘+1 𝑘 𝑥 + 𝑥 𝑦 + 𝑥 𝑦 + ⋯ + 𝑥𝑦 + 𝑦 0 1 2 𝑘 𝑘+1 ∴ P(k+1) is true Hence, by Mathematical induction, P(n) is true for all 𝑛 ∈ 𝑍 + . • In particular, putting 𝑥 = 𝑦 = 1 (1 + 1)𝑛 = ∴ 𝑛 0 + 𝑛 1 𝑛 0 + + 𝑛 2 𝑛 1 + + 𝑛 3 𝑛 2 + + ⋯+ 𝑛 3 𝑛 𝑛 + ⋯+ 𝑛 𝑛 = 2𝑛 • In particular, putting 𝑥 = 1 𝑎𝑛𝑑 𝑦 = −1 (1 − 1)𝑛 = ∴ 𝑛 0 − 𝑛 1 𝑛 0 + − 𝑛 2 𝑛 1 − + 𝑛 3 𝑛 2 − 𝑛 3 + ⋯ + (−1)𝑛 + ⋯ + −1 𝑛 𝑛 𝑛 =0 𝑛 𝑛 + 𝑘 𝑘 𝑦 𝑘+1 BINOMIAL THEOREM Pascal’s triangle BINOMIAL THEOREM Note: (𝑥 − 𝑦)𝑛 = σ𝑛𝑖=0(−1)𝑖 𝑛 𝑖 𝑥 𝑛−𝑖 𝑦 𝑖 = 𝑛0 𝑥 𝑛 − 𝑛1 𝑥 𝑛−1 𝑦 + 𝑛2 𝑥 𝑛−2 𝑦 2 − • There are n+1 terms in the expansion of (𝑥 + 𝑦)𝑛 𝑇1 = 𝑇2 = ⋮ 𝑛 0 𝑛 1 𝑇𝑛+1 = 𝑛 3 𝑥 𝑛−3 𝑦 3 + ⋯ + (−1)𝑛 𝑥𝑛 𝑥 𝑛−1 𝑦 𝑛 𝑛 𝑦𝑛 • The kth term in the expansion is given by 𝑇𝑘 = • If n is even, middle term • If n is odd, middle terms 𝑛+2 𝑡ℎ = term 2 𝑛+1 𝑡ℎ are term 2 and 𝑛 𝑘−1 𝑥 𝑛−(𝑘−1) 𝑦 𝑘−1 𝑛+3 𝑡ℎ 2 term. 𝑛 𝑛 𝑦𝑛 BINOMIAL THEOREM Expand using Binomial theorem: 1. (2𝑥 − 𝑦)4 (2𝑥 − 𝑦)4 = 4 0 = 16𝑥 4 − 𝑦 2. 𝑥 1 6 + 𝑦 = 6 0 6 4 = 4 4−1 𝑦 + 4 (2𝑥)4−2 𝑦 2 (2𝑥) 1 2 32𝑥 3 𝑦 + 24𝑥 2 𝑦 2 − 8𝑥𝑦 3 + 𝑦 4 (2𝑥)4 − 𝑦 6 𝑥 𝑦 6 6 + 1 𝑥 𝑦 2 1 4 𝑥 𝑦 + 𝑦4 6 5 𝑥 + + 𝑦 5 1 1 𝑥 𝑦 𝑦 𝑥 6 5 𝑦2 15 4 𝑥 6 + 2 1 5 + 𝑦 1 + 20 3 𝑥 𝑦 4 𝑥 6 6 − 1 2 𝑦 1 6 𝑦 1 + 15 2 2 𝑥 𝑦 + 4 3 + (2𝑥)4−3 𝑦 3 + 6 3 1 6 4 𝑥𝑦 + 𝑦 3 1 3 𝑥 𝑦 1 6 𝑦 4 4 + 𝑦4 BINOMIAL THEOREM 3. Find the fourth term in the expansion of (3𝑥 − 𝑦)7 𝑇4 = 7 3 (3𝑥)7−(4−1) (−𝑦)3 = −2835𝑥 4 𝑦 3 4. Find the fifth term in the expansion of 1 𝑇5 = = 2 3 6 − 𝑥 3 2 3 4 6 − 𝑥 4 3 80 12 𝑥 27 5. Find the middle term in the expansion of (𝑥 − 2𝑦)4 Middle term = 4+2 𝑡ℎ 2 𝑡𝑒𝑟𝑚 = 𝑇3 = 4 2 𝑥 4−(3−1) (−2𝑦)3−1 = 24𝑥 2 𝑦 2 BINOMIAL THEOREM 6. Find the middle terms in the expansion of (𝑥 2 + 3𝑦)9 Middle terms are 𝑇5 = 𝑇6 = 9 4 9 5 9+1 𝑡ℎ 2 4 = 𝑇5 and 9+3 𝑡ℎ 2 = 𝑇6 (𝑥 2 )5 (3𝑦) = 10206𝑥 10 𝑦 4 (𝑥 2 )4 (3𝑦)5 = 30618𝑥 8 𝑦 5 7. Find the coefficient of 𝑥 7 𝑦 8 in the expansion of (2𝑥 − 3𝑦)15 15 𝑇𝑘 = 𝑘−1 (2𝑥)15−(𝑘−1) (−3𝑦)𝑘−1 𝑘−1=8⟹ 𝑘 =9 𝑇9 = 15 8 (2𝑥)7 (−3𝑦)8 = 15 8 27 (−3)8 𝑥 7 𝑦 8 7 (−3)8 Coefficient of 𝑥 7 𝑦 8 in the expansion of (2𝑥 − 3𝑦)15 = 15 2 8 = 5404164480 BINOMIAL THEOREM 8. If the 9th term in the expansion of 𝑥 1Τ3 + 𝑥 −1Τ3 Solution: 𝑇𝑟 = 𝑛 𝑟−1 𝑥 1Τ3 10−(𝑟−1) 𝑛−8 𝑇9 = 𝑛 8 𝑥 1Τ3 𝑇9 = 𝑛 8 𝑛−8 𝑥 1Τ3 𝑇9 = 𝑛 8 𝑥 1Τ3 𝑛−8−8 𝑇9 = 𝑛 8 𝑥 1Τ3 𝑛−16 𝑇9 = 𝑛 8 ⟹ 𝑥 𝑛−16 3 𝑛−16 3 =0 ⟹ 𝑛 = 16 𝑥 −1Τ3 1 𝑥 1Τ3 8 𝑥 −1Τ3 8 𝑛 does not contain x, then determine the value of n. 𝑟−1 BINOMIAL THEOREM 9. Evaluate the values of x, for which the fifth term of the expansion Solution: 𝑇𝑟 = 10 𝑟−1 𝑇5 = 10 5−1 𝑇5 = 10 4 105 = 210 105 = 210 210 𝑥 3 = 105 𝑥3 = 2 ∙ 𝑥3 = 𝑥3 = 𝑥3 = 1 𝑟−1 −2 2 x 1 10−(5−1) 1 5−1 − 2 x 2 6 4 1 1 − 2 x 2 6 6 1 1 1 4 x 2 2 1 1 10 𝑥3 2 1 10 2 1 10 2 9 1 2 1 3 23 1 1 = 3 2 8 1 10−(𝑟−1) = 0.125 1 10 − 2 is 2 x 1 equal to 105 ? BINOMIAL THEOREM • If 𝑦 < 𝑥 and n is negative or fractional index, then 𝑛 𝑛 (𝑥 + 𝑦) = 𝑥 + 𝑛𝑥 𝑛−1 𝑦 • If 𝑥 < 1, then (1 + 𝑥)𝑛 = 1 + 𝑛𝑥 𝑛(𝑛−1) 𝑛−2 2 + 𝑥 𝑦 2! 𝑛(𝑛−1) 2 + 𝑥 2! + 𝑛(𝑛−1)(𝑛−2) 𝑛−3 3 𝑥 𝑦 3! 𝑛(𝑛−1)(𝑛−2) 3 + 𝑥 3! + 𝑛(𝑛−1)(𝑛−2)(𝑛−3) 4 𝑥 4! (−4)(−4−1) 2 (−4)(−4−1)(−4−2) 3 𝑥 + 𝑥 2! 3! 10𝑥 2 − 20𝑥 3 + 35𝑥 4 − ⋯ 1. (1 + 𝑥)−4 = 1 + (−4)𝑥 + = 1 − 4𝑥 + 2. 3. 1 2 1 1 1 1 1 ( )( −1) ( )( −1)(2−2) 1 (1 + 𝑥) = 1 + 𝑥 + 2 2 𝑥 2 + 2 2 𝑥3 2 2! 3! 1 1 3 15 4 = 1 + 𝑥 − 𝑥2 + 𝑥3 − 𝑥 −⋯ 2 8 48 348 (1 − 𝑥)−1 = 1 + 𝑥 + 𝑥 2 + 𝑥 3 + ⋯ 1 + 1 +⋯ 1 + (−4)(−4−1)(−4−2)(−4−3) 4 𝑥 4! 1 (2)(2−1)(2−2)(2−3) 4! +⋯ 𝑥4 + ⋯ +⋯ THANK YOU!