 In the previous video, we learned about function composition, how we can compose together two functions given algebraically by putting one function inside of the other. The examples we saw in the previous video mostly focused on polynomials and therefore there were really no domain issues whatsoever. And so I do want to look at some examples of functions for which because the domain is restricted, this will have a consequence on the domain of the composite function. So let's take two functions. We're going to take f of x to equal the square root of x and g of x to equal the square root of 2 minus x. So as a quick aside, let's think about the domain of these things. If we want to think about the domain of f for a moment, right? Because f of x is a square root function, what we have going on here is we have to make sure that the radicand, the number inside of the radical, is itself non-negative. So we need that x is greater than or equal to zero. And as there's no more to do there, that's what we end up with. The domain of f is going to be all numbers zero to infinity. Zero included, right? The square root of zero is a number, it's zero. It's a real number there. We can do a similar thing for g. The domain of g, well, with g of x given as the square root of 2 minus x, we have to take the radicand, which is in this case 2 minus x, right? We have to take the radicand and have to set it greater than or equal to zero, in which case you can subtract 2 from both sides, you get negative x is greater than or equal to negative 2. Then divide both sides by negative 1, you're going to get x is less than or equal to 2. Notice here that since I divided by negative 1, your inequality symbol switches directions when you multiply and divide by a negative. So the domain of g will be all numbers less than or equal to 2. So this gives us negative infinity to positive 2 is the domain of g. There is an important difference there. Now let's go look at f composed with g. If we just want to know the formulas, what this means is f composed with g means you put g inside of f. Now in this example here, g is given by the formula the square root of 2 minus x. So we can just replace g of x with its formula. And then we're going to substitute the square root of 2 minus x inside the formula for f here. Everywhere you see an x would replace it with the square root of 2 minus x. This gives us the square root of the square root of 2 minus x here. Now when you start composing radicals with each other, much like exponents, we're going to multiply their degrees together. And we don't usually write it for square roots, but like if we had a cube root of 4th root, we would mention it here. And so if you have a square root of square root, when you multiply that together 2 by 2, you're going to get the fourth root of 2 minus x right here. And so this gives us the formula for our composite function, the fourth root of 2 minus x. What consequences does this have on the domain, right? Well some things we can see very clearly here is that the inside radicand is 2 minus x. That has to be a non-negative number because again we still have an even degree radical here. If 2 minus x was negative, we would be getting an imaginary number. And so this is going to tell us that x needs to be less than 2. That might seem a little bit familiar, right? That's the domain of g. And we've seen this before, right? With the inside function, in order for this function to be defined, g of x needs to be defined. So this function f composed with g will inherit the restrictions of g. So we see that negative infinity to 2 is part of the domain. But any other restrictions going on here? What we've seen before is that the things coming out of g have to fit inside of f here. But what comes out of g? This kind of comes down to looking at the range of this function, the square root of 2 minus x. Turns out the square root only produces non-negative numbers. The square root can only be positive or it could be zero. And that's exactly the domain of f. So the numbers coming out of g are exactly the numbers allowed to go inside of f. So it turns out the restrictions of f don't seem to come into play here because the restrictions of f are compatible with the range of g here. So we see very quickly that the domain of f composed with g is equal to negative infinity to 2, which is just the domain of g. That's not always the case. We're going to see something very different in the next example. If we take a look at g of f of x, we put f inside of g. And so this time I'm going to evaluate the outside function first. g, we're going to take the square root of 2 minus x, but instead of x, we're going to put f of x. And f of x is the square root of x. So we're going to get the square root of 2 minus the square root of x. We do have a nested square root this time, but unlike the last example, we can't compound those together to make it a fourth root. And so identifying the domain is going to be a little bit trickier here this time. The first thing to consider is the inside square root, the square root of x. In order for this to work, we have to have that x is going to be greater than or equal to zero. This is just the domain of f, which again, f is the inside function. Everything entering the composite must first fit through f. But the next thing to consider is that we take the radicand of the second square root, 2 minus the square root of x right here. What makes that thing non-negative? And as we investigate that inequality, I should say 2 minus the square root of x here. This is greater than or equal to zero. We're going to subtract 2 from both sides. So we get negative square root of x is greater than or equal to negative 2. We're going to times both sides by negative 1. We'll get the square root of x is less than or equal to 2, which is the inequality around. And then we're going to square both sides. Squaring is an increasing function when x is here. Yeah, squaring is going to be an increasing function in this case. So we're going to get x is greater than or equal to 4. And so when we put these things together, x is less than or equal to 4, but x has to be greater than or equal to 0. When you put this together, you get the domain of g composed with f is going to equal the interval of 0 to 4. So we only get this finite interval 0 to 4, or the acceptable values for this expression right here. Where do these things come from? The 0 came about because 0 are the, it has to be bigger than 0 to fit inside of f or equal to 0. But where did the 4 come out? Well, the thing is in order for g of x to be defined, your number can't be bigger than 2. So we can then calculate what numbers can fit inside of f to guarantee that number is not bigger than 2. Well, the biggest x can be is 4 because when we take 4, 4 square root is 2 and that was the threshold that g allowed. And so we are able to see exactly what happens here. The numbers coming out of f need to fit inside of g. And if we get bigger than 4, that's no longer a possibility. Just for more example here, let's try g composed with g of x here to kind of see the same principle again. g of g of x. So we're going to take the square root of 2 minus g of x, which itself is 2, we get square root of 2 minus the square root of 2 minus x, like so. So when we look at the innermost square root, we can predict what's going to happen there. We see that x is going to have to be less than 2. That comes from solving 2 minus x is greater than or equal to 0. That's the domain of g. We've seen that one already. Now the thing to check out here is how does this part, how do we make sure that this is non-negative? Well, setting up the inequality, you get 2 minus the square root of 2 minus x, which is greater than or equal to 0. So track 2 from both sides. You get the following times both sides by negative 1. You'll get the square root of 2 minus x is less than or equal to 2. Do make sure you flip the inequality there. Square both sides, you'll get 2 minus x is greater than or equal to 4. Subtract 2, we get negative x is less than or equal to 2. And then times by negative 1 here, we get x is going to be greater than or equal to negative 2. And so when we put these things together, we see the domain of g composed with g is equal to negative 2 to 2. So the things that fit inside of g have to be less than 2, but the things coming out of g in order to make sure that those are still less than 2 themselves must be greater than negative 2. And this shows you how we can find the domain of a composite of two functions, how it'll inherit restrictions from its parents. The inner parent, it'll be straightforward. It has the exact same domain, but the outer parents are a little bit more complicated. But by solving in this case inequalities, we're able to find out what are those limits we get from the outer function of the composition.