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

### Course: Statistics and probability>Unit 7

Lesson 3: Basic set operations

# Bringing the set operations together

Sal summarizes the set operations that he has discussed in the previous videos. Created by Sal Khan.

## Want to join the conversation?

• Do the set operations have an order of precedence in the same way the operations of arithmetic do. In this example it's not clear to me if you do the union with (B intersect C) before or after the difference from A.
(84 votes)
• Yes, if you wanted to write a solver, you would have to define strict ordering or require no ambiguity (by judicious use of parenthesis). Due to unions and intersections, you can't just rewrite all these operations in terms of normal addition and substraction to reveal you have the same commutative properties.

In this case, if you did the union first, you'd get:
`{3, 7, -5, 0, 13} \ {3, 7, -5, 13, 17, *} = {0}`
Which is of course different than `{0, 17, 3, *}`, implying ordering is important.
(58 votes)
• As in arithmetic with PEMDAS, is there an order of operations for set operations?
(14 votes)
• Well, parentheses come first, and both union and intersection distribute over the parentheses. So:

A ∩ (B U C) = (A ∩ B) U (A ∩ C)
and
A U (B ∩ C) = (A U B) ∩ (A U C)

Depending on what quantities are known, this can often help in calculating probabilities, because it allows us to write what we want to find in different terms, trying to get to terms that we do know. Also, complements have a particular rule:

(A U B)' = A' ∩ B'
and
(A ∩ B)' = A' U B'
The operation changes when you distribute the complement over the parentheses. These two are called De Morgan's Laws.

Now if there were something like: A ∩ (B U C)' . Here you should first take the complement of the parentheses. In this case it turns into an intersection, so there would be no need to more parentheses afterwards: A ∩ (B U C)' = A ∩ B' ∩ C'

But if you had: A ∩ (B ∩ C)' , you should first complement the term in parentheses:

A ∩ (B ∩ C)' = A ∩ (B' U C') = (A ∩ B') U (A ∩ C')
(36 votes)
• I think it is interesting that the empty set { } is different from a set containing a zero {0}. It is kind of difficult to wrap my brain around the idea that the very definition of nothing is an object itself. I guess you could call an empty set an "emptier" nothing, but then again, couldn't you have a set that contained an empty set? {{ }} Then even the empty set itself becomes an element. Is there anything that can't become an object?
(8 votes)
• The empty set is a very important concept and is very different from {0}. For instance, think about the set of all real numbers x such that x = x+1. There aren't any, right? So that solution set is the empty set. {0} would mean that 0 is a solution to that equation, which is different (and untrue).

And, yes, any mathematical object can be a member of a set, and the empty set is a mathematical object. But realize that {{}} is not the empty set -- it is a set with one element, and that one element is the empty set.
(29 votes)
• Just to help make it a bit simpler to understand is A∩B' = A\B ?
(11 votes)
• A∩B = A and B
(2 votes)
• Just out of curiosity, what are the practical applications of this math? (I don't really care, I'm just wondering.)
(6 votes)
• It's a fundamental part of math and much of it can be expressed through set theory. However, if you're not a mathematician, the most practical benefits of it come in the form of computer software — for example fast route finding for your GPS, sorting and efficient memory structures.
(14 votes)
• What is the difference between Equivalent and equal sets?
(3 votes)
• Two sets are equivalent when they each contain the same number of elements.
Two sets are equal when all of their elements are identical.

For example, if A = {1,2,3,4}, B = {5,6,7,8}, C = {2,4,3,1}, and D = {4,6,9}, then A, B, and C are equivalent sets (they all contain 4 elements), but only A and C are equal sets (they contain all the same elements).
(12 votes)
• If A and B be two finite sets such that the
total number of subsets of A is 960 more
than the total number of subsets of B, then
n(A)−n(B) (where n(X) denotes the
number of elements in set X) is equal to
(5 votes)
• Interesting problem!

In general, if a set has m elements, then there are a total of 2^m possible subsets. This is because each element has two possible outcomes: the element either belongs or does not belong to the subset. It then follows from the Fundamental Counting Principle that the total number of subsets is the product of m factors of 2, that is, 2^m.

Now let a = n(A) and b = n(B), with a and b non-negative integers.
Since the total number of subsets of A is 960 more than the total number of subsets of B, we have
2^a = 2^b + 960.

Dividing both sides by 2^a gives 1 = 2^(b-a) + 960/(2^a).

Note that this implies that 2^(b-a) < 1 and 960/(2^a) < 1, since 2^(b-a) > 0 and 960/(2^a) > 0.
Since 2^(b-a) < 1, b-a < 0. Because b and a are integers, b-a <= -1 and so 2^(b-a) <= 1/2.
Therefore, since 1 = 2^(b-a) + 960/(2^a), 960/(2^a) >= 1 - 1/2 = 1/2.
So 1/2 <= 960/(2^a) < 1 which implies that 960 < 2^a <= 1,920.
Note that 2^10 = 1,024, which exceeds 960 but does not exceed 1,920; 2^9 = 512 < 960; and 2^11 = 2,048 > 1,920.
Therefore, since a is an integer and 2^a increases with a, the only solution for a is a = 10.

Substituting a = 10 into the equation 1 = 2^(b-a) + 960/(2^a) gives
1 = 2^(b-a) + 960/(2^10); 2^(b-a) = 1 - 960/1,024 = 64/1,024 = 1/16 = 1/(2^4); b-a = -4.

Therefore, n(A)−n(B) = a-b = -(b-a) = -(-4) = 4. (So n(A) = 10 and n(B) = 6.)

Have a blessed, wonderful day!
(6 votes)
• um, if the bracket contains a 0, shouldn't it be a null, since it contains no value? ( sorry for silly doubts :P)
(2 votes)
• 0 is a value. { 0 } is not an empty set.
(5 votes)
• is there a less complicated problem?
cause that would help a lot.
(2 votes)
• You could start out doing the simplest parts of this big problem - like "B intersect C", or "B\C". Sometimes it helps a lot to review earlier videos.
(5 votes)
• hey, what are the rules for the order of solving..., how do I figure out which operation is to be performed first??
(2 votes)

## Video transcript

Let's now use our understanding of some of the operations on sets to get some blood flowing to our brains. So I've defined some sets here. And just to make things interesting, I haven't only put numbers in these sets. I've even put some colors and some little yellow stars here. And what I want you to figure out is what would this set be, this crazy thing that involves relative complements, intersections, unions, absolute complements. So I encourage you to pause it and try to figure out what this set would be. Well, let's give it a shot. And the key here is to really break it down, work on the stuff in the parentheses first, just as you would do if you were trying to parse a traditional mathematical statement. And then it should hopefully make a little bit of sense. So a good place to start might be to try to figure out what is the relative complement of C in B. Or another way of thinking about it is what is B minus C? What is B if you take out all the stuff with C in it? So let me write this down. The relative complement of C and B or you could call this B minus C. This is all the stuff in B with all the stuff in C taken out of it. So let's think about what this would be. B has a 0. Does C have a 0? No, so we don't have to take out the 0. B has a 17. Does C have a 17? Yes, it does. So we take out the 17. B has a 3, but c has a 3. So we take that out. B has a Blue. C does not have a blue. So we leave the Blue in. So let me write down-- we leave the blue in. And then B has a gold star. C also has a gold star. So we take the gold star out. So the relative complement of C in B is just the set of 0 and this Blue written in blue. So let me write this down. Let me write that down. Now, it gets interesting. We're going to take the absolute complement, the absolute complement of that. So let me write this down. So B-- the absolute complement of this business is going to be-- let me write it this-- the set of all things in our universe that are neither a 0 or a-- and I'll write it in blue-- or a Blue. That's the only way I could describe it right now. I haven't really defined the universe well. We already see that our universe definitely contains some integers, it contains colors, it contains some stars. So this is all I can really say. This is the set of all things in the universe that are neither a 0 or a Blue. So fair enough. So we so far we figured out all of this stuff. Let me box this off. So that is that right over there. And now we want to find the intersection. We need to find the intersection of A and this business. Let me write that down. So it's going to be A intersected with the relative complement of C and B and the absolute complement of that. So this is going to be the intersection of the set A and the set of all things in the universe that are neither a 0 or a Blue. So it's essentially the things that satisfy both of these that has to be in set A and it has to be in the set of all things in the universe that are neither a 0 or a blue. So let's think about what this is. So the number 3 is in set A and it's in the set of all things in the universe that are neither a 0 or Blue. So let's throw a 3 in there. The number 7, it's in A and it's in the set of all things in the universe that are neither a 0 or a Blue. So let's put a 7 there. Negative 5 also meets that constraint. A 0 does not meet that constraint. A 0 is in A but it's not in the set of all things in the universe that are neither a 0 or blue because it is a 0. So we're not going to throw 0 in there. And then a 13 is in A and it's in the set of all things in the universe that are neither a 0 or a Blue. So we could throw a 13 in there. So we've simplified things a good bit. This whole crazy business, all of this crazy business, has simplified to this set right over here. Now we want to find the relative complement of this business in A. So let me pick another color here. So we want to find the relative complement of this business in A. And I'll just write out the set-- 3, 7, negative 5, 13. Actually, let me write out both of them just so that we can really visualize them both right over here. So A is this. It is 3, 7, negative 5, 0, and 13. And I could write the relative complement sign. Or actually, let me just write m-- well let me write relative complement. I was going to write minus. And so in all of this business, we already figured out, is a 3, a 7, a negative 5, and a 13. So it's essentially, start with this set and take out all the stuff that are in this set. So this is going to be equal to-- so you see we're going to have to take out a 3 out of this set. We're going to take out a 7. We're going to get a negative 5. And we're going to take out a 13. So we're just left with the set that contains a 0. So all of this business right over here has simplified to a set that only contains a 0. Now let's think about what B intersect C is. These are all the things that are in both B and C. So this is going to be B intersect C. Let's see, 0 is not in both of them. 17 is in both of them. So we'll throw 17 in there. The number 3 is in both of them, the number 3 is in both of them. Blue is not in both of them. The star is in both of them. So I'll put the little gold star right over there. And so that's B intersect C. And so we're essentially going to take the union of this crazy thing-- which ended up just being a set with a 0 in it-- we're taking the union of that and B intersect C. We deserve a drum roll now. This is all going to be equal to-- we're just going to combine these two sets. It's going to be the set with a 0, a 17, a three, and our gold star. And we are-- I should make the brackets in a different color-- and we are done.