Fiveable

📈AP Pre-Calculus Unit 2 Review

QR code for AP Pre-Calculus practice questions

2.7 Composition of Functions

📈AP Pre-Calculus
Unit 2 Review

2.7 Composition of Functions

Written by the Fiveable Content Team • Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examWritten by the Fiveable Content Team • Last updated September 2025

Composite functions are functions made up of two or more simpler functions put together. Similarly, the process of combining functions is called composition of functions. 🧩

The basic notation for composite functions is f(g(x))f(g(x)), where f and g are two functions and x is the variable in the function. The first function, g(x)g(x), is applied to the variable x, and the result is then input into the second function, f(x)f(x). The output of the composite function is the final result of applying both functions, one after the other.

For example, if we have a function f(x)=x2f(x) = x^2 and a function g(x)=2x+1g(x) = 2x + 1, the composite function would be f(g(x))=(x2)=(2x+1)2f(g(x)) = (x^2) = (2x + 1)^2, The function g(x)g(x) is applied first, so the xx in g(xg(x) is replaced by 2x+12x+1 and the result is squared.

how-to-do-composite-functions-1-1024x585.png
Composition of function example displayed: Find f(g(x))f(g(x)), where g(x)g(x) equal to x squared (x2)(x^2) and f(x)f(x) equal to x+3x+3. Answer: f(g(x))f(g(x)) is equal to x squared plus 3 (x2+3)(x^2+3). Source: Maths at Home

One of the key ideas when working with composite functions is that the output of the first function is used as the input of the second function. Therefore, by using the output values of g(x)g(x) as input values for f(x)f(x), we can calculate or estimate the values of the composite function f(g(x))f(g(x)).

This method can also be applied to graphical representations of ff and gg by using the graph of g(x)g(x) to find the output values of g(x)g(x), and then using these values as input values for the graph of f(x)f(x), the corresponding output values for f(g(x))f(g(x)) can be found graphically.

Pep mascot
more resources to help you study

📝 Notation and Properties

Composite functions can also be represented using function notation, where the output of the first function is the input to the second function, denoted as f(g(x))=f(x)f(g(x)) = f(x) composed g(x)=fg(x)g(x) = f • g(x).

1️⃣ The order of the functions matters and can produce different results. Specifically, the composition of functions is not commutative, meaning that f(g(x))f(g(x)) and g(f(x))g(f(x)) are typically different functions [f(g(x))=/=g(f(x))][ f(g(x)) =/= g(f(x)) ].

For example, consider two functions f(x)=x2andg(x)=2x+1f(x) = x^2 and g(x) = 2x + 1. The composite function f(g(x))=(2x+1)2f(g(x)) = (2x+1)^2, while the composite function g(f(x))=2x2+1g(f(x)) = 2x^2 + 1. These two composite functions are different and have different properties, and they could not be derived by simply changing the order of the functions.

2️⃣ Identity function: The identity function, f(x)=xf(x) = x, is a special function that when composed with any other function g(x)g(x), results in the same function g(x)g(x).

This means that g(f(x))=f(g(x))=g(x)g(f(x)) = f(g(x)) = g(x) for any function g(x)g(x). This property is similar to the properties of the additive identity 0 and the multiplicative identity 1 in arithmetic.

For example, consider the function g(x)=2x+1g(x) = 2x + 1. If we compose the identity function f(x)=xwithg(x)f(x) = x with g(x), the resulting composite function is g(f(x))=g(x)=2x+1g(f(x)) = g(x) = 2x+1, which is the same function as g(x)g(x)! 🤯

This is because the identity function simply returns the input value as the output value, so when it is composed with another function, it does not change the original function. This is similar to how adding 0 to a number does not change its value, and multiplying a number by 1 does not change its value.

🧑🏿‍💻 Working with Composite Functions

It’s important to understand how to construct an analytic representation of f(g(x))f(g(x)), given analytic representations of f(x)f(x) and g(x)g(x). One method to achieve this is by substituting g(x)g(x) for every instance of xx in f(x)f(x). This process is called function composition, and it is a way to create a new function from two existing functions.

Another way to construct a representation of f(g(x))f(g(x)) is by using numerical or graphical methods. For numerical methods, we can calculate or estimate values for (x,f(g(x)))(x, f(g(x))) by using a table of values for g(x)g(x) as input values for f(x)f(x) and calculating the corresponding output values for f(g(x))f(g(x)).

Similarly, for graphical methods, we can use the graph of g(x)g(x) to find the output values of g(x)g(x), and then use these values as input values for the graph of f(x)f(x) to find the corresponding output values for f(g(x))f(g(x)).

graphs-of-f-g-and-fog-example-5.gif
Graph f(x) and g(x) plotted on a coordinate plane with a composite function: f•g. Source: Free Math Tutorials

🔨 Function Decomposition

Function decomposition, on the other hand, is particularly useful when working with functions that are given analytically, as it allows us to break down the function into simpler parts that are easier to understand and work with.

When decomposing a function, you need to ensure that the variable in one function replaces each instance of the function with which it was composed. This is known as the substitution property, and it is crucial to ensure that the function is properly decomposed.

For example, consider the function f(x)=(2x+1)2f(x) = (2x+1)^2. We can decompose this function by taking the square root of both sides of the equation, which gives us f(x)=((2x+1)2)=2x+1f(x) = √((2x+1)^2) = |2x+1|. The variable x replaces each instance of the function (2x+1)(2x+1) in the original function, which means that the function has been properly decomposed.

🦸🏽 Transformation Time!

We also often encounter transformations of functions that result in changes to the shape and position of the graph—and composite functions are not exempt from this idea! Two common types of transformations are additive and multiplicative.

An additive transformation of a function, f(x)f(x), that results in a vertical translation of the graph can be understood as the composition of the function g(x)=x+kg(x) = x + k with f(x)f(x). This means that the graph of the transformed function is obtained by taking the graph of f(x)f(x) and shifting it upward or downward by a constant value k. The value of k represents the amount of the shift.

A multiplicative transformation of a function, f(x)f(x), that results in a horizontal dilation can be understood as the composition of the function g(x)=kxg(x) = kx with f(x)f(x). This means that the graph of the transformed function is obtained by taking the graph of f(x)f(x) and stretching or shrinking it horizontally by a factor of kk. The value of k represents the amount of the dilation.

When we apply these transformations, we can use the properties of the function g(x) to understand how the transformation affects the original function. 😁

For example, when we apply the function g(x)=x+ktof(x)g(x) = x + k to f(x), we can see that the output of g(x)g(x) is the input of f(x)f(x) plus kk, which means that the graph of f(x)f(x) is shifted vertically by kk units. Similarly, when we apply the function g(x)=kxtof(x)g(x) = kx to f(x), we can see that the output of g(x)g(x) is the input of f(x)f(x) multiplied by kk, which means that the graph of f(x)f(x) is dilated horizontally by a factor of kk.

Frequently Asked Questions

How do I solve f(g(x)) when I have two functions?

Think of composition f(g(x)) as feeding g’s output into f. Steps: 1. Identify inner and outer functions: g is inner, f is outer. 2. Substitute: everywhere you see x in f(x), replace it with g(x). Example: if f(x)=2x+1 and g(x)=x^2, then f(g(x)) = 2*(x^2)+1 = 2x^2+1. 3. Simplify the expression algebraically. 4. Check the domain: only x-values allowed where g(x) is defined AND g(x) lands in the domain of f (CED 2.7.A.1). For example, if f(x)=ln x and g(x)=x-3, f(g(x)) = ln(x-3) and domain is x>3. 5. Remember composition is not commutative: f(g(x)) usually ≠ g(f(x)) (CED 2.7.A.3). For more examples and AP-aligned practice, see the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and practice problems (https://library.fiveable.me/practice/ap-pre-calculus).

What's the difference between f(g(x)) and g(f(x))?

Short answer: they’re usually different—f(g(x)) means “do g first, then f,” while g(f(x)) means “do f first, then g.” The inner function’s outputs become the outer function’s inputs, so order matters (composition is not commutative, CED 2.7.A.3). Key points you should use on the AP: - Inner vs. outer: in f(g(x)), g is inner, f is outer (use substitution: replace every x in f with g(x), per 2.7.B.2). - Domain restriction: the composite’s domain is those x where g(x) is defined and g(x) lies in f’s domain (2.7.A.1). - Identity: if one function is f(x)=x, composition doesn’t change the other function (CED 2.7.A.4). Quick example: f(x)=x+1, g(x)=2x. Then f(g(x)) = 2x+1, but g(f(x)) = 2x+2—different. Practice evaluating and checking domains for compositions on the AP (Topic 2.7). For more review and practice, see the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and lots of practice problems (https://library.fiveable.me/practice/ap-pre-calculus).

I'm confused about composition of functions - can someone explain it step by step?

Think of composition f ∘ g as feeding the output of g into f—do it step-by-step. 1) Identify inner and outer functions. In f(g(x)), g is inner, f is outer. 2) Compute g at the given x (or substitute g(x) into f). Remember the domain: only x where g(x) is in f’s domain count (CED 2.7.A.1). 3) Evaluate the outer function using that value. Quick example: f(x)=2x+3 and g(x)=x^2. Find (f ∘ g)(2). - Inner: g(2)=2^2=4. - Outer: f(g(2))=f(4)=2(4)+3=11. So (f∘g)(2)=11. Check g∘f(2): f(2)=7, then g(7)=49—different, showing composition isn’t commutative (CED 2.7.A.3). When you have analytic forms, substitute g(x) for x in f to get f(g(x)) (CED 2.7.B.2). For graph/table problems, use g’s output as input to f (CED 2.7.A.2). To break a function into simpler composed parts, look for obvious inner pieces (like x+k or kx)—that’s decomposition (CED 2.7.C). For more examples and AP-aligned practice, see the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and thousands of practice problems (https://library.fiveable.me/practice/ap-pre-calculus).

When do I use function composition vs just multiplying functions together?

Use composition when the output of one function becomes the input of another; use multiplication when you want the product of two outputs at the same x-value. Quick rules: - Composition: (f ∘ g)(x) = f(g(x)). You substitute g(x) for every x in f. Use this when a quantity depends on another quantity that’s already a function (inner = g, outer = f). Remember domain restriction: x must be in domain of g and g(x) must be in domain of f (CED 2.7.A.1). Composition is not commutative: f(g(x)) ≠ g(f(x)) in general (CED 2.7.A.3). - Multiplication: (f·g)(x) = f(x)·g(x). Use this when you want the product of two values evaluated at the same input x (no substitution). Example: f(x)=√x, g(x)=x+1. - f(g(x)) = √(x+1) (composition, inner g, outer f; check domain x ≥ -1). - f(x)·g(x) = √x·(x+1) (product; domain x ≥ 0). Composition is especially useful for transformations (horizontal shifts/dilations can be seen as composing with x+k or kx) and modeling chained relationships (CED 2.7.B, 2.7.C). For AP prep, practice evaluating and rewriting compositions (Topic 2.7 study guide: https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL). For lots of practice problems, see (https://library.fiveable.me/practice/ap-pre-calculus).

How do I find the domain of a composite function like (f ∘ g)(x)?

Think of (f ∘ g)(x) = f(g(x)) as a two-step machine: x goes into g, g(x) must produce a value that f can accept. So the domain of f∘g is all x in the domain of g for which g(x) lies in the domain of f (CED 2.7.A.1). How to find it (step-by-step): 1. Find domain(g): all x where g(x) is a real number. 2. Find domain(f): the allowable inputs for f (often you’ll need to solve inequalities or exclude zeros in denominators, logs, square roots, etc.). 3. Solve the condition “g(x) ∈ domain(f)”—i.e., substitute g(x) into the restrictions from step 2 and solve for x. 4. Intersect that solution with domain(g). The intersection is the domain of f∘g. Quick example: if f(u)=√u (domain u≥0) and g(x)=x−3, require x−3≥0 → x≥3 (also check g’s domain). For more practice and AP-aligned explanations, see the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and try related practice problems (https://library.fiveable.me/practice/ap-pre-calculus).

What does the circle symbol mean in f ∘ g and how do I calculate it?

The circle in f ∘ g means “compose f with g”—do g first, then feed g(x) into f. Formally (f ∘ g)(x) = f(g(x)). g is the inner function and f is the outer function. To calculate: 1) compute g(x); 2) substitute that expression/value wherever x appears in f; 3) simplify; 4) check domain: only x for which g(x) is defined and g(x) lies in the domain of f are allowed (CED 2.7.A.1). Example: if f(x)=√x and g(x)=x−3, then (f∘g)(x)=√(x−3); domain x≥3. Note f∘g ≠ g∘f in general (noncommutative, 2.7.A.3). On the AP exam you’ll often be asked to evaluate compositions at given x or build f(g(x)) algebraically (2.7.A/B). For more practice and step-by-step examples, see the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and Unit 2 overview (https://library.fiveable.me/ap-pre-calculus/unit-2).

Can someone walk me through evaluating f(g(2)) when I'm given both functions?

Quick steps to evaluate f(g(2)) when you’re given both functions: 1. Identify inner and outer functions. g is the inner function (you do g first), f is the outer function (you plug g’s output into f). This is exactly f ∘ g or f(g(x)) from the CED. 2. Compute the inner value: find g(2). 3. Use that result as the input to f: compute f(g(2)). 4. Check domain restrictions: make sure g(2) is in the domain of f (CED 2.7.A.1). Example: f(x) = 2x + 3 and g(x) = x^2 − 1. - g(2) = 2^2 − 1 = 3. - f(g(2)) = f(3) = 2(3) + 3 = 9. Remember composition isn’t commutative: f(g(2)) usually ≠ g(f(2)). If you want more practice or a refresher on terminology (inner/outer, domain issues), check the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and try problems from the unit practice set (https://library.fiveable.me/practice/ap-pre-calculus).

I don't understand why f(g(x)) and g(f(x)) give different answers - aren't they the same thing?

Short answer: they’re different because composition isn’t commutative—the inner function’s outputs become the outer function’s inputs, so order matters. Why that happens (quick): - In f(g(x)), g is the inner function and f is the outer. You first compute g(x), then plug that result into f. In g(f(x)) you do the opposite. Different steps → different formulas/values (CED 2.7.A.1–3). - Example: f(x)=x+1 and g(x)=2x. f(g(x)) = (2x)+1 = 2x+1, but g(f(x)) = 2(x+1)=2x+2. They’re not equal because the operations happen in different order. - Domain note: sometimes one composite is undefined where the other is fine. Example: f(x)=ln x and g(x)=x−1. f(g(x)) = ln(x−1) needs x>1, but g(f(x)) = ln x −1 needs x>0 (different domains). For AP: you’ll be asked to evaluate and state domain restrictions and to show f∘g ≠ g∘f in many problems (CED 2.7.A.1–3). Want practice? Check the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and try problems on the Unit 2 page (https://library.fiveable.me/ap-pre-calculus/unit-2).

How do I decompose a complicated function like h(x) = √(3x + 5) into simpler functions?

Think of h(x)=√(3x+5) as an outer function applied to an inner function. A simple decomposition is: - inner g(x) = 3x + 5 - outer f(u) = √u (so f(u) = u^(1/2)) Then h(x) = f(g(x)) = f(3x+5). That’s exactly the substitution idea in the CED (replace every x in f by g(x)). You can break it down further if you want to track transformations: - g1(x) = 3x (horizontal scaling), g2(u) = u + 5 (horizontal shift), f(v) = √v, so h(x) = f(g2(g1(x))) = √((3x)+5). Don’t forget domain restriction from 2.7.A.1: the expression under the square root must be ≥0, so 3x+5 ≥ 0 ⇒ x ≥ −5/3. Also remember composition isn’t commutative: f(g(x)) ≠ g(f(x)) in general. For more on composition and practice problems aligned to the AP CED, check the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and lots of practice questions (https://library.fiveable.me/practice/ap-pre-calculus).

What's the identity function and why does it matter for composition?

The identity function is f(x) = x. It just returns its input unchanged, so when you plug it into any other function it does nothing: for any function g, g(f(x)) = g(x) and f(g(x)) = g(x). That’s why the CED calls f(x)=x the identity function—it’s the “do-nothing” element for composition (like 0 for addition or 1 for multiplication). Why it matters for composition: - It shows how composition can have a neutral element: composing with the identity leaves the inner/outer function unchanged (useful when you decompose or rebuild functions). - It clarifies domain thinking: (f∘g)(x)=f(g(x)) is only defined when g(x) lands in f’s domain—even if one of them is the identity, you still check domains. - It helps when rewriting functions as compositions (Topic 2.7.C) and when evaluating compositions for given values (2.7.A), which are tested on the AP exam. If you want practice, check the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and the AP Precalc practice problems (https://library.fiveable.me/practice/ap-pre-calculus).

When I'm given graphs of f and g, how do I find values of the composite function?

Look at the two graphs as a two-step machine: first run x through g, then take g(x) and run it through f. Practically: 1. Pick the input x. Use g’s graph to find y = g(x) (read the point, watch for open vs closed dots). 2. Check that this y is in f’s domain (no hole/asymptote at that x-value). If it’s not, f(g(x)) is undefined. 3. Use f’s graph to evaluate f(y). That value is (f∘g)(x) = f(g(x)). 4. If graphs are rough, estimate and state your approximation (give 2–3 decimal places if needed). Remember composition isn’t commutative: f(g(x)) ≠ g(f(x)) in general. On the AP exam you may be asked to do this from graphical representations (CED 2.7.A.2), so pay attention to domain restrictions and open/closed points. For a quick refresher and practice, see the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and try practice problems (https://library.fiveable.me/practice/ap-pre-calculus).

How do I write a function as a composition when it involves transformations like shifting or stretching?

Start by spotting which operation changes the input (inside) and which changes the output (outside). Write the inner function g(x) to capture horizontal shifts/dilations (things that act on x), and write the outer function f(u) to capture vertical shifts/dilations (things that act on the value u = g(x)). Then f∘g means f(g(x)). Quick steps: 1. Identify horizontal moves: x → x + k (shift), x → b·x (horizontal dilation). Those belong in g(x). 2. Identify vertical moves: multiply the whole function by a, or add c. Those belong in f(u). 3. Substitute: replace every x in f(u) with g(x). Examples: - h(x) = 2·√(x − 3) + 4. Let g(x) = x − 3 (horizontal shift), f(u) = 2·√u + 4. Then h = f∘g. - h(x) = 3·f(2x + 1) (if you already have base f): inner g(x) = 2x + 1, outer is 3·[ ]. Remember domain: (f∘g)(x) only works where g(x) is in domain of f (CED 2.7.A.1). On the AP exam you’ll often be asked to rewrite analytically by substitution (CED 2.7.B/C). For more examples and practice, check the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and try problems from the unit page (https://library.fiveable.me/ap-pre-calculus/unit-2).

Why do I need to worry about domain restrictions when composing functions?

You need to worry about domain restrictions because when you do f∘g (f(g(x))), the outputs of the inner function g must be valid inputs for the outer function f. In CED terms: the domain of f∘g is only those x in the domain of g for which g(x) lies in the domain of f (2.7.A.1). If you skip that, you might try to evaluate something that’s undefined. Quick example: f(x)=√x and g(x)=x−4. g is defined for all real x, but f∘g(x)=√(x−4) requires x−4 ≥ 0, so the domain of f∘g is x ≥ 4. Also remember composition isn’t commutative: g∘f may have a different domain. On the AP, unless stated otherwise, assume domain = real x where the expression is real, and always check the inner output against the outer’s domain when evaluating or constructing compositions (CED 2.7.A, 2.7.B). For a quick review and practice, see the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and try more problems at (https://library.fiveable.me/practice/ap-pre-calculus).

What's the step-by-step process for finding f(g(x)) algebraically?

Step-by-step (algebraic) process for f(g(x))—clear and testable: 1. Identify inner and outer functions. Decide which function is g(x) (inner) and which is f(x) (outer). Remember composition is not commutative: f(g(x)) ≠ g(f(x)) in general (CED 2.7.A.3). 2. Write f in a form ready for substitution. If f(x) = expression in x (e.g., f(x)=2x+3 or f(x)=ln x), underline every x in that expression—those x’s will be replaced. 3. Substitute g(x) for every x in f. Algebraically replace each x in f(x) with the whole expression g(x). That gives f(g(x)) per CED 2.7.B.2. 4. Simplify the result. Expand, combine like terms, use exponent/log rules, etc., to get a simplified analytic form (CED 2.7.B.2). 5. Determine the domain. Start with domain of g (inputs allowed). Then restrict to those x for which g(x) lands in the domain of f (CED 2.7.A.1). State domain explicitly. Quick example: f(x)=√x, g(x)=x−2. Then f(g(x)) = √(x−2). Domain: x−2 ≥ 0 → x ≥ 2. Practice this on AP-style problems (you’ll be asked to evaluate compositions and state domains). For extra review, see the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and try problems at (https://library.fiveable.me/practice/ap-pre-calculus).

How do I know if I can compose two functions or if there's a domain issue?

You can compose f ∘ g only for x-values in the domain of g that produce outputs g(x) lying inside the domain of f. In AP language: the domain of f∘g is {x in domain(g) | g(x) ∈ domain(f)}. Quick checklist (use every time): 1. Find domain(g) (where g(x) is real). 2. Find domain(f). 3. Solve the condition g(x) ∈ domain(f) (that may give inequalities or excluded points). 4. Intersect that solution with domain(g)—that intersection is the domain of f∘g. Example: f(x)=√x (domain x≥0), g(x)=x−2 (domain all reals). For f(g(x)) = √(x−2) you need x−2 ≥ 0 → x ≥ 2. So domain of f∘g is [2, ∞). Remember composition is not commutative: g∘f might be different and have a different domain. On the AP exam assume “domain” means all real x that make the expression real unless told otherwise (CED 2.7.A.1). For more practice and worked examples, see the Topic 2.7 study guide (https://library.fiveable.me/ap-pre-calculus/unit-2/composition-functions/study-guide/glFlt2HgsCSjvjSL) and Unit 2 resources (https://library.fiveable.me/ap-pre-calculus/unit-2). For extra practice problems, try the practice page (https://library.fiveable.me/practice/ap-pre-calculus).