 In this video, we're gonna start introducing the algebra of sets. I mean, this is an abstract algebra class. And although our algebraic objects like groups, rings, and fields are based upon the idea of a set, it turns out that the fundamental unit of mathematics here, the set itself, has some pretty important algebraic operations. So if we have two sets A and B, we can talk about the intersection of the sets denoted A intersect B, which in latex you just write A backslash cap B, like so. The intersection is the set consisting of elements that belong to both A and B. And so if you've done any study in like logic or Boolean algebra or something, intersections and logical word and are essentially interchangeable. If an element belongs to A and belongs to B, then it's part of the intersection. The union on the other hand, the union of A and B is denoted in the following way, A union B, which we write that in latex is A backslash cap B. The union is the set consisting of elements that belong to A or B. And in logic, this is not the, in native language, like in English, when we say the word or, we typically mean things like it's either this or that, which is often referred to as exclusive or. So if it's like, hmm, what are we gonna do tonight? Well, we could go to the movie or we could go to a play, right? You know, these are options we could do for our recreation for the night. And when people say or, you don't typically mean you're gonna go do both, you're saying I'll do this one or the other one, but not both. In logic, when we use the word or, we actually are using the exclusive meaning of or, which means that we do A or B or both. We're gonna need to notice here when we describe these sets is that the elements A and B themselves, sorry, the sets A and B are subsets of the union. So A is a subset of A union B and B is also a subset of A union B. All of A is in there, all of B is in there as well. And so one often things are like Venn diagrams when you draw these things. So like if this is A and B, the union would be all of the sets right there, including the overlap. The overlap right here is the intersection, which is also a subset of A and B. And some universal properties here, the intersection A and B, this is the largest set that is a subset of both A and B. That is any other subset of A and B is a subset of the intersection. And likewise, A union B is the smallest set which has A and B as a subset. So you could say this is like the least upper bound when it comes to sets containing A and B here. Now, when one describes intersections and unions, sometimes we have to have larger intersections. Like what if we intersect a larger number of sets, not just two, but if we want to intersect like say N mini sets, three sets, four sets, five sets, N could be any natural number here. If we wanted to know A1 intersect A2 intersect all the way up to AN, we can abbreviate this using this symbol right here. This would be a, basically if you think the computer science we're writing a for loop for our intersections here. This would be the intersection of all the sets A1 through AN. This is as much like in calculus when you have your sigma notation I equals one to N and you add up some function f of xi star or something like that, right? Delta X would do these Riemann sums in calculus. You look at the bottom, you have some dummy variable I. This is just the number that ranges from the two numbers. You start with one on the bottom, go up to N on the top. We can do the same thing with intersections and unions. So a big cap represents you have an iterated intersection. A big cup represents you have an iteration of unions at some time. So you take the union of the sets A1, A2 up to AN. And in latex these symbols are just gonna be backslash big cup. And then if you want to put the superscripts and subscripts there, what you do is when you have a symbol whenever you follow it by an underscore that'll do the subscript. You might need to do some curly braces I equals one like so. And if you wanna do the superscripts, superscripts and latex are always done with a carrot. So that's the shift six on your keyboard, carrot. And you can write just an N. You don't need curly braces because there's only one symbol following that. But if you wanted to be proper, you could do some curly braces right there. And this will give you big cup. The intersection is drawn as a big cap, big cap, like so. We say that two sets are disjoint if they're intersect, which does happen on occasion. You know, the intersection will, sorry, the empty set will show up sometimes in surprising ways, right? Why do we care about this empty set so much if there's nothing inside of it? Well, it could be that there is some, you know, some property, some criteria that defines a set that turns out to be the empty set. We are interested in that criteria, but you know, it might not be obvious to us from the beginning that that set turned out to be empty. Like for example, if we define our set to be the set of all purple unicorns you can currently see on the screen named Hank. Well, you can see that, oh, there are no purple unicorns on the screen named Hank. So that set would be an empty set. This empty set can show up in surprising ways sometimes. Consider the following three sets. One, three, five, eight is the set A. Three, five, seven is the set B. And two, four, six, eight, who do we appreciate? That's set C. I'm going to do some operations with these things. It's pretty basic, the intersection of A and B. So we're looking for those elements that belong to both sets. So if you look at, if you just kind of just run through the list there, one belongs to A, but doesn't belong to B. So that's not in the intersection. Three is in both of those. So three will be in the intersection. Five belongs to both, but eight and seven don't belong to both. So the intersection would be the set three and five that you see right there. Let me clear off the board there. So we get the intersection just fine. If we want to do the union of A and B, what that would look like, we're just going to take everything that's in A, one, three, five and eight. We're going to take everything that's in B, three, five and seven. And remember, repetition doesn't really matter when it comes to a set. So the fact that three and five got listed twice, you can just kind of remove it from the list that doesn't change the set. And if you want to put in a numerical order, you can put the seven in front of the eight. But in terms of sets, the order doesn't matter. So saying the union is one, three, five, three, one, three, five, eight, three, five, seven is correct. Although a little bit more, maybe more proper, if we want to use some etiquette, you know, like we want to stand up when a lady enters the room or something. If we want to be proper, we could write this as one, three, five, seven, eight, but be aware that bad manners is not part of set theory in any regard. We can allow such poor etiquette when it comes to describing sets here. So one last example of these set operations. One might be interested in computing intersections and unions take operations of like numerical arithmetic additions, attraction, multiplication, division. We don't have an inherent hierarchy when it comes to set operations. That is we don't have this priority over intersections or vice versa. And so one needs to use parenthesis so we don't have ambiguous statements because the set B intersect A union C. This is an ambiguous statement. Is it B intersect A union C like we have in front of us or is it B intersect A union C? Those are two different sets. And I'll have you calculate this second one just to verify this. If you wanted to A union C, parenthesis tell us we'll do A union C first, we're gonna join together the elements of A and C. So we're gonna get a one, a two, a three, a four, a five, a six, and an eight shows up twice. So we get this union right here. Great. Now with A union C in mind, we intersect that with B. What set, what elements belong to both sets? Well, we're gonna get, I'm gonna actually look at the smaller set first, right? Three belongs to both sets, five belongs to both sets, but seven doesn't belong. So the intersection of B with A union C is also three comma five like we see there. When working with sets, it often is gonna be helpful to talk about this in context of a larger set, which we often refer to as the universal set. This is gonna, when we start talking about the idea of a compliment, because we wanna talk about what's not in the set that's given here. What's not in A? Because we wanna ask what's not in the set. If we take the set like the following set, one, two, five, seven, nine, we might ask what's not in A? Well, the number, let's see, three is not in A. The number 10 is not in A. Pikachu is not in A. My lost childhood memories are not in A, right? We have to kind of specify what is the universe we're talking about. And so this is often called this universal set, which would be called U oftentimes. And so inside of a specific context, we have to talk about what's the universe we're describing. Every time I talk about the universe, the real numbers, the complex numbers, the integers, it's important to specify the, otherwise we get into certain logical problems and we wanna. So once with a specific universe nailed down, we can talk about the complement of a set A, which we're gonna denote this as A prime here. And this is gonna be a set of all elements in the universe that are not in A. So logically, complements mean the same thing as the word not. Now, other contexts might use different symbols like A bar, A C, or a little twiddle A. We use A prime to denote complements, but there is not one universally accepted symbol to represent the negation of a set. But as an example, if we take the set U to be all of those positive integers one through nine, so one, two, three, four, five, six, seven, eight, nine, that's our universe. Take the set A here, let us specify its complement. There's a typo here that I see. If we want the things that are in U, but not in A, we should have, because you know, one, two is in A, we want a three right there, not a two, two was in A. So we want three, three is in U, it's not in A, four is in U, not in A, five is in A, six is in U, but not in A, seven is in A, so we don't take it, eight is in U, but not in A, and then nine is in A. So we get these four elements, three, four, six, and eight. These are the elements of A prime. If we do this for B, one, two, four, we want the elements in U, not in B, we're gonna grab three, we get three, five, six, seven, eight, nine, all of these elements right here. So this is how we describe the complement of a set right here. And some interesting things I wanna mention about these complements here, if you have a set A and you intersect it with its complement, this is always gonna be the empty set, because the complement by definition is taking those elements which are in, that there can't be an element in both of them, because if you're in A, you cannot be not in A. So the intersection's always the empty set. On the other hand, if you take the union of a set with its complement, this always gives you back the universe, because A prime is the set of all things not in A that are in U, so if you're in U, you're either in A or you're not in A. I mean, that's the dichotomy you get there, and so those properties hold for any set in any universe here. Related to this idea is the idea of a set difference that we're gonna define in just a moment. So let's take some sets in this case, take A to be the set, red, green, and blue, you know, like so the standard colors for like defining colors, maybe in a computer, like HTML or something, and we'll take then B to be the six standard colors of the rainbow, right? Primary and secondary colors. In case you're not knowing here, purple and violet work, we're defining that to be the same thing. Some people will distinguish between them. In fact, Latek actually says purple and violet are different, this seems crazy to me. And also you'll notice that Indigo is not present, sorry. Indigo is not a secondary or primary color. So if we take the intersection of B with A prime, what we're looking for is we want the elements inside of B and inside A prime. But A prime is the set of elements which are not in A. So we want things that are in B, but not in A. So what's in B that's not in A? Well, A contains red, so that one goes away. Orange is in B, but not in A. Yellow is in B, but not in A. Green was in A, so it's not in A prime. Blue is in A, so it's not in A prime. And then purple is in B, but not in A, like so. And so B intersect A prime will be orange, yellow, purple, like so. Now you might notice that with this example we just did here, I was able to compute the intersection of B and A prime without specifying the universal set. So is A prime, can we define without a universal set? Well, not exactly, but when it comes to B intersect A prime, all I have to know is, I have to know the elements that are in B that are not in A prime. And so in all reality, I'm kind of using B as my universal set, so to speak. Even though A itself might not be a subset of B. And so when it comes to B intersect complement, this actually will be defined as the set difference. And one can actually define the set difference without the use of any universal set whatsoever. It's commonly denoted like this. So we take B slash A like that. This is the set difference. We want everything in B that's not in A. Some people actually use the subtraction symbol to define set difference that's fine. In terms of latex, you can use backslash set minus to give you this symbol right here. Personally though, it feels a little too slanted for me. I like the small set minus button, but in terms of set theory, the two symbols are interchangeable there. And so the set difference gathers everything in B that's not in A. And so the set difference A take away B, this would be A intersect B prime. Now, sometimes this could be the empty set, right? That would happen if you take away, if you take B away from A and you get the empty set, that would translate to mean that A is a subset of B. If you take B away from A, that means everything that's in B, sorry, that everything that's in A actually belonged to B, so A was a subset. And so in general, if A is a subset of B, you're gonna get that the set difference is the empty set. These two things happen if and only if, just so you're aware as you're working with set differences here.