Main content

## Statistics and probability

### Course: Statistics and probability > Unit 7

Lesson 3: Basic set operations# 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?

- How does knowing where these sets intersects or not help us in real life?(14 votes)
- The truth of a problem exists only in the real world, however you see a problem is a representation of that problem in your mind. You look at a situation and create a picture of that situation in your head... that picture is not truth... it just feels truth-like to you.

Mathematics is a set of tools and techniques that helps us model the truth of the real world in different, sometimes more useful ways. Each technique you learn is a tool that might become useful.

I tell my students to think of math as a toolbox. If you have something you want to fix and you know how to fix it and you have the proper tools then the thing gets fixed. If you know it can be fixed but you don't have the tools then you are frustrated... and if you don't even know it can be fixed you just write it off.

If you don't have a particular technique in math you will just ignore problems that could have been solved using that technique... you won't slap yourself on the forehead and say "if I only knew set theory!"... you would either just bypass the problem or possibly not even recognize the situation as a problem in the first place.

And if you do learn set theory you most likely won't recognize that you are even using it... there will just be problems that you can now solve without realizing you wouldn't have been able to solve them before.

Math education is kind of like tech support... if it is done right you don't realize it's there and you might start to think you don't need it.(123 votes)

- Could a set be like this?

x = {1,2,3,4,1}

y = {5,6,7,8,5}

What would be the intersection and union of these sets?(14 votes)- Yes, those are both examples of sets. The intersect, or n, would be {} because there isn't anything that's the same in both sets. The union, or U, would be {1,2,3,4,5,6,7,8}, not necessarily in numerical order. We don't repeat numbers in a union.(27 votes)

- What do you do for an empty intersection?(7 votes)
- Well, just put a Ø or empty set( {} ) to indicate that it's empty.(29 votes)

- dose the new set's numbers have to be written in numerical order(6 votes)
- Sal said in the video that they do not have to be in order.(14 votes)

- I can see why the sign for union is a capital U, but how come the sign for intersect is an upside-down capital U?(5 votes)
- I remember the intersect sign as a capital A without the crossbar -- standing for "AND", as in the logic gate. The intersection of two sets is the set of elements which are in the first set AND the second set.(15 votes)

- What if you have something like (A"and"B) "and" C?(6 votes)
- It is referred to as associative property of union of sets. It looks something like this;

(AUB)UC = AU(BUC)

In simple words, changing the order in which operations are performed does not change the answer.

the operations inside the brackets are solved first.

For Example:

A={1,2}

B={3,4} and

C=[5,6] then (AUB)UC is;

AUB={1,2,3,4}

Now,

(1,2,3,4)U(5,6)= {1,2,3,4,5,6}(5 votes)

- Can the elements of a set be random things that have no connection with each other? Like A={ a,b,c,1,2,3,!,@,book, pen}?(5 votes)
- As per my knowledge, you can put whatever you want in those brackets. Basically, a set is just a collection of random things. Usually, all the elements have some kind of relation to each other. But theoretically, yes you can.

Edit: This is wrong as proved by Aditya below. Sorry for the inconvenience.(3 votes)

- Just asking, is there any unique way to remember what all the symbols mean (like a mnemonic, word association, etc.)? Thanks!(2 votes)
- Well to remember the difference between Intersection and Union, what I and most people do is look at if the U is right side up or not. If it is, it means Union. If it does not, it means intersection. To remember what words go with the symbols, I think of the way the U is facing aswell. If the U is upside down and the two lines are facing the bottom, I think of it as "and" because there are two lines. I hope that makes sense. I guess what you could do to remember the "or" is to just think of the opposite of "and". I hope that makes sense, I'm not the best explainer 😂😂😂. I also hope this helped!!(8 votes)

- So basically numbers in both sets would be an intersection and everything all together is a union.

Am I correct?(2 votes)**Union**of the sets`A`

and`B`

, denoted`A ∪ B`

, is the set of all objects that are a member of`A`

, or`B`

, or both. The union of`{1, 2, 3}`

and`{2, 3, 4}`

is the set`{1, 2, 3, 4}`

.**Intersection**of the sets`A`

and`B`

, denoted`A ∩ B`

, is the set of all objects that are members of both`A`

and`B`

. The intersection of`{1, 2, 3}`

and`{2, 3, 4}`

is the set`{2, 3}`

.(7 votes)

- What does 25U0 mean ?(3 votes)
- u means you have to write all the numbers of the two sets , but if a number comes in both sets,

write it 1 time.(2 votes)

## 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.