 will discuss the principle of inclusion and exclusion now the principle of inclusion and exclusion is a principle by using which we count the number of elements in the union of several sets suppose S is a set by the symbol modulus of S we will mean the number of elements in that set now what we are interested in is if we have several sets like A1 A2 and so on up to AAN where N is finite the size or cardinality of the set AI which we denote by let us say modulus of AI is less than infinity for all I belonging to the set 12. N what is the size or cardinality or simply the number of elements in the union A1 union A2 and so on union AN now the principle of inclusion and exclusion let us compute this precisely to begin with we start with N equal to 2 and instead of writing A1 and A2 we will consider the sets A and B now we have this result number of elements in A union B is equal to number of elements in A plus the number of elements in B minus the number of elements in A intersection B the question is how to be proved this result to check the proof we will look at the Venn diagram consisting of these two sets so suppose this is my universal set U and inside this universal set we have two sets A and B now in general we do not have reasons to expect that A and B are disjoint what we will prove are of course true when A and B are disjoint but let us take the general situation where there may be intersections finite intersection of A and B now I denote the set A by this circle and set B by the other circle now we see that there is a region which is inside A but not in B and this region is precisely A intersection complement of B then there is another region which is both in A and B so this region is A intersection B and the other region somewhat symmetric is the region where which is in B but not in A and this is A complement B so A B complement intersection B complement is this region A intersection B is the region shared by both A and B and A complement intersection B is the region which is in B but not in A now it is not difficult to see that these regions are disjoint from each other so the number of elements in the region which is a union of these three regions is the sum of the number of elements in each of them the reason is as I have already said that these regions are disjoint on the other hand we also note that if we take the union of these three regions then we get the set A A union B thus we can say that the cardinality of A union B is equal to the cardinality of A intersection B complement plus the cardinality of A intersection B plus the cardinality of A complement intersection B now we move further on now suppose you give me the set A and tell me to split it up into two disjoint portions I can of course split it up in this way A intersection B complement union A intersection B so we have already seen that this is this portion and the portion A intersection B now these two sets are disjoint and we know that the union of two disjoint sets will have exactly the number of elements equal to the sum of the number of elements in individual sets therefore we will have cardinality of A equal to cardinality of A intersection B complement plus the cardinality of A intersection B but we see that the equation one contains an element cardinality of A intersection B complement and equation two contains the same element what we can think of doing is replace the cardinality of A intersection B complement in equation 1 by an expression that we derive from equation two but we will do that after the next step because in the same way I can prove that cardinality of B equal to a cardinality of A complement intersection B plus cardinality of A intersection B let us call it three now from three we see that A complement intersection B can be replaced over here in one by cardinality of B minus cardinality of A intersection B if we do that we have A union B equal to cardinality of A minus cardinality of A intersection B plus cardinality of A intersection B plus cardinality of B minus cardinality of A intersection B some cardinality of A intersection B are getting cancelled and therefore we will get cardinality of A intersection B equal to cardinality of A plus cardinality of B minus cardinality of A intersection B thus we have got the result that we wrote down over here we can solve some problems related to this counting principle let me write down one problem suppose hundred people in a class can speak French 50 people can Russian while 20 can speak both the languages if each student in that class speaks either French or Russian if each student in that class can speak either French or Russian then how many students are there all together now let us denote by F the set of students set of students who speak French and by our set of students who speak Russian now it is clear that the number of students who speak French is equal to 100 the number of students who speak Russian is equal to 50 and number of students who are in both the groups is equal to 20 and we have been told that any student in the class speaks either French or Russian so the total number of students in the class is the number of students in the set F union R or the cardinality of the set F union R which is given by cardinality of F plus cardinality of R minus cardinality of F intersection R and therefore we are going to get 100 plus 50 minus 20 which is 130 now let us look at another example which I will leave as an exercise from a group of 10 doctors how many ways a committee of 5 can be formed so that at least one of doctor A and doctor B will be included what I claim is that this problem also can be attempted by the principle of inclusion and exclusion I leave it as an exercise next we move to principle of inclusion and exclusion for three sets here we will take the three sets to be A B and C we will draw a Venn diagram showing the general situation so I have A here A then B and then C now this region is A intersection B complement intersection C complement this region is A intersection B intersection C complement this region is A intersection C or rather let me write A intersection B complement intersection C this region is A complement intersection B complement intersection C this region is A complement intersection B intersection C and lastly this one is A complement intersection C complement let me write B first so I will write over here B and not the complement so let me remove this portion so this is A complement intersection B intersection C complement now therefore we can write down the cardinalities of ABC cardinality of A is equal to cardinality of A intersection B complement intersection C complement plus A intersection B intersection C complement plus A intersection B intersection C plus A intersection B complement intersection C incidentally I have left out one set over here this set this is A intersection B intersection C cardinality of B in a similar way is A complement B intersection B intersection C complement plus A intersection B intersection C complement plus A intersection B intersection C plus A complement intersection B intersection C cardinality of C is A complement intersection B complement intersection C plus A intersection B complement intersection C plus A intersection B intersection C plus A complement intersection B and if I sum all of them then I am going to get we have this expression now what we will see is that a intersection B complement intersection C complement which is this portion then a intersection B intersection C complement which is this portion a intersection B intersection C which is this portion then a intersection B complement intersection C which is this portion this is whole of a and then we have a complement B C complement this is this portion and then we have we have a complement intersection B intersection C which is this portion and lastly we have a complement intersection B complement intersection C which is this portion all of them together gives me the cardinality of A union B union C so I can write cardinality of A union B union C which is sum of these terms plus a intersection B intersection C complement plus a intersection B intersection C plus a intersection B complement intersection C plus a intersection B intersection C plus a complement intersection B intersection C is five elements now if we consider these two terms we will see that we get a intersection B because this is a intersection B intersection C complement and a intersection B intersection C so together we get a intersection B so let me write down this is cardinality of A union B union C plus a intersection B plus this one and this one together gives me a intersection C and lastly I have a complement intersection B intersection C therefore I have an expression like this so A in union B union C is equal to cardinality of A plus cardinality of B plus cardinality of C minus cardinality of A intersection B minus cardinality of A intersection C minus cardinality of A complement intersection B intersection C complement now if we consider the set B intersection C then we see that B intersection C is A intersection B intersection C cardinality plus A complement intersection B intersection C if I replace this above I get A union B union C cardinality is equal to cardinality of A plus cardinality of B plus cardinality of C minus cardinality of A intersection B minus cardinality of A intersection C minus cardinality of B intersection C plus cardinality of A intersection B intersection C which is the final result once we come to the this point we wonder that what should be the general form we have seen for two sets A and B what is the cardinality of A union B in terms of cardinality of AB and A intersection B we have seen for three sets ABC just now an expression of cardinality of A union B union C in terms of cardinality of ABC and the mutual intersections what about the general expression in general we can have a finite number of sets is with finite cardinality and we are interested in the cardinality of their union now let me write the general statement first I write the header as the general statement of the principle of inclusion exclusion if ai i equal to 1 2 dot n are finite subsets a universal set U then cardinality of A in union a 2 union so on up to union an is equal to summation i equal to 1 to n cardinality of ai minus sigma i,j where i is lesson j cardinality of ai intersection a j plus sigma i less than j less than k cardinality of ai a j k that is cardinality of ai intersection a j intersection a k and it will go on like this to the final term 1 raise to the power n minus 1 a 1 intersection up to intersection a n now this is a general form the question is that how do we prove it now I will give a short argument of the proof let me write down proof suppose that element x belongs to a 1 union a 2 union up to a n is in exactly m of the sets say x belongs to a 1 up to x belongs to a m and x does not belong to a m plus 1 up to x does not belong to a n so I start by considering an element which is in exactly m sets and without loss of generality I assume that x is in the first m subsets and strictly not in the other ones now the question is that how many times x will be counted so if you look at this expression then x will be counted m many ways in the first sum will be counted in each of the terms ai i equal to 1 up to m that is x will be counted m choose 1 times in i equal to 1 to n sigma ai similarly x will be counted m choose 2 many times in sigma ai intersection aj will be counted m choose 3 many times in sigma ai intersection aj intersection ak and so on so if we keep on increasing the number of sets then we will and count the number of times x will be counted and we will find that we have a series so the x is counted in this way so x so x is counted m choose 1 many times in the first sum and then the second sum it is counted m choose too many times but we subtract the second from the first then we add up the next one and we proceed in this way to go up to – 1 raise to the power m – 1 m choose m now we see so this is the total number of times any x belonging to a 1 union up to a n will be counted provided that it is in m many subsets of the considered subsets so now we see the binomial expansion of 1 – 1 raise to the power m which is equal to sigma i equal to 0 to m m choose i – 1 raise to the power i 1 raise to the power m – i which is equal to m choose 0 – m choose 1 plus m choose 2 – 1 square plus m choose 3 – 1 cube plus and so on up to – 1 raise to the power m m choose m and remembering that m choose 0 is 1 and transposing we will have 1 equal to m choose 1 – or just write plus – 1 raise to the power 1 m choose 2 plus and so on plus – 1 raise to the power m – 1 m choose m and so we see that this sum appears over here and which is equal to 1 this means that when I consider the expression let us recall that expression again in this expression if I take any x belonging to a 1 union a n and see that number of times it is counted here and appropriately add and subtract those numbers depending on the signs that adds up always to one so any x here is counted once when I consider this total number of counts therefore this total count is exactly this and this is the general principle of inclusion and exclusion I will stop here today and in the next lecture we will work out certain problems on the principle of inclusion and exclusion in the general form thank you.