Composition of Functions: Definition & Examples

Instructor: DaQuita Hester

DaQuita has taught high school mathematics for six years and has a master's degree in secondary mathematics education.

What is a composition of functions and exactly how do you solve them? Find out and practice solving them in this lesson, then test your skills and knowledge with a quiz.

What is a Composition of Functions?

In mathematics, a function is like a machine. It performs a set of operations on an input in order to produce an output. Therefore, a composition of functions occurs when the output, or result, of one function becomes the input of another function.

For functions represented by f(x) or g(x), the composition would be represented by f(g(x)) or g(f(x)). It is important to know that f(g(x)) does not usually have the same value as g(f(x)), so order matters when calculating their composition. A general rule to keep in mind is to work from the inside out. The innermost function is the one that you should start with.


Let's begin our practice by looking at a few basic examples.

First, let f(x) = 2x and g(x) = x + 4. We are going to calculate the composition of f(g(3)). Since g(3) is written on the inside, we will start with that function first and substitute 3 into the equation for g(x). When we do, we see that g(3) = 3 + 4 = 7. Now, since g(3) = 7, we can see that f(g(3)) = f(7). From here, we are going to substitute 7 into the equation for f(x). We will see that f(7) = 2(7) = 14. So in conclusion, f(g(3)) = 14.

Let's try another one. For our second example, let f(x) = 2x + 1, and let g(x) = x^2. We are going to calculate g(f(-2)). Since f(-2) is written on the inside, we will start with that function. By substituting -2 into the equation for f(x), we see that f(-2) = 2(-2) + 1 = -4 + 1 = -3. So now, g(f(-2)) becomes g(-3), and we are ready to substitute -3 into the equation for g(x). We are able to see that g(-3) = (-3)^2 = 9. Therefore, g(f(-2)) = 9.

For our last example, we will use three functions. Let f(x) = x/2, g(x) = 2x - 5, and h(x) = 3x. We are going to calculate the composition of h(g(f(6))). The innermost function is f(x), so we will start there. We see that f(6) = 6/2 = 3. Since f(6) = 3, h(g(f(6))) becomes h(g(3)). From here, we will move to g(3) because it is now the innermost function. By substitution, g(3) = 2(3) - 5 = 6 - 5 = 1. Now that we know g(3) = 1, h(g(3)) becomes h(1), and we are ready for our last calculation. Through substitution, we see that h(1) = 3(1) = 3. This shows us that the overall composition of h(g(f(6))) = 3.

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create An Account