 Hello and welcome to our last set of screencasts about functions. So we've seen that there are five basic ingredients to specify whenever we want to talk about a function. One of those is that we must always specify the process that the function actually uses to map points in the domain to points in the co-domain. That seems obvious and it is, but don't forget its importance. It's not enough to say f is a function from the real numbers to the real numbers unless you're trying to prove something in general about such functions. To really work with a function you have to know how it maps those points. For example, the function that sends x to x squared and the function that sends x to cosine x are both functions from the reals to the reals, but they are very different. So we just referred to two processes in terms of formulas, but of course we can think of those processes in different ways besides formulas. And in this video we're going to take a look at a familiar but different way of representing functions that leads to a very useful concept. Let's look at the function that maps z8 into z8 defined by the formula f of x equals x squared plus 1 mod 8. Now remember that z8 is the set 0, 1, 2, 3, 4, 5, 6, 7. Now how does this function work? Well, we know the co-domain and the domain and the process is defined by a formula. Now notice that the domain and co-domain are both finite here so we could write this out as a table as well as a formula. Here is that table and while I'm writing it out, you should check these entries to make sure you understand the process by the way. I'll just mention that a basic concept in mathematics is multiple representation. We understand things much better if we can conceive of them in different ways and switch the ways that represent them. We do this in calculus all the time with functions. We want to understand functions not only as formulas but also as graphs and tables and verbal descriptions. And every time we switch the representation of a function we learn something new about it. So here is my function written as a table and I learn a couple of new things about it. For example, I see that it's neither injective because 0 and 4 both get sent to 1, nor is it surjective because nothing got sent to 3. Now we can take this table idea one step further. We can think of each row in this table as an ordered pair with the first coordinate being the input and the second coordinate being the output of the function. This gives us a brand new way of representing a function not as a formula or as a table but as a set, a set of ordered pairs. For example, we could say that my function here called f is this set of ordered pairs. Now this set of ordered pairs fully specifies the function. I can see, for example, that f of 6 equals 5 because the pair 6, 5 is in the set. This list of ordered pairs representation is basically just a flattened version of a table. And in fact, some computer languages, this is how functions are represented as lists of ordered pairs. Note that if we represent a function as a set of ordered pairs, we speak of points being in the function because the function is actually a set. Let's try this representation out on another function. Take the function g that maps the real numbers into the real numbers given by another formula g of x equals x squared. Now how would I represent this as a set or list of ordered pairs? This time the domain and co-domain are infinite so this will not be a finite set of ordered pairs. Let's at least come up with some examples of ordered pairs that are in this function. Well, for example, if I use the input x equals 3 from the domain, I know that g of 3 equals 9. And so that means the ordered pair 3, 9 is in the set g. Again, g is not really thought of as a formula here. It's a set of ordered pairs and 3, 9 is one such ordered pair. Another ordered pair that would be in g is negative 2 comma 4 because g of negative 2 equals 4. Another would be 0, 0 and another would be one half comma one fourth. There are infinitely many of these ordered pairs so we can't list them all, but we can write out the function g as a set using set builder notation. Looking at all the pairs that are in g, we see that they have one thing in common and that is the second coordinate of each pair is the square of the first coordinate. So we might write g as a set like this. g is the set of all points x comma y in r cross r, the Cartesian product, such that y, the second coordinate, equals x squared. That's the square of the first coordinate. Now this makes sense because it fits the pairs we've already come up with and points that should not be in this function like 1, 5 are excluded because we know that g of 1 is 1 squared and that's not equal to 5. And indeed 1 comma 5 doesn't meet the entry requirements for this set. This also makes sense if you think of a graph of this function g. This would be a plane parabola in r cross r, the x, y plane. And if you locate a point on that parabola, you know that the y coordinate is just the square of the x coordinate just as our set specifies. So one more example before we reach our main definition here. So far our examples have had the domain and co-domain the same, but that doesn't have to be the case. For example, take the function h that maps z4 into z8, that's given by h of n equals n cubed mod 8. Here the domain and co-domain are both finite because I just want to keep the example simple, but notice that there are different sets. So if I were to write h as a set of ordered pairs, first of all, where would those pairs come from? And second of all, what would those pairs actually be? Well, first the first coordinate of the pairs represents the input to my function h. They come from the domain, so that would be z4. And the second coordinates all represent the outputs of this function, so they come from the co-domain. So the function h would be a set of ordered pairs from z4 cross z8. And as to what pairs are actually in that set, well technically it would be the set of all ordered pairs, x, y, and z4 cross z8 such that y, the second coordinate, is equal to x cubed mod 8, where x is the first coordinate. But since the domain is finite, we can actually list all these. If x is 0, then y is 0 cubed mod 8, which is 0. So 0 comma 0 belongs to the function h. If x equals 1, then I have 1 cubed mod 8 equals 1, so 1, 1 is an h. If x equals 2, then 2 cubed mod 8, which is 8, mod 8, which is 0, so 2, 0 is an h. And finally, since there are only 4 points in the domain, I only have one more to check here. If x is 3, then h of 3 is 3 cubed, which is 27, mod 8, which is 3. So 3 comma 3 is an h. So h would be equal to the set of ordered pairs 0, 0, 1, 1, 2, 0, and 3, 3. Again, this is like a little table that's written in horizontal form. We can read the inputs and the outputs just as if this were written as a table in vertical form. So in general, if f maps a to b as a function, then we can represent f as a set of ordered pairs by setting f equal to the set of all pairs a, b that belong to a cross b, such that b, the second coordinate, equals f of a, the first coordinate. Here, I'm mixing my symbols here. This f on the right here is a function that maybe is given to me as a formula, and now I'm using the same letter f to represent the set of ordered pairs. So here's a concept check to see how well you get this idea so far. Let's let c be a function that maps the natural numbers minus the number 1. That would be the set of all positive integers from 2 to infinity into the natural numbers given by c of n is the largest prime factor of n. So here's a list of ordered pairs. Which of the following pairs is in c if we represented c as a set of ordered pairs? So pause the video and select all that apply. The correct answers here are a and e only. Now let's see why. The general idea is that a comma b is in c if c of a equals b. That is if the greatest prime factor of a equals b. So 2 comma 2 belongs to c because the greatest prime factor of 2 is 2. That's because 2 itself is a prime number. And 20 comma 5 is in c because if you think of the factorization of 20, that's 2 times 2 times 5, and the greatest prime factor there is 5. So c of 20 would equal 5 and that makes 20 comma 5 a pair that belongs to the set c. 5 comma 20 is not in c because the greatest prime factor of 5 is not 20. It's 5. So notice something important here. Switching the order of the pair here causes a completely different relationship to take place. This is something we're going to explore in great depth in later videos. Finally neither b nor d belong to the set c because the first coordinate is negative and that means it's not even an element of the domain. So those pairs don't belong to n minus 1 cross n so they can't belong to c either. So that's all about how to represent functions as a list of ordered pairs. So thanks for watching and stay tuned for more.