Skip to main content

Unit 2 · Topic 2.7

2.7 Composition of Functions

Composing functions means feeding the output of one function into another: f(g(x)) runs g first, then f. You'll compute compositions from formulas, tables and graphs, find their domains, and break complicated functions into simpler pieces.

Key terms

  • composition
  • composite function
  • inner and outer function
  • identity function

What f(g(x)) means

The composite function f ∘ g, read “f composed with g,” sends an input x through g first and then sends that output through f: (f ∘ g)(x) = f(g(x)). g is the inner function and f is the outer function.

Work from the inside out. To find f(g(2)), first find g(2), then plug that number into f.

Order matters

Composition is not commutative: f(g(x)) and g(f(x)) are usually different. Putting on socks and then shoes is not the same as shoes and then socks.

Composition is also different from multiplication. f(g(x)) is not f(x) · g(x).

Formulas, tables and graphs

With formulas: replace every x in f with the whole expression g(x). If f(x) = x² − 1 and g(x) = 2x + 3, then f(g(x)) = (2x + 3)² − 1.

With tables or graphs: read the value of g, then look up that value as an input to f. A table of f ∘ g can be built point by point: for each x, record (x, f(g(x))).

The domain of a composition

x must be in the domain of g, and g(x) must be in the domain of f. So the domain of f ∘ g contains only the inputs of g whose outputs f can accept.

Example: f(x) = √x and g(x) = x − 5. f(g(x)) = √(x − 5) needs x − 5 ≥ 0, so the domain is x ≥ 5.

The identity function and decomposition

The identity function I(x) = x leaves every input unchanged, so f(I(x)) = I(f(x)) = f(x). It plays the role that 0 plays in addition and 1 plays in multiplication.

Decomposition runs the other way: write a complicated function as a composition of simpler ones. h(x) = (3x − 1)⁴ is f(g(x)) with g(x) = 3x − 1 and f(x) = x⁴. Done properly, the inner function's expression replaces every x in the outer function.

Transformations are compositions too. f(x) + k is f followed by “add k,” and f(x + k) is “add k” followed by f. Likewise k · f(x) and f(kx) compose f with “multiply by k.” Composition also links two quantities without a direct formula: if area depends on radius and radius depends on time, then area as a function of time is a composition.

Worked examples

Try each one yourself first, then open the solution.

  1. Example 1

    Composing formulas

    Let f(x) = x² − 1 and g(x) = 2x + 3. Find f(g(x)) and g(f(x)).

    Show the solution
    1. Step 1: f(g(x)) = (2x + 3)² − 1 = 4x² + 12x + 9 − 1 = 4x² + 12x + 8.
    2. Step 2: g(f(x)) = 2(x² − 1) + 3 = 2x² − 2 + 3 = 2x² + 1.
    3. Step 3: The two results are different, showing that order matters.

    Answer: f(g(x)) = 4x² + 12x + 8; g(f(x)) = 2x² + 1.

  2. Example 2

    Composing from a table

    The table gives f and g at x = 0, 1, 2, 3, 4: f values 3, 4, 0, 2, 1 and g values 2, 0, 4, 1, 3, in that order. Find f(g(2)), g(f(2)) and f(f(0)).

    Show the solution
    1. Step 1: f(g(2)): g(2) = 4, then f(4) = 1.
    2. Step 2: g(f(2)): f(2) = 0, then g(0) = 2.
    3. Step 3: f(f(0)): f(0) = 3, then f(3) = 2.

    Answer: f(g(2)) = 1, g(f(2)) = 2, f(f(0)) = 2.

  3. Example 3

    Trap: domain of a composition

    Let f(x) = √x and g(x) = x − 5. Find the domain of f(g(x)), and evaluate f(g(3)) if possible.

    Show the solution
    1. Step 1: f(g(x)) = √(x − 5). The square root needs x − 5 ≥ 0, so x ≥ 5.
    2. Step 2: g(3) = −2 is a perfectly good output of g, but f can't take −2 as an input (no real square root).
    3. Step 3: So 3 is not in the domain of f ∘ g, even though it's in the domain of g.

    Answer: The domain is x ≥ 5; f(g(3)) is undefined.

Common mistakes

  • Working from the outside in. In f(g(x)), g acts first.
  • Treating f(g(x)) as the product f(x) · g(x).
  • Replacing only some of the x's when substituting. Every x in the outer function gets the whole inner expression, in parentheses.
  • Ignoring the domain: a composition can be undefined where the inner function is fine.

On the exam

  • Composition from tables and graphs shows up often in multiple choice and in the function-concepts free-response question. Write each step, such as “g(2) = 4, so f(g(2)) = f(4) = 1.”
  • Composition is the key to inverses (topic 2.8): f(f⁻¹(x)) = x.

Connected topics

Videos

  • AP Precalculus – 2.7A Composition of Functions

    The AlgebrosWatch on YouTube (opens in a new tab)

  • AP Precalculus – 2.7B Composition of Functions

    The AlgebrosWatch on YouTube (opens in a new tab)

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

    Khan AcademyWatch on YouTube (opens in a new tab)

  • Quick Review Topic 2.7 Compositions of Functions [AP Precalculus]

    Michael Porinchak - AP Statistics & AP PrecalculusWatch on YouTube (opens in a new tab)

  • 2.7-A Composition of Functions Video

    Flamingo Math by Jean AdamsWatch on YouTube (opens in a new tab)

  • Composite Functions

    The Organic Chemistry TutorWatch on YouTube (opens in a new tab)

Check yourself

4 questions on 2.7 Composition of Functions. Pick an answer to see if you got it, and why.

Question 1 of 4

Let h(x) = (2x − 1)³ + 4. If h(x) = f(g(x)) and g(x) = 2x − 1, which of the following could be f(x)?

Question 2 of 4

Let f(x) = x² − 1 and g(x) = 2x + 3. Which of the following is f(g(x))?

Question 3 of 4

The temperature of an oven, in degrees Celsius, t minutes after it is turned on is C(t). The function F(c) = 1.8c + 32 converts a temperature of c degrees Celsius to degrees Fahrenheit. Which of the following gives the temperature of the oven, in degrees Fahrenheit, 4 minutes after it is turned on?

x01234
f(x)24103
g(x)30412

Table of values

Question 4 of 4

What is the value of f(g(2))?

0 of 4 answered