Composition of Functions

Definitionnoun phrase

What is a composition of functions?

A composition of functions applies one function to the output of another. The composite f(g(x)), also written (f ∘ g)(x), means: find g(x) first, then put that result into f. If g(x) = x + 1 and f(x) = x2, then f(g(2)) = f(3) = 9. Order matters.

In Spanish
composición de funciones
Also called
composite function, function composition, f of g of x, f circle g
Grade level
Algebra 2
Algebra 2PrecalculusCCSS HSF-BF.A.1.cSATACTACCUPLACERPSAT

Composition of Functions in a picture

Composition f of g versus g of fTop: 3 goes into g(x) = 2x + 1 to give 7, then 7 goes into f(x) = x squared to give 49. Bottom: 3 goes into f first to give 9, then into g to give 19. The results differ, so order matters.f(g(3)): do g first, then f3gg(x) = 2x + 17ff(x) = x²output 49g(f(3)): do f first, then g3ff(x) = x²9gg(x) = 2x + 1output 1949 ≠ 19: the order matters
In f(g(3)) the inner function g acts first. Swapping the order gives g(f(3)) = 19 instead of 49.

Formal definition and notation

For functions f and g, the composite function f ∘ g is defined by (f ∘ g)(x) = f(g(x)). Its domain is the set of all x in the domain of g for which g(x) is in the domain of f. In general f ∘ g ≠ g ∘ f, so composition is not commutative, although it is associative: f ∘ (g ∘ h) = (f ∘ g) ∘ h.

Symbol Read it as Meaning
(f ∘ g)(x) f composed with g of x, or f circle g of x the same as f(g(x))
f(g(x)) f of g of x g is the inner function (done first), f the outer
g(f(x)) g of f of x the reverse order: f first, then g

Key facts

  • Read f(g(x)) from the inside out: the function nearest x acts first.
  • Usually f(g(x)) ≠ g(f(x)). With f(x) = x2 and g(x) = 2x + 1: f(g(3)) = 49 but g(f(3)) = 19.
  • Composition is not multiplication: f(g(x)) is different from f(x) · g(x).
  • The domain of f ∘ g keeps only inputs where g(x) is allowed in f.
  • A function and its inverse undo each other: f(f−1(x)) = x.
  • The derivative of a composition is found with the chain rule.

Composite function

Composite function
(f ∘ g)(x) = f(g(x))
g
the inner function: it acts on x first
f
the outer function: it acts on the output g(x)

Work from the inside out. To find a formula, replace every x in f with the whole expression g(x), in parentheses.

Try it: g first, then f

Interactive

This machine is the composite f(g(x)) with g(x) = 2x + 1 and f(x) = x2: it multiplies by 2, adds 1, then squares. It has already run 3 (output 49). Try other inputs and check each by hand: first g, then f.

This interactive needs JavaScript. The worked examples below show the same ideas step by step.

Composition of Functions examples, step by step

Example 1: Evaluate a composite at a number

Warm-up

Let f(x) = x + 5 and g(x) = 3x. Find f(g(2)).

  1. Inner first: g(2) = 3 · 2 = 6.
  2. Then the outer function: f(6) = 6 + 5 = 11.

Answer: f(g(2)) = 11

Example 2: Formulas in both orders

Core

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

  1. f(g(x)) = f(x + 3) = (x + 3)2 − 1.
  2. Expand: x2 + 6x + 9 − 1 = x2 + 6x + 8.
  3. g(f(x)) = g(x2 − 1) = (x2 − 1) + 3 = x2 + 2.
  4. The two results are different functions.

Answer: f(g(x)) = x2 + 6x + 8 and g(f(x)) = x2 + 2.

Example 3: Discount, then tax

Test-style

A store takes 10 dollars off a price p: d(p) = p − 10. Sales tax multiplies a price by 1.08: t(p) = 1.08p. The tax is charged after the discount. What does a 60 dollar item cost?

  1. Tax after discount means t(d(p)): d is inside.
  2. Discount first: d(60) = 50.
  3. Then tax: t(50) = 1.08 × 50 = 54.
  4. Compare d(t(60)) = 64.80 − 10 = 54.80: the order changes the price.

Answer: The item costs 54 dollars.

Common mistakes

✗ Mistakef(g(x)) with f(x) = x2, g(x) = x − 1: x2 − 1.
✓ Insteadf(g(x)) = (x − 1)2 = x2 − 2x + 1.

x2 − 1 is g(f(x)), the other order. In f(g(x)), the whole g(x) gets squared.

✗ Mistakef(g(x)) = f(x) · g(x).
✓ Insteadf(g(x)) means g(x) is the input of f.

Composition chains two functions; multiplying their outputs is a different operation, (fg)(x).

✗ MistakeWith f(x) = 2x, g(x) = x + 4: f(g(x)) = 2x + 4.
✓ Insteadf(g(x)) = 2(x + 4) = 2x + 8.

Substitute g(x) in parentheses so the whole expression is doubled, not just the x.

Not to be confused with

Composition of Functionsvs.Product of functions

(fg)(x) = f(x) · g(x) multiplies outputs; (f ∘ g)(x) = f(g(x)) feeds one output into the other function. With f(x) = x + 1, g(x) = 2x at x = 3: product 24, composition 7.

Composition of Functionsvs.Inverse function

An inverse undoes a function, and composing them gives back the input: f(f−1(x)) = x. A general composition just chains two functions.

Quick check: 3 questions

Question 1 of 3

If f(x) = 2x and g(x) = x − 4, what is f(g(10))?

Show answer and explanation

Answer: B. g(10) = 6, then f(6) = 12. 16 is g(f(10)), the reverse order; 120 multiplies f(10) · g(10); 6 stops after g.

Question 2 of 3

If f(x) = x2 and g(x) = x − 1, what is f(g(x))?

Show answer and explanation

Answer: C. Replace x in f with g(x) = x − 1: (x − 1)2. x2 − 1 is g(f(x)), and x3 − x2 is the product f(x) · g(x).

Question 3 of 3

Using h(x) = √x and k(x) = x + 9, what is h(k(16))?

Show answer and explanation

Answer: A. k(16) = 25, and h(25) = 5. 13 is k(h(16)) = 4 + 9, 25 stops after k, and 7 adds the square roots of 16 and 9.

Composition of Functions: frequently asked questions

What does f(g(x)) mean?

It means “f of g of x”: take an input x, apply g to it, and then apply f to the result. The output of g becomes the input of f. For g(x) = x − 2 and f(x) = 5x, f(g(7)) = f(5) = 25. The notation (f ∘ g)(x) means exactly the same thing.

Is f(g(x)) the same as g(f(x))?

Usually not. The order of the steps changes the answer. With f(x) = x + 3 and g(x) = x2, f(g(2)) = 4 + 3 = 7, while g(f(2)) = 52 = 25. They agree only in special cases, such as when one function is the inverse of the other or when both just add constants.

How do you find the domain of a composite function?

Start with the domain of the inner function g, then remove any x whose output g(x) is not allowed in f. For f(x) = √x and g(x) = x − 5, the composite √x − 5 needs x − 5 ≥ 0, so the domain is x ≥ 5, even though g itself accepts every number.

Practice and tools

Sources

  1. Common Core State Standards, High School Functions, Building Functions (HSF-BF.A.1.c, HSF-BF.B.4)
  2. OpenStax, College Algebra 2e, 3.4 Composition of Functions

Updated November 2026·Reviewed by the Effortless Math team·Standards: CCSS HSF-BF.A.1.c

Cite this entry

Effortless Math Team. “Composition of Functions.” Effortless Math Dictionary. Updated November 2026. https://www.effortlessmath.com/math-dictionary/composition-of-functions/

Flashcard

TermComposition of Functionsf(g(x))
DefinitionFeeding the output of one function into another: do the inner function first. With g(x) = x + 1, f(x) = x2: f(g(2)) = 9.
Study the full deck

Browse all terms in the Math Dictionary · More functions terms · Random term