When we put two functions together, we have something called a composition of functions. For example, the expression g(f(x)) states that we should put the "f" function into the "g" function. To do this, we simply substitute the entire inner function into each of the variables in the outer function.
Composition of functions. So behind me I have 2 functions up, f of x and g of x. What we're going to do is talk about composition, putting them together, okay? So just a brief reminder. If I asked you to find f of 2, you just plug in 2 for x and solve it out. So this becomes 2 squared plus 4, 2 squared is 4 so this is just 8. Okay. Composition is what happens when we put them together. So what you will see is something like g of f of x. A bunch of parentheses in there. And what this is really telling us to do is to take f of x and put it into g. Okay? Just like here we had our 2 when we put it into f, the same exact principle here. So we look at g, every time we see an x we plug in f of x. Okay? So what this happens is this ends up being f of x plus 1, just plugging this in for x. We know what f of x is, so this becomes x squared plus 4 plus 1. Simplifying it out x squared plus 5. Okay? We can go the other way as well. So say I come over here we have a little bit more space. Say, f of g of x. So here we're doing is we are taking g of x this inside and plugging into f. Okay? Just like we had here we've plugged in 2 in to f. Here we're just plugging in g of x. So what we end up getting is g of x quantity squared plus 4, okay? We know what g of x is, it's x+1. So this is just x+1 squared plus 4 foiling this out, x squared plus 2x plus 1 combining your like te- oops sorry there's +4 in the end, combining all like terms x squared plus 2x plus 5. This is how you do compositions, okay? One quick note is depending on your book, depending on your teacher, you might see this differently, and what you may see is f then a circle g of x. Looks like a fog. This actually just the composition function so it's just telling you to do f of g of x. In general whenever I see this, I don't really like this notation too much so I tend to rewrite it like this because this makes more sense to me going back to function notation but these two statements are saying the exact same thing. Okay? So, taking the composition of 2 functions, basically taking 1 function plugging it into the other.