 This video is going to talk about composition of functions. The composition of functions can be written that looks like a degree sign between the f and g of x. Or it can be written as f in place of its x we put the function g of x. What that really means is that we're going to take f and g function. And we take the g function and we're going to plug it into here. So I take an input and then I get an output and that goes in here. So the output of g will become the input of f. So the domain of the composition is all the x's in the domain of g which g of x is in the domain of f. What that really means is that here's my domain of f. And I have my g but it's going to have some things overlap. That's the range, the output is going to be part of the input. And it's these values in here. So the output of g has to be part of the input of f. That's what that means. This is the range of g. Alright so let's just put it into practical terms. Here we have an f of x is equal to x squared minus 2x. g of x is x plus 3. And we know that to begin with both functions have all real as their domains. So it wants us to find h of x which is this composition and then determine the domain of the result. It might be easier for you to think about it this way. g of x goes inside f of x. So wherever I see x it's x squared minus 2 times x. But my x becomes this g function. So it's x plus 3 that's being squared and minus 2 times x plus 3. g went into the red outside f. Let's work it out. This is going to give us x squared. This is 3x times 2. It's a shortcut twice the product. So plus 6x. 3 times 3 would be 9. Minus and then I've got to distribute the negative 2. So it's minus 2x and minus 6. And combining my like terms I have x squared. And 6 minus 2 is going to be plus 4x. And 9 minus 6 is going to be plus 3. And we see this result as a domain of x being an element of negative infinity to infinity. This can have all reels because all of these had all reels. So given those same two functions, find h of x which is g composed with f. So this time if you want to rewrite it it would be g. And I'm going to write it this way. Composed with f of x. So the g function has x and then plus 3. And the f function in here is x squared minus 2x. So I've plugged in the f function into the g. And we find out that we get x squared minus 2x plus 3. So the result is that the domain has an x that is an element of all reels. So since this has a domain of all reels and g has a domain of all reels, when you put one inside the other one you can still have all reels. And q of x is x plus 2 and we want to find the h of x is q of p of x. They want us to find this p of q of negative 2. But if you notice these are the two ways you can write that. And I want to do it with one way using the h of x and one way just using the function. So since this one is really h of x, let's go and figure out what that is. So that's p which is x squared minus 8. And q goes inside the p function. The second one always goes inside. So that's going to be x plus 2. Now though I have this negative 2 so I can just plug it right in. Negative 2 plus 2 quantity squared minus 8 is going to be 0 minus 8 or just negative 8. Okay, let's do this one. p of q of negative 2. Technically what this one is saying is I need to say that q of negative 2 is equal to negative 2 plus 2 and that's going to be equal to 0. And then I want to take and say p of this now is equivalent to q of negative 2. So I want to know p of 0. x squared or 0 squared minus 8 will give us the same answer of negative 8. So we want to find f of g of x and then determine the domain. So f of g of x is going to be f of g of x. So inside the f function I'm going to put the g function. Well the f function is the square root of x plus 5. But what is my x? It's the g of x function. So inside here I have to put 4x minus 1. So really I just have the square root of 4x plus 4. And I would be happy with that. This is okay for me. We'll talk about the domain in a minute. But if you're going to look in the back of the book they would do this. They would factor it into the common factor of 4 then x plus 1. And then each one of these gets their own. The square root of 4 since they're being multiplied. The square root of x plus 1. So they're going to say that it's 2 square root x plus 1. Either one works. I'm okay with this one too. Because we're not really simplified in this class. So let's talk about the domain. The g function, its domain is all reals. The f function, its domain is going to be x plus 5 has to be greater than or equal to 0. So x has to be greater than or equal to negative 5. Let's think about this. We are really using a square root function which is f. So it has to be greater than negative 5. So I have to take the g function and say that's what I was inputting. That's the x of that function. So it has to be greater than or equal to negative 5. Let me see if I can help you think through that. I really have the square root of g of x plus 5. And this is my x instead of x plus 5. So we say g of x plus 5 has to be greater than or equal to 0. So g of x has to be greater than or equal to negative 5. That's another way to think about it. So if I do that continuing on, then g of x is 4x minus 1. And that has to be greater than or equal to negative 5. So if I add 1 to both sides, I'm going to have 4x is greater than or equal to 4. It's greater than or equal to 1, which means that the domain is going to be from 1 and including 1 to infinity. So the purple and the red are my two answers. Now we have to go think back and we want to do g of f of x. So we have the g function is 4x minus 1. So 4 times my x, whatever it is, minus 1. My f function is the square root of x plus 5. And when I simplify that, I get 4 times the square root of x plus 5 minus 1. I can't really do anything more with that. So now let's go think about these functions again. Again the g function is all reals. The f function we know we already figured out that that has to be x is greater than or equal to negative 5. If we think back to what we did before, we have 4 times f of x minus 1. So I'm inputting that f of x and that's what my x is. So my x says that it has to be greater than or equal to negative 5 and then I have this function has to be greater than or equal to 5 or the domain would be negative 5 to infinity. So here's my domain and here is my function. This is probably a good idea to try putting your function in function notation. So what is your x? That's the square root. Well what's the square root's restriction? It's negative 5. If we look back to the one before, g of x is my x underneath the radical. Well what do we have to do there? Well then we have to say that g of x plus 5 is greater than or equal to 0.