 We're gonna talk some more about functions in this video here, and particularly we wanna talk about injected and surjective functions. When we first define functions in a previous video here, I made emphasis that the domain and codomain matter, that should actually be stated as part of the function itself and not left ambiguous as it often is done in the calculus setting. With function composition, we saw why that's sort of an issue, right? In order for the composition to be well-defined, the codomain and domain have to be compatible with each other, that is they should be equal with one another. And this is important to make sure our algebra of functions makes sense. Now in this video, as we define injective and surjective, this idea of codomain and domains can be very much in the forefront here. So for this definition, let's say that f is a function from a to b, and for the first definition, take two elements inside of the domain, a1 and a2. We say that a function is injective, or the term you might have heard before is one to one. These two will be used interchangeably here. We say that a function's injective, if whenever the image is the same, it turns out that the pre-images were the same. That is the only way that two elements map to the same spot via this function is if they were the same element. One other way of saying this is that whenever b is inside the range of the function, there is a unique a value that maps to b. So remember, the definition of a function doesn't require that different a's have to map to different b's here, different input have to map to different output. The function definition doesn't require that. So if we add extra conditions here, we say that a function's injective, then that means that every element of the domain maps to different elements of the codomain. And that's where the idea of one to one comes about. If we draw a picture of our domain here and we draw a picture of the codomain, then you have these little arrows coming out of the domain. Everyone in the domain goes to a different spot. So there's this one to one correspondence. For every element over here, there's one element over there, hence the one to one. Now the idea of surjective or an onto function, this is sort of like the dual notion. We say that a function is surjective or the term you might have heard before is onto. We say that a function's surjective every element in the codomain is mapped onto by something in the domain. That is, so for everything in the codomain, every element B, there's at least some element A that maps onto it. And hence why we call this an onto function, right? So there's something in the domain that maps onto the element B for every element of the codomain. Or another way of saying this, we say that a map is surjective if its image is equal to its codomain if the two things are the one and the same, all right? And so that means nothing in the codomain is missed by the functions, by the function mapping things from the domain there. So injective means one to one. No one in the codomain is hit twice. Surjective or onto means that everyone in the codomain is hit at least once. If you put these two notions together, it's called bijective, a bijective function, sometimes it's called a one-to-one correspondence because if you're injective, everyone in the codomain is hit at most once. If you're surjective, everyone in the codomain is hit at least once. And so you put those together, everyone in the codomain will be hit once and only once. And so you get this one-to-one correspondence between elements of the domain and elements with the codomain. We'll talk more about bijective functions in the next lecture, lecture three, I believe. Just as some examples of this idea right here, is the function x cubed e to the x and x squared, are these injective, surjective, bijective? It turns out it kinda depends on what you mean by the domains, right? If you take the function f to be a function from real numbers to real numbers, f of x equals x cubed, if that's your function right there, this will be a, let's see, it'll be a bijective function. It'll be bijective because, let's mention that, every number, two different real numbers will map to two different real numbers in this case. So if you have like x cubed is equal to y cubed, then you could take the cube root of both sides and you end up with x equals y. This would show that it's one-to-one. On the other hand, can you solve the equation? Can we solve the equation y equals x cubed? Something like that. The answer is, yeah, taking the cube root of both sides, you get x equals the cube root of y. So that's all you have to do there and so this would show your on-to. So this function here is gonna be a bijective function. And notice how I kind of answer this question using the cube root, which is often referred to as the inverse operation. Put a pin in that, we'll talk about that more in lecture three. Take the function g, for example, where this is the function from reels to reels and you take exponential function again. Now in this situation, we do get that the function is injective. It's an injective function because if you have e to the x is equal to e to the y, taking the natural log of both sides, you'll get that x equals y. The output only agree with the input agree. But on the other hand, it's not surjective. It's not gonna be surjective here and the reason for that is the following, notice that negative one never equals e to the x for all values of x. It doesn't matter. It really doesn't matter. You can never get a negative out of this exponential, at least in the realm of real numbers, we can't. And so this function is not surjective, but it is injective because we don't hit everything in the decodemain. There's things we miss. But this is to point we've talked to many times, what if we were to modify this? Let's change it, right? Instead of saying the real numbers of the output, what if we change this to be something like zero to infinity? We only took positive numbers. Then in that situation, oh sorry, we are surjective now because this counter example would no longer be a legitimate counter example. And for any number, right? If you wanna solve the equation e to the x equals a, the answer would always just be the natural log of a, right? Which this is, of course, a positive real number. Sometimes you write that as r to the plus. That's a positive real number. And so there you have it. Right. I'm sorry, so natural log of a is not a positive number. I'm sorry, what I meant to say is if a is a positive number, right? If it's greater than zero, then this equation is always solvable and the solution would be the natural log of a, which could be negative numbers, it could be zero. That's acceptable. So whether the function e to the x is injective or bijective has a lot to do with that co-domain, right? There's no way of restricting the co-domain or the domain to make it not be injective. But in this case, if you shrink down the co-domain, you can switch it from surjective to, you can make it switch from not surjective to surjective. So the fact that your function's not surjective has a lot to do with the fact that maybe your co-domain is too big. One last example of that. Let's take h of x to be x squared as we think this is a function from reels to reels. Well, in this situation, you have sort of the same problems. It's not injective. It's not injective. And the reason for that is the following. We can take things like negative two squared. This will equal two squared, which are both equal to four. So two different real numbers give us the same output there. So it's not injective. It's also not surjective. It's not surjective for the following reason. You can't solve the equation negative one equals x squared. Again, not with real inputs. This can't be solved here. It can't happen. And therefore, it's not a surjective or an injective function. It's not one-to-one or onto. But like we saw a moment ago, this could be corrected, right? If we shrink the co-domain down, right? We could switch it to be zero to infinity. Then counter examples like this don't work anymore. And then voila, it is surjective. The function which goes from reels to non-negative reels would be surjective in that situation. Can we do a similar thing for injective? Well, turns out if you switch the domain to be zero to infinity as well, then counter examples like this no longer become a possibility as well. So if you take the function h, which goes from zero to infinity, and then goes from zero to infinity, given by the rule h of x equals x squared, then in that situation, our function is bijective. And so the injectivity, the surjectivity, and hence the bijectivity has a lot to do with what the domain and co-domain are not necessarily the formula. The formula is relevant, but you need more than that because the same formula with different domains and co-domains potentially could be injective or surjective, right? In order to make the function surjective, I basically threw out all of the elements of the co-domain that don't get mapped onto, right? So I forced it to be onto. And you can also force a function to be injected to be one to one. It's just I throw out any duplicates, right? If there's two different elements that map to the same image, throw one of them out. And if you do that for every duplicate, then you can make your function be injective. And therefore, for restricting the domain and co-domain, you can make this be into a bijective function. So be aware that this is an option. This is something you didn't calculus. We often say that the inverse of the square function is the square root function, but that's not true if you don't choose the right domain or co-domain. We do it in trigonometry as well. A function like sine, cosine, tangent, we say there's an inverse sine, inverse cosine, inverse tangent, but that's only true if we restrict to the right co-domain and domains, which is oftentimes a concept that's hidden in lower level mathematics, but it's something we have to be much more precise about when we talk about higher mathematics.