# Introduction to function composition | Functions and their graphs | Algebra II | Khan Academy

Here we have 3 different function assignments. This is f (x) in blue. Here we compare the different values \u200b\u200bof t and g (t). You can think of this as setting g (t). Here we compare x to h (x). For example, when x is equal to 3, h (x) is equal to 0. When x is equal to 1, h (x) is equal to 2. And let me number that. 1, 2, 3, here it is. In this video I want to introduce you with the idea of \u200b\u200bcomplex (composite) functions. What does a complex function mean? This means composing one function from other functions or you can take it as if we are squeezing them into a nest. What do I mean by that? Let’s think about what it will mean to calculate f not from x, but f from … let’s start with a little warm-up. Let us calculate f (g (2)). How much do you think this will be? And I encourage you to pause the video and to think for yourself. It seems a little difficult at first, if you don’t know the signs well, but we just have to remember what a function is. The function is to compare one set of numbers to another. For example, when we say g (2), this means that we take the number 2, we enter it in function g and then we get output value, which we will call g (2). We will now use this output value, g (2), and we will set it as an argument to the function f. We will set this as an argument to the function f and we will receive f of the thing we introduced, f (g (2)). Let’s do it step by step. What is g (2)? When t is equal to 2, g (2) is -3. When I set -3 as an argument to f, what will I get? I will get (-3) ^ 2 minus 1, which is 9 minus 1, which is going to be equal to 8. This here is equal to 8. f (g (2)) will be equal to 8. Using the same logic, how much will be f (h (2))? Again, I advise you to pause the video and think about it on your own. Let’s think of it as, instead to use this model, here everywhere, where you see that the argument is x, whatever it is, you square it and subtract 1. Here the argument is h (2), so we will take the argument which is h (2), we will square it and we will subtract 1. That is, f (h (2)) is h (2) squared minus 1. What is h (2)? When x is equal to 2, h (2) is 1. h (2) is 1, so that since h (2) = 1, this is simplified to 1 squared minus 1, which is just 1 minus 1, which is equal to 0. We could do it with the model, we could say, “We\’re going to introduce 2 in h.” If you enter 2 in h, you get 1, so this here is h (2). This is h (2) and then we will introduce this in f. We will enter this in f, which will give us f (1). f (1) is 1 squared minus 1, which is 0. That is, here it is f (h (2)). h (2) is the argument in f, so the output value will be f of our argument, f (h (2)). Now we can go even further, let’s do a complex function. Let’s combine 3 of these functions together. Let’s take – and I’ll do it on the go – I hope it is a good result, g (f (2)), let me think for a second. This will be g (f (2)) and let’s take h (g (f (2))), just for fun. Now we do a triple compilation. There are several ways we can do this. One way is to simply try to calculate what f (2) is. f (2) will be equal to 2 squared minus 1. This will be 4 minus 1 or 3. This will be equal to 3. What is g (3)? g (3) is when t is equal to 3, g (3) is 4. So this whole thing, g (3) is 4. f (2) is 3, g (3) is 4. What is h (4)? We can go back to the original schedule. When x is 4, h (4) is -1. That is, h (g (f (2))) is equal to simply -1. I hope this clarifies the way at least a little, on which complex functions are calculated. 