 Welcome back to our lecture series, Math 3120, transition to advanced mathematics for students at Silicon Valley University. As usual, I'll be a professor today, Dr. Andrew Misseldine. In this first video for lecture 16, I want to introduce to you the concept of the principle of inclusion exclusion. Before we state what that is, I actually wanna provide an example to kind of motivate not just what the theorem is, but also kind of simultaneously prove it at the same time. So imagine a fictitious survey was conducted among 100 math students, and 35 of the students were registered for abstract algebra, which is a common math class that math majors need to take. And 52 students were registered for common torques, which remember common torques is the mathematics of counting things. We're doing a common torques problem right now. And imagine that we know that 18 of those 100 math students surveyed were registered for both classes in the same semester. Okay, the task that we wanna, the problem we have in front of us right now is we wanna answer the question, how many students were registered in abstract algebra or in common torques? Now, notice this information about 18. This would be how many students are registered in both of the classes. For the sake of example, let's let set A be the set of students who are registered for abstract algebra, A for abstract algebra. And we're gonna let set B be the set of students who's registered for common torques. Clearly, you know, B stands for common torques right there. So we have our two sets, A and B right now. So if we wanna know how many students are registered for abstract algebra or common torques, what we're trying to do right now is we're trying to find the cardinality of the union of the two sets, A and B together. Now, we've used the addition principle, the addition counting principle in previous lessons to solve enumeration problems that involve partitions. So like if you have a set and you can break it up into a couple pieces, if you can count the sizes of each of the cells in the partition, then you can add those all together to get the size, the cardinality of the total set. But the way that this worked for the additive principle with partitions is that the partitions didn't overlap at all. That is the cells in the partition didn't overlap. There was no intersection. Each of these cells were mutually exclusive. The problem now is that if we have cells that overlap each other, like consider this Venn diagram right here, we have set A and we have set B. We actually know that there's an overlap. There are 18 students who are in both of the classes. So it might be tempting to be like, oh, I'm just gonna take the cardinality of A plus the cardinality of B. But if you do that, you're counting the number of students who are in both of the sets more than once because those who are in both classes are counted over here and counted over here. Essentially, you're counting them twice, okay? And so what you have to do to compensate for that in order to count the union, you can take everything that's in A, you can take everything that's in B, but then you have to subtract off the intersection of the two sets. Because like I said, everyone who's in the intersection was counted here and counted here, I want to count them only once and only once and so you need to subtract it off. Another way of doing that is the following observation. Again, using our Venn diagrams here, A union B is the same thing as A takeaway B, which is this set right here. You have, of course, also B takeaway A, which is this set right here. All right, and then you also have their intersection, A intersect B, which is this set right here, okay? For which we actually know how big that one is. So when it comes to A intersect B, A intersect, excuse me, A takeaway B, this is the same thing as of course A takeaway, because we want to do this thing with cardinalities, right? So we want cardinalities of these things. The reason we changed these sets here is now unlike the first attempt when there's, the sets A and B do not form a partition of the union because they overlap. This is now a partition, right? Because as we've taken set differences, we've basically killed off the interaction, the overlap there. So when we add these together, we can actually use that to help us out here. So let me back up a little bit. If we want to find the cardinality of the union, we can take the cardinality of A minus B plus the cardinality of B minus A, and then we can take the cardinality of their intersection. That'll work as well. Now, how do you calculate the cardinality of A intersect B, excuse me, A minus B? Well, remember A minus B is the same thing as A intersect B compliments, right? So we're looking for those things that are in A but are not in B. There are 35 things that are in A. There are 18 things that are in their intersection, so which is also in B. So the cardinality there for A minus B is going to be 35 minus 18, okay? But then when you look at B minus A, you're gonna take the size of B, which is 52. Again, take away the things that are in B that are also in A, that's their intersection, that was 18, like so. And then if you throw in the intersection there of 18, notice what you have here, you have the cardinality of A, we have the cardinality of B, and then as these two terms cancel out here, you have the subtraction of that. So thus, if we turn our Venn diagram into a partition and simplify it, you then get this observation right here. The union, the size of the union is the size of the two sets minus the intersection, what I was suggesting earlier. So we can put these numbers in there, 35 plus 52 minus 18, and that's gonna give you 69. And so there are 69 students between the two sets, okay? Then we can also ask ourselves how many students are not registered for either of these classes? Of course, among the 100 students right there. And so that what we're asking is that the universe is you right here, the 100 students in play here. If we wanna find those who are not registered for it, what we're looking for is the cardinality of A union B complement. So we can take the cardinality of the universe minus the cardinality of A union B for which there was 100 students total, 69 students were in either abstract algebra or combinatorics. And therefore we would have 31 students who were surveyed, 31 math students who were surveyed who were in neither of these classes. So this example motivated what we call the principle of inclusion exclusion. And what it does is it allows us to compute the cardinality of A union. So the cardinality of the union of A and B would be take the sums of their cardinalities but then subtract their intersection. And so this, why do we call it the principle of inclusion exclusion? Well, the idea is we include all of the sets but then we have to exclude the intersection because we over counted it. And so then if you apply that, you don't even need to know much about the sets. As long as you know these cardinalities, you can use it. Now, some people like to rewrite this formula they move the intersection to the other side. So you can take the cardinality of the union plus the cardinality of the intersection. This is equal to the cardinality of A plus the cardinality of B. There's sort of like a symmetry there that if you add together A and B, that's the same thing as adding together their union intersection. That's kind of fun. And so you actually, if you know three of these numbers you can solve for the fourth one. Like let's say that we have two sets A and B whose union is 50, whose intersection is 10 and that B is 20, what would then be A? But we plug them into the formula, the union is 50. The intersection is 10. We don't know the cardinality of A but we know the cardinality of B is in fact 20. So on the left hand side, we get 50 plus 10 which is 60. We're gonna subtract the 20 from the size of B there. And so we get that the cardinality of A is equal to 40. So if we know the cardinality of three of these sets then we actually know the cardinality of all these sets. Now I'm not gonna go into the details of this in this video but I do wanna mention that this version of the inclusion exclusion principle is done when you have two sets but one can also talk about the union of three sets. Now this one is one you could get away drawing a Venn diagram. I want you to try to consider that on your own. But if you play around with Venn diagrams you can prove that the cardinality of the union the triple union is gonna be the cardinality of A plus the cardinality of B plus the cardinality of C then you have to subtract off the intersections because you counted them twice. So you'd have to take away the intersection of A, B the intersection of A, C and then you have to take off the intersection of B, C. The problem with this though is that as you're subtracting these intersections it turns out you're taking away the triple intersection too many times because all of these sets contain their intersections twice but then when you subtract them off you ended up taking the triple intersection off too many times, one too many times. So you can actually fix that by throwing the triple intersection A intersect B intersect C like so. And this then gives you the inclusion exclusion principle for three sets. And so that's again this illustrates the name you include the sets you exclude their intersections then you include again their triple intersection. And this principle applies in general for the union of four sets. It's a little bit harder to draw the Venn diagram there but you could do it. When it comes to four sets the cardinality will be the sum of the cardinalities of each of the sets minus the cardinality of their intersections plus the cardinality of all of the triple intersections then minus the cardinality of all of the quadruple intersections, there's only one of those there though. And this happens in general that you just have this alternating sum where you take the sums of cardinalities minus the sums of the intersections then the sums of the next intersections then minus the sums of the higher intersections until you run out. And this can be then proven in general. Now in general we'd have to prove this using the method of like induction which we have not introduced in this lecture series yet. So for now we'll stick with our Venn diagram argument from the previous slide and we can accept as truth the inclusion exclusion principle on two sets.