If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Relative complement or difference between sets

Sal shows an example finding the relative complement or difference of two sets A and B. Created by Sal Khan.

Want to join the conversation?

Video transcript

What we're now going to think about is finding the differences between sets. And the first way that we will denote this is we'll start with set A. I've already defined set A. Let me do it in that same shade of green. I've already defined set A here. And in both cases, I've defined these sets with numbers. Instead of having numbers as being the objects in the set, I could have had farm animals there or famous presidents, but numbers hopefully keep things fairly simple. So I'm going to start with set A. And from set A, I'm going to subtract set B. So this is one way of thinking about the difference between set A and set B. And when I've written it this way, this essentially says give me the set of all of the objects that are in A with the things that are in B taken out of that set. So let's think about what that means. So what's in set A with the things that are in B taken out? Well, that means-- let's take set A and take out a 17, a 19-- or take out the 17s, the 19s, and the 6s. So we're going to be left with-- we're going to have the 5. We're going to have the 3. We're not going to have the 17 because we subtracted out set B. 17 is in set B, so take out anything that is in set B. So you get the 5, the 3. See, the 12 is not in set B, so we can keep that in there. And then the 19 is in set B, so we're going to take out the 19 as well. And so that is this right over here is-- you could view it as set B subtracted from set A. So one way of thinking about it, like we just said, these are all of the elements that are in set A that are not in set B. Another way you could think about it is, these are all of the elements that are not in set B, but also in set A. So let me make it clear. You could view this as B subtracted from A. Or you could view this as the relative complement-- I always have trouble spelling things-- relative complement of set B in A. And we're going to talk a lot more about complements in the future. But the complement is the things that are not in B. And so this is saying, look, what are all of the things that are not in B-- so you could say what are all of the things not in B but are in A? So once again, if you said all of the things that aren't in B, then you're thinking about all of the numbers in the whole universe that aren't 17, 19, or 6. And actually, you could even think broader. You're not even just thinking about numbers. It could even be the color orange is not in set B, so that would be in the absolute complement of B. I don't see a zebra here in set B, so that would be its complement. But we're saying, what are the things that are not in B but are in A? And that would be the numbers 5, 3, and 12. Now, when we visualized this as B subtracted from A, you might be saying, hey, wait, look, look. OK. I could imagine you took the 17 out. You took the 19 out. But what about taking the 6 out? Shouldn't you have taken a 6 out? Or in traditional subtraction, maybe we would end up with a negative number or something. And when you subtract a set, if the set you're subtracting from does not have that element, then taking that element out of it doesn't change it. If I start with set A, and if I take all the 6s out of set A, it doesn't change it. There was no 6 to begin with. I could take all the zebras out of set A; it will not change it. Now, another way to denote the relative complement of set B in A or B subtracted from A, is the notation that I'm about to write. We could have written it this way. A and then we would have had this little figure like this. That looks eerily like a division sign, but this also means the difference between set A and B where we're talking about-- when we write it this way, we're talking about all the things in set A that are not in set B. Or the things in set B taken out of set A. Or the relative complement of B in A. Now, with that out of the way, let's think about things the other way around. What would B slash-- I'll just call it a slash right over here. What would B minus A be? So what would be B minus A? Which we could also write it as B minus A. What would this be equal to? Well, just going back, we could view this as all of the things in B with all of the things in A taken out of it. Or all of the things-- the complement of A that happens to be in B. So let's think of it as the set B with all of the things in A taken out of it. So if we start with set B, we have a 17. But a 17 is in set A, so we have to take the 17 out. Then we have a 19. But there's a 19 in set A, so we have to take the 19 out. Then we have a 6. Oh, well, we don't have to take a 6 out of B because the 6 is not in set A. So we're left with just the 6. So this would be just the set with a single element in it, set 6. Now let me ask another question. What would the relative complement of A in A be? Well, this is the same thing as A minus A. And this is literally saying, let's take set A and then take all of the things that are in set A out of it. Well, I start with the 5. Oh, but there's already a 5. There's a 5 in set A. So I have to take the 5 out. Well, there's a 3, but there's a 3 in set A, so I have to take a 3 out. So I'm going to take all of these things out. And so I'm just going to be left with the empty set, often called the null set. And sometimes the notation for that will look like this, the null set, the empty set. There's a set that has absolutely no objects in it.