Welcome back everyone. We're going to finish up our suite on set theory by giving you a neat way to visualize sets, something called a Venn diagram. And what I'll do is I'll start by going over what Venn diagrams are and what they're used for. One of the neat tricks we're going to do is we're going to approve something called the inclusion-exclusion formula. Which tells you how big the union of 2 sets is in terms of the sets and their intersections. And then we'll revisit our medical testing example just to see how Venn diagrams work. And again Venn diagrams are just a way to look at sets and visualize what's going on. There's no proof to it, but it's often a good visualization trick. Okay, let's get to it. So let's first write a set in our old notation. So we have set A is equal to {1, 5, 10, 2}. So let's remember this means that there are cardinality of A is equal to what? Cardinality of A is equal to 4. Okay, so here we've written the set by just listing out this element 6 plus. Another way to write it is to write a big circle. And just put the elements kind of floating inside at anywhere, 1, 5, 10, 2. So this is A. We just think of A, we're really making explicit here as A as a bag for the ball with some things in it, 1, 5, 2. The ordering doesn't matter, there's nothing there, just A has four things in it. There they are. Okay, and by the way, you could write this any way you want. So that's might be for example the same as a 1, 2, 10, 5. It's just a visual notion. Okay, so what? Well this gives us a cool way to visualize things like intersections, so for example, let's write A again. A = {1, 10, 5, 2}. Let's take the set B is equal to 5, -7, 10, 3, and say set C is equal to 8,11. And just a way to depict, let's draw A as 1, 2, 10 and 5. And now, let's choose a different color. Let's draw the same color actually, let's draw a B. B has 5, -7, 10, and 3. Notice that A intersect B is 10 and 5, they share that in common. We can show that by having the two sets overlap. So here, one of the extra things in B, -7 and 3. And notice in some sense, this is A. This over here is B. But inside here is A intersect B, which we know is equal to 10, 5. But we can visually see it. What about poor little C here. C, it's 8 and 11. 8 and 11 share nothing in common with anything else so over here is C. And we're really making the visual point that C is disjoint from A. A intersect C is the empty set, B intersect C is the empty set. Okay, so that's kind of neat. Now let me erase this a little bit over here. And I'm going to use what I have over there to make one more point. So here's a formula you will often see called the inclusion-exclusion formula. And this is one of these formulas that's always true in general. We're going to see visually that it's true here, and we're going to check it by example. What this formula's concerned with is, if you take A union B. Let's remember what A union B is, it's a set of things which are in A or B. In terms of this picture by the way, A union B is everything you see, right? That's some sensitive point, if A is a little ball and B is a little ball, A union B is just the union of the two. The inclusion-exclusion formula tells us that the card now any of A union B, understood in terms of A and B is equal to the cardinality of A plus the cardinality of B minus the cardinality of A intersect B. Okay, so first is to check that's true in this case. So working over here, we know the cardinality of A union B, first, we can just count that, what's in A union B? 1 and 2 and 10 and 5 and -7 and 3, therefore it's equal to 6. Cardinality of A, 1 and 2 and 10 and 5 equal to 4. Cardinality of B, 10 and 5 and -7 and 3 is equal to 4. And the cardinality of A intersect B, 10 and 5, is 2. So we're basically asking, is 6 equal to 4 + 4- 2? And yup, turns out that's true, let's erase this question mark. Let's put back in a check. So that works. Of course, it works in that example, we also see visually why it works. Right? Because if we take the cardinality of A, we count it, there are all those elements. Then we take the cardinality of B and we count it, we take all those elements. What's wrong with saying that the cardinality of A union B equals the cardinality of A plus cardinality of B? Well we've double counted, we've given ourselves too much credit because we've counted 10 and 5 twice. So we've taken that into account by subtracting in essence one of the copies of 10 and one of the copies of 5. So cardinality of A union B equals cardinality of A plus the cardinality of B minus the cardinality of A intersect B. Okay fine. Now, with Venn diagrams at hand, let's revisit that medical testing example. So let's remember that X was equal to all the people, these are all the people who took some exam. Let's remember that X could be divided up into the healthy people, the people who did not have, I believe we call it, VBS for very bad syndrome. X union S, the people who did have it. So let's draw that partition here. We're going to draw it like this, there's the line. Over here are the healthy people and over here are the sick people. Notice we also have that H intersect S is empty, so somehow we used that line to divide the two. We had another partition. We have that X was divided up into the people who tested negative so they took a test to make that have because the test told them they did not have VBS. Union P where P was the set of people who took the test and that got very nervous because it told them they had VBS. So this is another partition of the set, let's use red. Now it look sort of like this. So in this side might be the people who tested negative. And on this side might be the people who tested positive. And notice the way I've drawn it. Venn diagrams are never a way to compute something, they're a way to encode visually assumptions. Notice how H and N are not the same but share a lot of area and P and S are not the same but share a lot of area. That's sort of making the point, the following point. Let's look at this guy right here. What does that consist of? That consists of people, who are in S but are also in N. So this is S intersect N, which we remember are the false negatives. The people who do have the disease but the test tells them they don't, that's very dangerous, it means they don't get the treatment they need. Over here, what is this? These are the set of people who are in H but also in P. So that's H intersect P which are the false positives. Those are also unfortunate people who are less unfortunate, they just get nervous for no reason. Ideally, what you would like for a perfect test is, where S intersect N and H intersect P to not be pair. In a good enough world, do you would like those little slivers to be really small compare to the rest? Okay. That concludes our video on Venn diagrams.