 In this last video for lecture two about functions, we're gonna list and prove some properties about function composition. So imagine we have three functions, F is a function from A to B, G is a function from B to C, and H is a function from C to D. Now, if you look at their domains and co-domains, be aware that G composed with F is a well-defined function because the domain of G is the co-domain of F. And likewise, the function, let's see, make sure we get the right direction here, right? The function H of G is likewise well-defined here because the co-domain of C, the things coming out of G, is the domain of H, the things that are supposed to go in there, right? So G of F is defined and H of G is defined. And as such, we can also put all three of them together like we do here. So we could talk about H of G of F and H of G of F, right? Well, that sounds the same when I say it out loud, but the parenthesis indicate this could be two different things. Now, whenever you have a binary operation, you start combining triplets together, we have to worry about things like associativity. Does it matter the order that we proceed in terms of computing this binary operation? When it comes to function composition, this is an associative operation. It doesn't matter if you do the first two, then the third, or the last two, then the first, it's associative, you can redo the parenthesis. And therefore we're justified in writing things like H of G of F, we're completely justified in doing such a thing like that. The other properties are gonna have to do with surjectivity, injectivity, and bijectivity. Suppose that F and G are both surjective, they're on two functions, then the composite will likewise be on two. In terms of, well, this time let's assume that F and G are both injective, they're both one-to-one functions and the composition will be one-to-one. So the child will inherit the property from its two parents. And then it turns out if you put these things together, if F and G are both bijective, then the composite will also be bijective. So if both parents and have a trait, the child will inherit the trait as well. Turns out we could actually get away with some weaker statements than this. I should say that weaker assumptions. It turns out that for a child to inherit a trait, maybe only one parent has it. We're not gonna go into the details of that right now. We'll just stick with the proposition as it's, the theorem as it's stated right now. Now for all four of these parts here, I wanna remind us of an important template when it comes down to showing that two functions are equal. Cause after all, functions are sets. So if we wanna show that two sets are equal to each other, we saw the subsets of each other. Now with functions, we can basically do that, but we can approach it in a slightly different way. What we can do is to show that two functions, F and G equal each other, what you're gonna do is you're going to, I will only write this way. If F of X equals G of X, and we do this for all X's inside the domain, which we'll call capital X, then in that situation, we see that F and G are the same thing. Now admittedly, their domains and co-domains have to equal, but in terms of the formula, if every image is equal to each other for the same input, then the functions are actually equal to it. So what we're gonna do here is that to show that two functions are equal, we're gonna take an arbitrary input inside their common domain and argue that the two formulas turn out to be one and the same thing. So for example, if we take the triple composite, right, take an arbitrary element inside the domain, let A be just some arbitrary element of the domain, and then consider the first function, F of G of F evaluated at A. Well, by definition, what this thing means is F of G, which is just a function of, sorry, H of G, which is a function of F. By definition of composition, you're gonna write this as H of G of F of A, where F of A is some number now, right? And then when you evaluate this, what is, so F of A is now the input of the composite H of G, and so by definition of composition again, this will be H of G of F of A, right? And so this is what the triple composite will look like, this thing over here, but then you just do it the other way around, right? If you take H of G of F of A, this becomes H of G of F of A, and then G of F of A becomes G of F of A, right? Yeah, I say them words, because we use the same words to describe the same thing. So what we can see is for an arbitrary choice, because the choice of A here was arbitrary, right? This evaluation is equal to this evaluation, and since the two functions have the same domains and co-domains, right? The domain of these two functions would both be A, so for both of these things, F of G of F, this would be a function from A to C, and that's also true for the other function, F of G of F, this would be a function from A to C. For two functions to be equal, their domains and co-domains have to be the same, but so that's not in question, all these two functions will naturally have the same domains and co-domains. We want the evaluation, the rule associated to the function is the same, and by choosing an arbitrary element, we can see that since they agree on an arbitrary element, the two functions are equal to each other, so we can conclude that H of G of F is equal to H of G of F, like so. That's what we proved in part A. So part B, let's prove that one together. So if F and G are both surjective, then G of F is likewise surjective. Now to show that something is surjective, we have to take an arbitrary element in the co-domain. Oh, I think I botched this earlier, the co-domain of H was D, so these are functions from D to D. Sorry about that. So if you wanna prove that a function's surjective, what you do is you're gonna take a typical element, an arbitrary element of the co-domain, right? So if you look at the function G of F, this is a function from A to C, and so we just take a typical element, an arbitrary element of C. We wanna show that there's something in A that maps on to C. Now since G is surjective, what this tells us is that there's some element in B, so it's a G of B equals C. So we get that the on-tunis of G is gonna produce some element B of the form G of B equals C, right? So that's how we use the first on-tunis. Now F is also surjective, right? If F is surjective here, that means there's some element A inside of the domain A that maps to B. So the on-tunis of F gives us F of A equals B. And so now the idea is just to put these things together. Notice if you take G of F of A, by definition of function composition, you're gonna get G of F of A. F of A is B and then G of B is C. So we've now shown that every element in the co-domain will map from something in the domain. So the composition of two surjective functions is surjective. It'll be left as an exercise to the student to prove part C. Part C was the composition of two functions, two injective functions is injective. Why does the composition preserve one-to-one? Well, look at the definition like we did here. You're gonna use the injectivity of B of F and G to force it together when you can pause it, when you compose it. And then finally, if the function's F and G are both bijective, then they're both injective and surjective. If they're both surjective, they're composite surjective. If they're both injective, then their composite is surjective and therefore the composite will both be injective and surjective is bijective. So part D follows immediately from parts B and C. So it'll be left for the viewer here to answer part C to provide a proof of that right there. And it's not so bad. So if you believe in yourself, I think you can work through it. That brings us to the end of lecture two. Thanks for watching, everyone. If you had any questions along the way, I hope you post your questions in the comments here on YouTube. I'm happy to answer any questions that viewers might have. If you learned something, hit like. If you wanna learn some more, subscribe to the channel. And you can see some more videos like this in the future. I will, in the next video, in the next lecture three, we're gonna talk about inverse functions. Particularly more, we're gonna focus on when functions are bijective, talk about permutations. So take a look for those videos, which hopefully you should see a link to them right now. Bye, everyone.