 Welcome back to another video about surjections. In this video we're going to pick up on the cliffhanger from the last video and talk about how to prove that a function is a surjection. So let's begin by reviewing the definition of surjection. So we let F be a function from A to B and the function F is called a surjection if the range of F equals the co-domain. So in other words, F is a surjection if for every y in the co-domain there exists an x in the domain such that F of x equals y. So with a surjection reviewing a function from the co-domain point of view, we're starting with a point in the co-domain and trying to build a point in the domain that maps to it. In other words, we're picking out a target that we would like to hit and then trying to find something in the domain that maps to that target point. Now we saw one special case where proving a surjection is really easy and that's when the co-domain is finite. We can just simply go through all the points in the co-domain and just find points, check through exhaustively to see if each point in the co-domain is hit. But what happens if the co-domain is not finite? Well that's where it gets a little tricky and so to help us with this I've set up the following general framework for proving surjectivity. Again this is really for the case where the co-domain is infinite and this is not always how you prove that a function is a surjection but it's helpful to start with this framework in mind. So if you wanted to prove that the function F going from A to B is a surjection then I'm going to start by choosing an arbitrary point from the co-domain and very importantly I am not going to assume that it is the output of my function. Basically I'm going to pick a point out of the co-domain and then not even look at the function. The function has not entered into the proof yet. So choose an arbitrary point from the co-domain and assume nothing about its relationship to the function that you're dealing with here. What we're out to do here is prove that this point is an output of the function. So it would be a disaster to start by assuming that it's the output of our function. So don't assume that the point you choose is the output of this function. Secondly what we're going to do is determine a form for the point in the domain that maps to it. Now presumably before we do any sort of proof that a function is a surjection we have played with the function and kind of come to terms with whether or not we feel that the function is a surjection. We might try some arbitrary points out of the co-domain. For example if the co-domain is the integers we might pick the number 17 and see if we can hit 17. Then we might pick 22 and see if we can hit 22 and then negative 5 and see if we can hit negative 5. All these examples that we do as data that precede the proof will help us do the proof by trying to find a general form for the input that goes to the target that we want to hit. So we're going to determine what that form is for the point that we're choosing in the domain and then we're going to just state this as a claim. Like I claim the following point in the domain maps to my target point and then I'm going to prove that claim by doing two things. First of all I have to check or prove that the point that I'm claiming maps to my target actually belongs to the domain in the first place and we'll see something about that in a couple of examples. And then secondly obviously what I want to do is prove that the point that I'm claiming maps to my target actually does map to the target and I'm going to do that by simply evaluating it into the function. So let's use this framework to do a couple of examples. Here's one of the concept check questions from the last video. Let's prove that the function that maps the rationals into the integers that's given by f of a over b equals a as a surjection. So this function operates by taking a rational number which is a fraction of two integers with the bottom nonzero and simply returns the numerator of that fraction. So why is that a surjection? First of all I'm going to choose an arbitrary point in the code domain. I'm going to let n be an integer and I'm going to assume nothing more about it. So I'm going to let n be an integer and assume nothing about it relative to my function. Now what I want to do is find a point that maps to it. Now this is something over here that I might do before I start the proof. Like if I pick a random integer out, let's say the number five, what might map to five? Something that could possibly map to five. The most obvious being maybe the rational number five over one. Certainly that's equal to five and if I load it into my function I see that if I strip off the numerator I get five. So that seems like an obvious choice. You could also choose five over two for example. Lots of points map to five. So we're going to do this. We're going to claim, we claim that let's make it n over two just for fun, maps to n. Like I said there could be a lot of things that map to five over here in my examples. Five over two would be one of those. Five over one would be another of those. So I've claimed that n over two maps to n. This is the general format of the object that I am claiming maps to my target. So I'm starting with a point in the co-domain and working backwards in the domain to find something that maps to my target point. So I've got to do two things now. I have to somehow argue that the point that I picked out of the domain actually is in the domain. And then I have to show that this point here actually maps to n. Well it's easy to see and I won't write all this down but just speak it out. It's easy to see that this is a rational number that actually belongs to the set of rational numbers because n is an integer and two is also an integer and is not equal to zero. So n over two is a rational number by definition. So this really is a point in the domain. And then I need to prove that it maps to n and to do that I'm simply going to do a calculation. I'm going to take f and calculate n over two. Now how does f work? It takes the input and strips off the numerator. Okay, so there we have it. So I've proven in one step that the point that I claim maps to my target point really does map to my target point. So I have to start with a point in the co-domain and then build something in the domain and then prove that it really maps to the target. Let's look at another example of this which was the other surjection from the concept check. Another function that maps the rational numbers into the integers. We're going to declare f of a over b to be round of a over b. So this takes a over b and simply rounds it up. So is this a surjection? I claim that it is. And we're going to start by letting n be an integer. Just pick an arbitrary point out of the co-domain and let's see if I can find something in the rational that maps to it. Now let's do a little play time over here as well and change to color to green here. This is something you might do before the proof starts. So pick an integer, really any integer you want. I'll say three. Now can I find a rational number point that maps to three? How does this function work? It takes the fraction and then rounds it up to the next higher integer. So one integer that maps to three would be three over one. Sorry, what rational number maps to three? Now three by itself is an integer which makes it a rational number. It could write it as three over one. Now three over one is three and that rounds to three. And there's nothing magical about the number three. That seems like it might always work. So that I think is going to be my general form here. So I claim that the point n, let's say n over one, I have to make the claim that the number that I say maps to my target point really belongs to the domain. And it's clear that it is because n is an integer and one is an integer. One's not equal to zero so this whole business belongs to Q. So I claim that this point n over one in Q maps to n. And this is going to be a real easy check here. How do I know? Well let's take a look at it. So f of n over one by definition is round of n over one. That's just the definition of my function. This of course n over one inside the parenthesis is just n. n is an integer and so if I try to round it to the next higher integer I'm simply going to get n and I see that I have what I want. The object that I claim maps to n I've proven really does map to n. So therefore that function is a surjection as well. Here is a third example and this is from an in-class activity that students in the Math 2.10 class at GBSU have done. So let's define a function d from the natural numbers to the natural numbers. That's defined by d of n is the number of divisors of n is a surjection. So just to see how this function works let's play with it over here in the box. If I take d of say six, how many divisors does six have? That's going to be the answer. Well, one divide six, two divide six, three divide six, and six divide six. So d of six is four. So we claim that this is a surjection and let's prove it. So we're going to let, let's say k be an arbitrary natural number. If the codomame were a set that had a little bit more structure to it and I could rewrite k in some other form I might want to do that. But here the natural numbers don't really have much in the way of structure. We just know that they're positive integers. So I'm just going to choose an arbitrary element out of that set and then leave it alone. The function has not entered into the picture yet. Now what I'd like to do is build a point in the domain which is also the set of natural numbers that will map to k once it's put into the d function. Now one of the things that the class did and this is certainly the case is we proved or made a conjecture that if I take d and put in two to the k power I get k plus one. And that you can certainly see to be true because what are the divisors of two to the k? That would be one, two to the first power, two to the second power, two to the third power, all the way up to two to the k power. And now how many things have I just listed out? Well there are k things in here, one, two, three, four, all the way up to k and then there's this extra one. So the output of d of two to the k is k plus one. Now so I'm going to make a claim here, I claim based on my experience with that lemma that the number two to the k minus one maps to k. Now just to check here, I made my claim of what I think maps to k. Now I have to do two things. First of all, does this point right here actually a natural number? Okay I've got two to the k minus one so I've got to be careful. I don't go down into say a negative exponent here. So let's think about this. So first of all is two to the k minus one in the natural numbers. Well the answer is yes. And that is because k here is a natural number. Okay so k is a natural number, that means k is bigger than or equal to one. So k minus one is bigger than or equal to zero. And so two to the k minus one is an integer. It's a positive integer as well that makes it a natural number. Now let's think about whether two to the k minus one actually maps to k. So I can prove that here just by plugging that into my d function. Two to the k minus one. Now my formula over here that I conjectured says that if I put in two to the k, the output is k plus one. In other words if I put in two to the exponent I get exponent plus one. Now here the exponent is k minus one. So I'm going to get k minus one plus one which of course is equal to k. So that last line there proves the main point of being a surjection and that is that if I take this point that I claim maps to k just by running the function through I see that it really does map to k. So that proves that this particular function, the number of divisors function, is really a surjection. Again it's hard to come up with this proof unless you play with the problem first and especially if you don't have this conjecture over here about putting in powers of two into your d function. So this is something that takes place before any sort of proof begins. Now lastly I have one more example here and that is that we're going to prove that the function f that goes from the real numbers to the real numbers given by f of x equals five x minus one is a surjection. And I'm bringing this up because it raises an important point about the role of the co-domain here. So we're going to assume, we're going to let, let's say y be an arbitrary real number. I don't know anything about the function at this point. I'm going to choose y out of the co-domain and don't touch the function at this point. I don't know that y is actually an output of this function. I have to prove that it is. So what do I think maps to y? Well, let me do a little playtime over here and let's see what I think. If I had five x minus one equal to y, what could I possibly, possibly put in for x that would give me y? Well, if I had to solve this equation for x, I think I might get an idea. Well, five x minus one is equal to y, then five x is equal to y plus one, and so x would be y plus one over five. So this is telling me that if I chose a y and I wanted to find an x that hits it, one thing that might hit it, maybe the only thing in this case, is this point right here. If I, if I set up this equation and assumed that this equation was true and backtracked, this is where it would end up. So that's the basis for my claim. I claim that y plus one divided by five maps to y. I would not have any basis for that claim or any idea about it if I didn't do a little bit of playtime first over here. So two things to check. First of all, does y plus one over five actually belong to the real numbers? And the answer is going to be, of course, yes, y is a real number. And so y plus one is a real number, and therefore, y plus one over five is a real number. So I'm just going to say yes because y is a real number. Okay, now the main point here is that does y plus one over five actually map to y? Well, let's try it out. What is f of y plus one over five? Well, according to f, I'm going to change color here to match the color of my function upstairs, that would be five times y plus one over five minus one. So that's the function, and there I'm putting in my proposed point. Now let's just do the math and see how this works out. The fives will cancel out, and I have y plus one minus one, and that gives me y. So indeed, I have chosen a point to put into the function that really does hit the target. And so that function is a surjection. Now one last thing I wanted to point out here though is if I just change something slightly and made this a function that maps the integers to the integers, change nothing else, keep the same formula, then notice something. This would still be, this would definitely be a function from the integers to the integers. If I, it's a function, there's no splitting. If I put in an integer, I'm going to get an integer as an output. But notice it would not be a surjection anymore because this point that maps to y might not be an integer. For example, if y were equal to two, if I started with two in the integers here, change that, then y plus one over five would not be in the integers. And so this function would fail to be a surjection if I change the domain and co-domain. So again, whether a function is a surjection or not is heavily dependent upon what the co-domain is, and to some extent what the domain is as well. So those two sets really matter. So there you go, there's several examples of how to prove a function as a surjection. Remember if the co-domain is finite, this is all very, very easy. You just do an exhaustive brute force search. If not, then now we have a nice logical framework for helping us set up these proofs here. So enjoy and thanks for watching.