>> Hello, and welcome to the screencast where we're going to focus on a different property of functions, that has a lot of importance in understanding how functions work. We've previously looked at the property of injectivity. We say the function is injective if it has no collisions, that means if every pair of distinct elements in the domain must map to a pair of distinct elements in the co-domain. Injectivity is a property that involves starting with something in the domain, namely a pair of distinct points, and then deciding something about the co-domain, that is whether that pair collides or not. The property we're going to look at now takes things from the opposite point of view by starting in the co-domain and then determining information about the domain. So, to set this up, let's look at two examples from earlier videos. The first example is the round function, and remember, this maps the real numbers into the integers by accepting a real number as input and then producing the next higher integer as output. For example round of 2.6 is 3. This is clearly not an injection as we've seen earlier because for example 2.6 and 2.2 round to the same thing. But let's look at it from the co-domain point of view. Namely, if I start with a point in the co-domain, can I always find at least one point in the domain that maps to it? Let's see if that's the case here by playing with some examples. Let's pick a random integer from the co-domain. Let's say 17. Again, this is in the co-domain. Is there a point in the real numbers that maps to 17? Well, sure. For example, 16.9 does, or 16.5, or just the number 17 itself. And this is not because 17 is anything special. If I choose any point, let's say y in the co-domain, that's an integer. Then I know I can construct a point in the domain that maps to it. For example, I could use y itself, or y minus 0.1 if you like. So, every point in the co-domain of this function has at least one element in the domain that maps to it. Said differently, every point in the co-domain is actually an output of this function. Or, another way, the co-domain of this function is equal to the range of this function. Every point that can be hit by the function actually is hit by the function. So, since every point in the co-domain is actually hit by the function, we might call this the everything's covered property. Because no point in the co-domain is left quote-unquote uncovered by the function. Here's a different example: the function that maps the set of all GVSU students and staff to the set of eight-digit integer strings by mapping a person to his or her ID number. We call those g-numbers around here. We've seen previously that this is a function because no single person has two different ID numbers, so there's no splitting. And we also see that this is an injection because given two different people, they will map to two different g-numbers. So, does this function have this so-called everything's covered property? I think the answer is no. Think about it. There are 100 million eight-digit strings available in the co-domain of this function. GVSU has around 25,000 students and a few more faculty and staff. So, unless there are some people with many different g-numbers, which is not possible, not all of those g-numbers are going to have corresponding people attached to them. There are some numbers in other words that are going to be uncovered. They will not appear as outputs of this function. In fact, I believe the process for generating g-numbers forces the first three digits to be 010. And if that's true, then nobody can possibly have a g-number that starts with, say, 999. So, some functions have this everything's covered property, and some don't. And it seems like whether the entire co-domain is covered by a function is important. So, we're going to give this a name. We say that a function f from a to b is a surjection if the f equals the co-domain of f. This means that for every y in b in the co-domain, there exists an x in a, the domain, such that f of x equals y. Sometimes we say a surjective function is onto or that it maps a onto b. The word surjective is formed from the French preposition sur which basically means onto, like a surcharge, or a surname. And jective means basically to throw. So, a surjective function literally throws the domain onto the co-domain and covers it all. Let's look at three more examples of surjectivity because it's a simply more subtle idea than injectivity, and then we'll end with a concept check. First, let's look at the function that maps the set of all 2 by 2 matrices with real number entries onto the real numbers by mapping a matrix to its determinant. And remember the determinant of the 2 by 2 matrix is calculated by this formula here. And for example, the determinate of the matrix 3 4 0 1 is equal to 3. This is a surjective function, because every point in the co-domain has at least one matrix that maps to it. For example, if you chose the number square root of 2 from the co-domain, one matrix that maps to it is the matrix square root of 2 0 0 1. There are a lot more matrices that map to this number 2 of course. For example, 1 0 0 square root of 2, but the point is that there is at least one matrix that does actually hit the target. You can generalize this to any point in the co-domain. If we let x be any real number, then the matrix x 0 0 1 will map to x. So, notice that if we want to prove that a function is subjective, this often involves a constructive proof. You choose the elements in the co-domain, and you build the element of the domain that maps to it. We're going to talk a lot more about that in the next video. Here's a non-example of surjectivity. We're going to let f go from the real numbers to the real numbers be the function defined by f of x equal x squared. Now this is not surjective, because it's not the case that every point in the co-domain is covered. Not every point in the co-domain has at least one element of the domain that maps to it. And say that differently, there exists a point in the co-domain where nothing maps to it. In fact there are a lot of such points; for example y equals negative 1. That's a real number but you cannot get negative 1 as the output of this function because we're squaring things. So, in fact there are a lot of points in the co-domain that are not covered by this function. The fact that there's at least one point in the co-domain that's not covered makes this not surjective. However, and this is an important point, if I change the co-domain, the function might become surjective. If I kept the co-domain at r, and keep the same formula, but change the co-domain to the half open interval from 0 to infinity, then now the function is a surjection. Because if I chose any y value in this interval, then I could simply plug in square root of y to my function. As we can see, if I put in square root of y, I get this output square root of y squared which is equal to y, which was our original target we wanted to hit. So, whether or not a function is surjective depends heavily upon the co-domain of this function. That must be specified clearly when you define the function in the first place. Finally, as with in injections, this all becomes really easy if one of the sets we're working with is finite. If the domain of the function is finite, we saw in an earlier video, that it's easy to check if the function is injective, because we can just do an exhaustive search through all the outputs that are generated for collisions. Likewise, if the co-domain of the function is finite, we can do an exhaustive search through the co-domain and check to see if every point in the co-domain is hit. For example, let f be the function from the integers to z 5, which consists of the integers 0 through 4. And let this function be defined by f of n equal n mod 5. Now the domain of course is infinite, but the co-domain is finite, with a cardinality of five. So, I can just check through all five points in the co-domain and see if each one is hit. For example, if I choose 0 in the co-domain, I know that I could put in 0 into the function and hit it. I could also put in 5 or 10 or 20 and a bunch of other points. Likewise, 1 is hit by 1 or 6 or a lot of other points. Two is hit by 2, 3 is hit by 3, and 4 is hit by 4. So, I can just directly check that this function is surjection if the co-domain is finite. So, now let's end off with the concept check here. Here is three functions that map the rational numbers into the integers. Remember, a rational number is just a number that can be written of the form a divided by b where a and b are integers and b is non-zero. So, which of the following are surjective? So, take a look closely at these functions and pause the video. Make your selection and hit play again when you're ready. So the answer is just a and c. Let's rule out b first of all. Why is the function in b not a surjection? Well, not every point in the co-domain of this function, which is an entire set of integers is actually hit. And that's because since I'm squaring the numerator and squaring the denominator and then adding them to get the output, no integer that is less-than or equal to zero is ever going to appear as the output of this function. So there are points in the integers that are not covered, for example. Zero, negative 1, negative 2, none of those points are covered by this function here. Now, as for why the functions in a and c are surjections, we're going to end on a cliffhanger here and save that for the next video, where we're going to discuss in length just exactly how do you prove that a function is a surjection. So, stay tuned.