 Welcome back to another screencast about injective functions. At the end of the previous video, we had a concept check that asked you to determine which of these five functions from the real numbers to the real numbers was injective. We found that it was fairly easy to show that a function is not injective because this involves just finding one concrete example of a collision where two different inputs mapped to the same output. We found that to be the case for the functions in B, D, and E. We said that the injections here are the functions in A and C, but to be completely convinced of this, we had to prove that the functions were injective because the definition of injective involves a universal quantifier. We can't just build an example. So this video is going to focus on four different strategies for proving that a function is injective. No single one of these strategies is necessarily any better than the other, generally speaking. There are just different approaches that you might take and you need to become comfortable with each of them. So to understand what these strategies are, let's return to the definition. The main point to note here in the definition of injective functions is that this definition involves a universally quantified conditional statement for all x1 and x2 in the domain of F. If x1 is not equal to x2, then f of x1 is not equal to f of x2. Now this is a form of statement that we have been working with throughout this entire course. So if I want to prove that a function satisfies this definition, I know that I need to prove this conditional statement, which means that I have three ways of doing that, and we're very familiar with these ways. We could use a direct proof, we could use a proof by contraposition, or a proof by contradiction. There's a fourth way that the special case that I'm going to mention here at the end of the video. So let's look at each strategy in turn using the same function. We're going to prove that the function f from r to r, given by f of x equals 3 minus e to the x is an injection. So let's try direct proof first. For this, we're just going to use the straight definition. We're going to assume that x1 and x2 are two points in the domain, and that x1 is not equal to x2. And then we're going to prove the conclusion. We're going to prove that their images are unequal. So assume x1 is not equal to x2. Then e to the x1 is not equal to e to the x2. And since these two numbers are not equal, their negatives are not equal either. And finally, adding 3 to 2 unequal things will give me 2 unequal things. So therefore, f of x1 is not equal to f of x2, and hence f is injective. I started by assuming that I had two points of the domain that were not equal, and I've proven that their f values are not equal either. Now, if you felt that that proof was somehow less than satisfying, I'd agree with you. In particular, there's one step in that proof that is not fully justified is the step that says if x1 is not equal to x2, then e to the x1 is not equal to e to the x2. Now, this is assuming that the function y equals e to the x is injective itself, and we have not proven that. So this whole method feels very hand wavy. It creates steps in your argument that are difficult to justify. So in fact, direct proof of injectivity is not an approach that we use very often for this very reason. Instead, we more often use contrapositive or contradiction. So let's look at a proof by contrapositive first. The contrapositive of the definition of injection would say that for all x1 and x2 in the domain of f, if f of x1 equals f of x2, then x1 equals x2. Remember to form the contrapositive, I go to my original conditional statement, reverse the hypothesis and conclusion and negate each. So if I were to prove that this function f of x equals 3 to minus e to the x were an injection using the contrapositive, we'd start by choosing two points in the domain and not assuming that those two points were equal or unequal, but rather that their images were equal. In other words, let's start the proof. Let's let x1 and x2 be real numbers and let's assume that f of x1 equals f of x2. And we want to now prove that x1 equals x2. So this is a handy way to work this proof because we can use algebra to work backwards from the images to get the original points that we put in. So we've assumed that x1 and x2 are points in the domain and that f of x1 equals f of x2. Now by the definition of the function f, that means that 3 minus e to the x1 equals 3 minus e to the x2. Now let's do some algebra. Let's subtract 3 from both sides to get negative e to the x1 equals negative e to the x2. If we take the negative of both sides, we get e to the x1 equals e to the x2. Now I can do something to both sides of the equation, namely I'm going to take the natural logarithm of both sides to get natural log of e to the x1 equals natural log of e to the x2. And finally, by the properties of the natural logarithm function, we conclude that x1 equals x2. And this is what we wanted to prove, and so f is injective. So working with the contrapositive is probably the approach you'll see used the most to prove that a function is injective because the contrapositive provides some structure that I can disassemble using algebra or properties or definitions. And just generally speaking, it's easier to work with equations as we did in the contrapositive than with non-equations, a lot of things not being equal to each other, which is what happened in the direct proof. So finally, let's look at the contradiction approach. This would involve assuming that f is not an injection and then deriving a contradiction. So if we assume that f is not an injection, then we'd need to negate the conditional statements in the definition. And that would read there exist points x1 and x2 in the domain that are not equal, but their images are equal. In other words, if I want to prove that a function is injective by contradiction, I'm going to assume that that function has a collision somewhere. And then I want to perform valid mathematical steps and arrive at a contradiction. So with our three minus e to the x function, let's take that route. So for a contradiction, let's assume that x1 and x2 are two points in the real numbers that are not equal. But suppose that their images are equal, that is that three minus e to the x1 equals three minus e to the x2. And then we're going to work forward and try to get a contradiction. What happens from here will look a lot like the proof using the contrapositive. So let's subtract three and then take the negative of both sides to get e to the x1 equals e to the x2. Then take natural logs to get natural log e to the x1 equals natural log e to the x2, which then gives x1 equals x2. But that is a contradiction in this case because we initially assumed that x1 and x2 are not equal. Therefore, this collision can't happen. And so therefore, f is injective. Again, contrapositive and contradiction are almost identical here. There's no real preference of one over the other. A system matter of whether one strategy fits your problem and your context and how comfortable you are with each. So finally, there is one special situation where proving injectivity is really easy. That's where the domain of my function is finite. So in this case, since functions never split inputs into outputs, if the domain is finite, there are only going to be a finite number of outputs available. So we can actually just list them all through a list or a table of inputs and their images and just see directly whether or not there are any collisions. So for example, let's let f be a function from z5 to z5. And remember that z5 is the set 0, 1, 2, 3, and 4. And it's defined by f of x equals x plus 3 mod 5. So is this function injective? Well, there are only five points in the domain. So let's just evaluate them and just see. So f of 0 is 3. f of 1 is 4. f of 2 is 2 plus 3, which is 5, and that is 0 mod 5. f of 3 would be 6, which is 1 mod 5. And f of 4 is 7, which is 2 mod 5. So these are all the inputs. And we can just simply see that there are no collisions. So the function is injective. Now obviously, this only works for functions with finite domains because if the domain is infinite, then we can't create a totally exhaustive list of all the inputs and all their outputs. Here's another example of this. Let's let g be z, the function from z5 to z5 by the rule g of x equals x squared mod 5. Is this function injective? Well again, there are only five points to check. So we can just go through them all and see. Now g of 0 is 0. g of 1 is 1. g of 2 is 4. g of 3 is 9, which is 4 mod 5. g of 4 is 16, which is 1 mod 5. And we see here that we have a couple of collisions in the co-domain, so that makes g not an injective function. So to wrap up, we have three main strategies for proving a function as injective. We can use a direct proof of the statement in the definition, a proof by contraposition of the statement in the definition, or proof by contradiction of the statement in the definition. Which strategy is quote unquote best depends on the problem and upon your own individual style, but do be careful of the direct proof approach as it tends to produce steps that are difficult to justify. And finally, if the domain of your function is finite, we don't really need any of those strategies, but rather just do a brute force exhaustive search for collisions. Thanks for watching.