 Welcome to another screencast on composition of functions. In this video, we want to focus on how to construct proofs of theorems that involve composite functions. The best way to start is to review the definition of a composite function, and let's do that through a quick concept check. So let's suppose I have two functions, u and v. v maps the real numbers into the integers, and u maps the natural numbers into the real numbers. Notice that we're not providing the rule for these functions here. That won't matter for the question. If I wanted to calculate v compose u of two, what would I do? Look at the options, pause the video and vote, and then come back when you're ready. So the answer here is a. By definition, v circle u of two is equal to v of u of two. Now if we follow a basic order of operations and do the operation in parentheses first, we would calculate u of two. Then, whatever that works out to be, evaluate the result into the function v and we'll be done. Notice that this makes mathematical sense because the co-domain of u is the set of real numbers. So u of two is some real number, we don't know what. And the domain of v is the set of real numbers. So I can evaluate v at whatever u of two works out to be. The order here does matter, just like the order in which I make my eggs matters. And the order makes sense here because, again, the co-domain of u is the domain of v. So if you know the definition of a composite function, then you know how to prove results about composite functions. Because the definition of composite is what drives those proofs. Let's have a look at one. We're going to let a, b, and c be non-empty sets. And f is a function from a to b, and g is a function from b to c. Then we're going to prove that if f and g are both injections, then g circle f is also an injection. Again, notice here that f circle g would not make mathematical sense because the co-domain of g doesn't equal the domain of f. So the only composition here that makes any sense at all is g circle f. So let's look at the proof. So just before we begin writing things, let's review what it would mean to prove that g circle f from a to c is an injection. Don't let the composition notation fool you. All we're doing here is looking at a function from a to c and want to prove that it's an injection. That means we need to show that this function has no collisions. That anytime I take two distinct inputs from a, I end up with two distinct different outputs in c. And using the definition, I can either prove that directly by assuming that I have two different inputs and show that I get two different outputs, or I could do this in the contrapositive format by assuming I have the same outputs and then proving that the inputs had to be the same. Back in the earlier video, I said the direct proof is kind of not very commonly used, but this time I think it's going to work out pretty well to use it. So what we're going to do here is start by taking two distinct inputs from a, running it through this function, which is a little complicated this time, but maybe we can work it out and then show we get two distinct outputs over here in the code domain. So let's pop over to a new screen and see if we can do that. So first of all, let's assume for a direct proof, let's assume or choose two distinct points in a. Let's call them x1 and x2. So let's let x1 and x2 belong to a with x1 not equal to x2. This is my, these are my two distinct different outputs. And what I want to prove here, I put this in red because this is pretty important to remember, I want to prove or show that the outputs are different. The function here is called g compose f. So g compose f of x1 is different from g compose f of x2. That's my goal there and I keep that very close by. Okay, one thing that we could possibly do here is sort of a backward step. So what is this stuff here actually mean? So I can interpret that to say that is I want to prove, I'm going to put this in red again. What is g compose f of x1? That means that g, that's the same thing as g of f of x1. And I want to show that's not equal to g of f of x2. So in other words, if I start with these two points, I'm calling x1 and x2, and I run them both through f and then run the results both through g, I will ultimately end up with different outcomes. That's what I want to prove. So I'm going to keep my eye on this line right there, that's where I want to prove. So let's see what we can do. Well, the first thing I would have to do to compute the two things I'm interested in is compute f of x1 and f of x2 just by order of operations, okay? So let's do that. So what do I know about f? Well, by assumption f was an injection. So I know that since x1 and x2 are in the domain of f and they're different because or since f is an injection, I know something. I know that f of x1 is not equal to f of x2. And that is just the straight definition of an injective function. You can go look that back up again. So I know something about the components of what I eventually want to prove something about. I know that f of x1 is not equal to f of x2. Now what I need to do next is I'll move to thinking about g. Now f of x1 and f of x2 are over in the set B. That's the co-domain of f, but it's also the domain of g. Now I know something about g as well. I'm going to say it in sort of general terms here. Since g is also an injection, if g is an injection, then generally speaking, B1 not equal to B2 implies that g of B1 is not equal to g of B2. And this is for all B1 and B2 in the domain of g. So any time, in other words, I have two unequal points in the domain of g, their outputs will be different too, and that's because g is an injection. But look, here are two different points that I happen to have in my pocket here that belong to the set B. So I can apply that definition of injection to get to my final line here actually very quickly. So since f of x1 and f of x2 do happen to belong to B and are unequal, what does this mean? That means that g of f of x1, g of that point is not equal to g of f of x2. And that is what I wanted to prove way up here. So I have completed my proof, and I need to put my box down here to say I have completed my proof, because I started with two distinct points in A, and I wanted to prove that the composite function applied to those points also gives me different results. And so the fact that f was an injection means that sort of at the first stage, after the first process is over with, I get two different outcomes. But then those outcomes are now inputs to the second function, which is an injection. So since the inputs are different, the outputs are different, and that's exactly what I wanted to show. So really right there was just two applications of the definition of injection, and one application of done repeatedly, it seems like, of the definition of composite function. So like I said, if you know the definitions of composite function and all the other stuff in your result, the result almost proves itself, because all we're really doing is applying definitions over and over and over again. So learn that definition, and thanks for watching.