If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# Finding composite functions

Through a worked example involving f(x)=√(x²-1) and g(x)=x/(1+x), learn about function composition: the process of combining two functions to create a new function. This involves replacing the input of one function with the output of another function. Also note that the composition of two functions is typically not the same as their composition in the reverse order. Created by Sal Khan.

## Want to join the conversation?

• Would one be able to define the new function as its own function.
For example, the new f(g(x)) would simply be h(x) instead? • How do you find a composite function when one is missing for example if the question is "if g(x) = 2x and f(g(x))=3/x, what is f(x)?" • I am lost, bad at math and give up oof oof ooof oooof I try but I suck :(((( • couldn't sal simplify the answer in ? • Hi Mirghani,

You can simplify the expression, but it will still be a hairy expression.

Let's see how it turns out-
f(g(x)) = sqrt (x/x+1)^2 - 1
= sqrt x^2/(x+1)^2 - 1
= sqrt x^2/(x+1)^2 - (x+1)^2/ (x+1)^2
= sqrt x^2 - (x+1)^2/ (x+1)^2
= sqrt x^2 - (x^2 +2x + 1)/ x^2 +2x + 1
= sqrt x^2 - x^2 -2x - 1 / x^2 +2x + 1
= sqrt -2x -1/ x^2 + 2x +1

You can see that it is still is a hairy number and will not help us much if we factored and simplified it.

I hope that this helps.

Aiena.
• At around the mark, isn't your answer not simplified enough? The three basic rules of simplifying a radical state that the radicand must not have any perfect square factors, there can't be a radical in the denominator of a fraction, and the radicand can't be a fraction. So, to simplify Sal's answer further we would do sqrt((x^2-1)/(1+sqrt(x^2-1)))*(((1-sqrt(x^2-1))/(1-sqrt(x^2-1))). Therefore, we would get (x^2-1-sqrt(x^2-1))/x^2. • For f( g(x)), couldn't we just plug in the value of g(x)? • You could if you were looking at a particular value of x. In this example, Sal was simply using the two functions to build a single function. This is useful in that if you knew a value for x, you could now evaluate a single function rather than having to successively evaluate two different functions. If you need to evaluate the composition at many different input values, generating a composition function algebraically is often more efficient.
• I was able to further simplify f(g(x)) =
sqrt((x^2/(1+x)^2) + 1)
Normalize the 1 = (x+1)^2/(x+1)^2 and expand quadratics
sqrt((x^2-x^2+2x+1)/(x+1)^2)
= sqrt(2x+1) / (x +1)

Is this correct? • Is it possible to do this mentally? Or is better to write the whole thing out? What do you guys think? • With practice, you will most likely be able to find composite functions mentally. This may not happen for all problems, but for some, it certainly will.

For example, if f(x) = x + 1, and g(x) = x^2, finding f(g(x)) wouldn't most likely be regarded as hard, since you can simply substitute the x^2 in to get f(g(x)) = x^2 + 1

However, if you were given a harder example, such as f(x) = (x + tanxsecx - x!/sqrt(x)) and g(x) = cscx * arccos(x), then finding the composite function mentally would probably be harder.
• I don't fully understand finding composite functions can you help me with it.
(1 vote) • Sure!

Usually what we have is we have a variable with a certain value assigned to it. We then put those variable into functions, equations, etc to find what we need.

Ex: We have the variable x, now we can assign it into any form of a function we want. 3x^2 + 3x + 1, we can use it in a quadratic form, linear x + 3, polynomial x^4 + 3x^2 + 1. The variable we have, x is like a folder, it has a certain value/name assigned to it. We can say that x= 5 and assign these equations to another variable, y.

Ex: y = 2x^2 + 2x +1. If we want to find the value for y given that x =5, it's quite simple. Just plug in the value of 5 wherever you see x in the equation.

2x^2 + 2x + 1 (x=5) --> 2(5)^2 + 2(5) + 1 = 2 * 25 + 10 + 1 = 36.

We can use the same equation but change the value for x.

You might be wondering what was the point of that whole explanation, but that is the same way with composite functions. Instead of assigning another number into a variable, you are inputting an equation with another variable.

Ex: Suppose we have our quadratic equation, f(x) =x^2.

Now, suppose we are told that we have another equation g(x) = 2x.

What is f(g(x))?

This might seem a bit intimidating, but it is quite simple.Just doing the same thing we did with our normal variables and plugging it in.

(Ex: if we have t(x)= 2x^2 and said we needed to find t(3) that is just = 2*(3)^2). Just let the equation/variable g(x) inside f(x) equal to the value of x inside x^2
)

We are just letting the x = g(x)
We aren't saying that whatever we plug into x will be inputted into g(x) and get the same value, we are just saying, that whenever we find the value of x in the function f(x) we will plug in that value into the equation.

(you might be familiar with this if you take computer science, we are just assigning a variable to an equation, even though necessarily x doesn't equal to g(x) or 2x)

Let's solve it now!

1) Rewriting the equations again
f(x)= x^2

g(x)= 2x

2) Rewriting the question we need to solve and the information we know.
f(g(x)) g(x)=x ---> x=(2x)

f(2x)

3) Plugging 2x for the value of x in the function f(x)

f(x) = x^2

f(2x) = (2x)^2

Therefore f(g(x)) = 4x^2

Now what if we were to find g(f(x))?

That is just g(x^2)

We are doing the same thing we did before, but this time, letting the input within g(x) as the value of f(x) or x^2.

g(x) = 2x
f(x) = x^2
g(f(x)) = g(x^2)
g(x^2) = 2(x^2)

Hopefully I was able to give you a good overview of what composite functions are, now for some harder examples:

f(x) = x-3/x-4
g(x) = ∛3x

What is g(f(x)) and f(g(x))

g(x-3/x-4) = ∛3(x-3/x-4)= ∛(3x-9/x-4)

f(∛3x) = (∛3x)-3/(∛3x)-4

I hope you were able to understand this topic better.
As always do let me know if you have any questions or doubts.

Some links if you would like: 