 Welcome back to another screencast. We're going to do two things in this screencast. First of all, we're going to continue our discussion of equality of functions. We started in the last video, and we're also, second of all, going to introduce functions that involve integer congruences. We looked at an example of one of those in the last video. Going to look a little deeper in this video. I want to take the occasion to define a, define a very important set for you. The set z sub n. The integer is with a little subscripted n. Now what that means is for n bigger than two, a natural number bigger than two, z sub n is the set of all integers from zero up to n minus one. So for example, z five would be the set consisting of zero, one, two, three, four. Notice that five is not contained in the set. z five does not contain five, but it has five things in it. One, two, three, four, five, and that's why we call it z five. z twenty-six would be the set of integers zero, one, two, three, four, five, six, and so forth all the way up to twenty-five. Again, we don't include twenty-six in this set, but it has a cardinality of twenty-six, which is why we use twenty-six. And z two would just be the set zero, one. Very useful in computer science applications where we're talking about binary representations of things. We use zero, one. That's the set z two. So with that, we can start defining some new functions for us. Here are a couple of functions, both of which go from z five to z five, but using what appear to be different looking formulas here. So remember, z five is the set that starts at zero, and I have zero, one, two, three, and four. Five is not contained in that set, but there are five things in the set. So these are two different looking functions. They do have the same domain, and they do have the same co-domain, I noticed this, but could they possibly be equal to each other? Well, they don't have the same formula, but it doesn't necessarily matter. Let's make a little table here, and the nice thing about functions that come out of z n, like coming out of z five, is that I can completely specify this function just with a table. There's only five things I can even put into this function. So let me just list them. Zero, one, two, three, four. So this is not going to be like functions from calculus, say where I can only put in a representative sample of inputs and kind of guess at how the function is behaving. I can completely exhaust the domain here, just in this one table, because there's only five items I could put in. So if I just run through all five elements, f of zero would be two, and reduced mod five, that's also two. f of one would be three. f of two would be two plus two, which is four. f of three now would be three plus two, and if I reduce that mod five, its least non-negative residue is zero, because three plus two is five, three plus two is five, and if I divide five by five, I get a remainder of zero. So that's where that comes from. And then finally f of four would be six, so I would put four in here and get six, but six mod five is one. So there is the complete specification for that function. I can see exactly what goes to what. Now let's take a look at g, which is similar to f, except instead of adding two, I'm subtracting three, and then reducing to the least non-negative residue mod five. If I put in zero, I'd have zero minus three, and zero minus three, that's a negative three of course, negative three mod five is plus two. If I put in one for n, I'd have one minus three, which is negative two, negative two mod five is three, and I can keep playing this game. When I put in two here, I'd have negative one, and negative one mod five is four. When I put in zero, I have, I'm sorry, when I put in three, I have three minus three, which is zero, and I don't have to do any reduction, and then four minus three is one. So what I see here is that f and g are equal, f is equal to g as functions, f and g are equal as functions, because they have the same domain, they have the same domain, and on every point in the domain, the outputs of each are the same. So although they look different, they are actually the same function. So it just goes to show you that just because two functions don't have the same description, the exact same description or formula, if you will, it doesn't necessarily mean that they are equal. They can look cosmetically different, but still actually be equal under the surface. Now here's another example where I'm going to be going from Z seven to Z seven. Remember Z seven would be the set starting at zero and going one, two, three, four, five, and six. Seven's not contained in that set, but there are seven things in that set. So let's make a table for this. Now this is just to point out here, f of n, the first function is n squared plus four mod seven. This g of n is n plus two squared mod seven, the quantity squared. And just to remind you of your algebra, it's not always the case that if I take n plus two and squared, I'm not going to just square the terms here, right? I think we're all smart enough to realize that. I would have to use a FOIL method. This would be n squared plus four n plus four. But let's just try to, so we expect these two functions to produce different outputs because the formulas are not exactly the same. But let's see what happens here. So I'm going to make a table. This again, I can completely specify the outputs of this function just by listing them. I can completely exhaust the domain of this function. I'm going to do a few and then list the rest here just and you can compute these on your own. If I put in zero for f here, or for n inside f, f of zero would be zero plus four mod seven. That's four. If I put in one, that would be one squared plus four. That's five and that doesn't reduce to anything mod seven. The next one, if I put in two, that would be two squared plus four. That's four plus four which is eight. And mod seven, that is one. I'm just going to go down through here and list the remaining ones and you can check them on your own. I'd have six, six, one, and five. So this function is certainly a function. Notice that it is possible for two different inputs to map to the same output. Like that happens three times in this particular functions case here. But there's the complete outputs for this function. Now g of n on the other hand, let's just see what it comes out to be. And again, I'll do just the first few of these and then leave the rest for you to compute. If I put in zero for n here, I'd have zero plus two. That's two squared. I get four and I wouldn't have to reduce mod seven. So that's four. If I put in one, let's see what happens. I'd have three inside here and then I'd have three squared which is nine and nine mod seven is two. Okay. I'm going to go ahead and just write the rest down. Two, I'd have four here, one, zero, and one. So here's an example of two functions that involve integer congruence that are very, very different from each other. Although they have the same domain and the same co-domain, there's a lot of places where the outputs are different. Here, here, here. In fact, they're almost never the same. The only place where you get the same output is here for n equals zero. So they have almost completely different outputs and that makes them very different functions. Which is what we suspected because algebraically there's no reason to suspect that those two would be equal. However, I do want to move on to this next example here. And the only difference between this example and the previous one is notice the formulas are the same here except for, instead of looking at integer congruence mod seven, I'm going to use the same formula but mod four this time. And I'm mapping from z four into z four. And again, just to remind you of the definition, z four is the set that would start at zero and be one, two, three. So these two functions here have similar formulas n squared plus four versus n plus two squared. And you know, in high school algebra, those two things aren't the same. So how should we expect these things to be the same? But watch this. Let me make a little table here. And it is a little table. There's only three things I can possibly put into these functions here. If I go to f of n, if I put in zero for n, I get zero plus four. And four mod four is zero. If I put in one for n up here in f, I have one squared plus four. That's five. And five mod four is one. If I put in two, I have two squared, which is four, plus four, which is eight. And eight mod four is zero. And finally, three for n up in here would be three squared, which is nine, plus four, which is 13. And nine mod four is one. Now, check out what happens when I use g event. Now, again, we know, we really, really know because we're smart people that n squared plus four is not always equal to n plus two squared. Okay? Foil method and all that. But watch what happens when I reduce mod four. If I put in zero for g, I have zero plus two. Two squared is four. And that mod four is zero. If I put in n equals one for g, I have one plus two. That's three. And I square that to get nine. And nine mod four is one. Now, if I use two, up here I have two plus two, which is four. Four squared is 16. And 16 mod four is zero. And finally, if I use three here, I have three plus two, which is five. Five squared is 25. And 25 mod four is one. So interestingly, although we're using virtually the same formulas for these two functions, I've changed up the domain and the co-domain and changed the modulus here. And I get that these two functions are actually equal to each other. They have the same domain, the same co-domain, and they agree on all their outputs. So I guess you could say that what you're, the really bad mistake that gets made in high school algebra to say that this equals n squared plus four actually does work in z four. If you reduce everything mod four, that mistake there is actually not a mistake anymore. But don't let that introduce any bad habits to you. So functions that involve integer congruence are really nice because we can fully specify the function just in a really short finite table and makes it very easy to check if those two functions are equal to each other or not. Thanks for watching.