 So, welcome to the first of the last. This is the last set of screencasts for the whole course. And we're ending off here with a glimpse ahead to a powerful algebra idea that forms the core of a lot of applied mathematics today. And that is modular arithmetic. This is a kind of arithmetic that's based on the notion of equivalence relations that we've been studying. So let's have a look. First of all, here's a reminder of something we've learned already. If we take the set of integers z and place this relation on it by declaring two integers to be related if and only if they are congruent to each other mod 3, then we've seen that this is an equivalence relation on z, the integers. It's a relation that is reflexive, symmetric, and transitive. In fact, if we replace 3 with any natural number, this is still an equivalence relation by the result of theorem 3.30 from your textbook. Let's have a look at some of the equivalence classes under this relation. First of all, what is the equivalence class of 0? Well, by definition, this is the set of all integers that are equivalent to 0 under this equivalence relation. And that means that it's the set of all integers that are congruent to 0 mod 3. So let's list those. 0 must be in the set because 0 is equivalent to itself mod 3. So would 3 and negative 3, 6 and negative 6, and so on. So what about the equivalence class of 1? Well, this contains 1 because of the reflexivity of the relation. One must be equivalent to itself, so it belongs in its own class. But we also have more things. We would have 4 because 1 and 4 are congruent mod 3. Negative 2, 7, negative 5, and so on. Similarly, the class of 2 has 2 in it, and also 5, and negative 1, and 8, and negative 4, and so on. What about the class of 3? Well, here you have something sort of interesting. We would have to have 3 in this class again because every integer belongs to its own equivalence class. So we would also have to have 6 and 0 and 9 and negative 3 and so on. But notice this is going to be the same set as the class of 0. So even though 0 and 3 are different integers, their equivalence classes are the same. So this is not a new or distinct equivalence class we're creating here. It's just a duplicate of one we already had. So this makes sense too in light of one of the results about equivalence classes that we proved in the section 7.3 videos. Namely, that if two elements of your base set are equivalent under the relation, then their equivalence classes have to be the same. So since 0 is congruent to 3 modulo 3, that means that 0 is equivalent to 3. And so therefore it makes sense that the equivalence class of 0 must be equal to the equivalence class of 3 as a set. We could start writing out the class of 4 as well, but since 4 is equivalent to 1 under this relation, we know we're just going to get the same set in the end as we did with the class of 1. So here's a question that will help you make a leap to an important concept that arises out of this example. Let's suppose that n is any natural number bigger than or equal to 2. And let's look at the relation on z, the entire set of integers, given by congruence mod n. So this is like the example we just saw except for replacing the 3 with just a generic natural number n bigger than or equal to 2. How many distinct equivalence classes will there be in this relation? Distinct, we mean different. So what's your thought on this? Well the correct answer here is going to be b. There's going to be n different equivalence classes where n is the natural number that we picked earlier. Notice when n was equal to 3 in the example from earlier, there were 3 distinct classes for example. We could write out more classes with different representatives like the class of 3 or the class of 4, but although these appear to be different because of the different representatives inside the brackets, they were not the class of 3 was equal to the class of 0 as a set and the class of 4 was equal to the class of 1 as a set. Likewise with congruence mod n, we will have the equivalence classes class of 0, class of 1, class of 2. And so far these are all different sets because the integers 0, 1, and 2 are not going to be equivalent or congruent mod n in general. We could keep going with the class of 3 and so on all the way up to the class of n minus 1. Now if I go up one more and look at the class of n, this is going to be the same class as the equivalence class of 0. Because 0 is equivalent to n and is congruent to n, modulo n. So since 0 is equivalent to n, the class of 0 and the class of n are the same. Likewise the class of n plus 1 will be the same as the class of 1 and so on. We just start repeating the classes. They're not really different. So going back to congruence mod 3 again, we only have 3 distinct equivalence classes. The class of 0, the class of 1, and the class of 2. Any other class will be equal to one of these. So let's define the set Z mod 3 to be the set containing these 3 equivalence classes. The set of equivalence classes mod 3 is referred to as the integers modulo 3. And again this is just the set of equivalence classes that's formed by the relation of congruence mod 3. Earlier in the course we used the same notation to represent the set just consisting of the integers 0, 1, and 2. And we're modifying that notation now to refer not to integers, but to equivalence classes instead. So here's another concept check to see if you can generalize this idea. What is the set of integers modulo 6 or Z6? The best answer here is going to be C. Now the integers mod 6, Z6 consists of equivalence classes not raw integers by themselves. So A and B are out here. And since the equivalence relation in question here is congruence mod 6, notice that the class of 6 and the class of 0 are going to be the same because under that relation 6 is equivalent to 0. So this last set has two duplicate elements in it. And so we never duplicate elements in a set and that's why C is the best choice here. So in general given a natural number n bigger than or equal to 2 and the equivalence relation on the integer is given by A is equivalent to B if and only if A is congruent to B mod n, we can now form the set of integers mod n. We denote this Z sub n and it's equal to the set of all n distinct equivalence classes under this relation. Where we're going now with this is to take the finite set of equivalence classes that you see here and do something kind of interesting with it. Namely we're going to define a new kind of arithmetic using the elements in that set. So stay tuned.