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

Intersection and union of sets

To find the intersection of two or more sets, you look for elements that are contained in all of the sets. To find the union of two or more sets, you combine all the elements from each set together, making sure to remove any duplicates. Created by Sal Khan.

Want to join the conversation?

Video transcript

What I want to do in this video is familiarize ourselves with the notion of a set and also perform some operations on sets. So a set is really just a collection of distinct objects. So for example, I could have a set-- let's call this set X. And I'll deal with numbers right now. But a set could contain anything. It could contain colors. It could contain people. It could contain other sets. It could contain cars. It could contain farm animals. But the numbers will be easy to deal with just because-- well, they're numbers. So let's say I have a set X, and it has the distinct objects in it, the number 3, the number 12, the number 5, and the number 13. That right there is a set. I could have another set. Let's call that set Y. I didn't have to call it Y. I could have called it A. I could have called it Sal. I could have called it a bunch of different things. But I'll just call it Y. And let's say that set Y-- it's a collection of the distinct objects, the number 14, the number 15, the number 6, and the number 3. So fair enough, those are just two set definitions. The way that we typically do it in mathematics is we put these little curly brackets around the objects that are separated by commas. Now let's do some basic operations on sets. And the first operation that I will do is called intersection. And so we would say X intersect-- the intersection of X and Y-- X intersect Y. And the way that I think about this, this is going to yield another set that contains the elements that are in both X and Y. So I often view this intersection symbol right here as "and." So all of the things that are in X and in Y. So what are those things going to be? Well, let's look at both sets X and Y. So the number 3 is in set X. Is it in set Y as well? Well, sure. It's in both. So it will be in the intersection of X and Y. Now, the number 12, that's in set X but it isn't at Y. So we're not going to include that. The number 5, it's in X, but it's not in Y. And then we have the number 13 is in X, but it's not in Y. And so over here, the intersection of X and Y, is the set that only has one object in it. It only has the number 3 So we are done. The intersection of X and Y is 3. Now, another common operation on sets is union. So you could have the union of X and Y. And the union I often view-- or people often view-- as "or." So we're thinking about all of the elements that are in X or Y. So in some ways you can kind of imagine that we're bringing these two sets together. So this is going to be-- and the key here is that we care-- a set is a collection of distinct objects. And the way we're conceptualizing things right here, this is the number 3. This isn't like somebody's score on a test or the number of apples they have. So there you could have multiple people with the same number of apples. Here we're talking about the object, the number 3, so we can only have a 3 once. But a 3 is in X or Y, so I'll put a 3 there. A 12 is in X or Y. A 5 is in X or Y. The 13 is in X or Y. And just to simplify things, we really don't care about order if we're just talking about a set. I've just put all of the things that are in set X here. And now let's see what we have to add from set Y. So we haven't put a 14 yet. So let's put a 14. We haven't put a 15 yet. We haven't put the 6 yet. And we already have a 3 in our set. So there you go. You have the union of X and Y. And one way to visualize sets and visualize intersections and unions and more complicated things, is using a Venn diagram. So let's say this whole box is-- you could view that as the set of all numbers. So that's all the numbers right over there. We have set X-- I'll just draw as circle right over here. And I could even draw the elements of set X. So you have 3 and 5 and 12 and 13. And then we can draw set Y. And notice, I drew a little overlapping here because they overlap at 3. 3 is an element in both set X and set Y. But set Y also has the numbers 14, 15, and 6. And so when we're talking about X intersect Y, we're talking about where the two sets overlap. So we're talking about this region right over here. And the only place that they overlap the way I've drawn it is at the number 3. So this is X intersect Y. And then X union Y is the combination of these two sets. So X union Y is literally everything right here that we are combining. Let's do one more example, just so that we make sure we understand intersection and union. So let's say that I have set A. And set A has the numbers 11, 4, 12, and 7 in it. And I have set B, and it has the numbers 13, 4, 12, 10, and 3 in it. So first of all, let's think about what A-- let me do that in A's color. Let's think about what A intersect B is going to be equal to. Well, it's the things that are in both sets. So I have 11 here. I don't have an 11 there. So that doesn't make the intersection. I have a 4 here. I also have a 4 here. So 4 is in A and B. It's in A and B. So I'll put a 4 here. The number 12, it's in A and B. So I'll put a 12 here. The number 7 is only in A. And the number, I guess, 13, 10 and 3 is only in B, so we're done. The set of 4 and 12 is the intersection of sets A and B. And we could even, if we want to, we could even label this as a new set. We could say set C is the intersection of A and B, and it's this set right over here. Now let's think about union. Let's think about A-- I want to do that in orange. Let's think about A union B. What are all the elements that are in A or B? Well, we can just literally put all the elements in A, 11, 4, 12, 7. And then put the things in B that aren't already in A. So let's see, 13. We already put the 4 and the 12, a 10 and a 3. And I could write this in any order I want. We don't care about order if we're thinking about a set. So this right here is the union.