Skip to content
  • Open the math solver
  • Ask the AI tutor
  • Find an AP course
  • Create a quiz
  • Open the calculator
  • Graphing Calculator
  • Browse all calculators
  • Read math guides
↑ ↓Enter to open · Esc to close
Solve a problem
PrecalculusPrecalculusHigh school

Composition of Functions

Build f(g(x)) and find its domain.

Composing functions means feeding the output of one into another: (f∘g)(x)=f(g(x))(f \circ g)(x) = f(g(x)). The inner function gg acts first. Composition models processes that happen in stages, such as converting currency and then applying a tax, and it is the structure the chain rule in calculus differentiates.

Order matters: in general f(g(x))≠g(f(x))f(g(x)) \ne g(f(x)). The domain of f∘gf \circ g contains the inputs xx that are in the domain of gg and whose output g(x)g(x) is in the domain of ff, so both layers can restrict it.

Key ideas

  • Evaluate from the inside out: compute g(x)g(x), then apply ff.
  • To build a formula, replace every xx in ff with the whole expression g(x)g(x), in parentheses.
  • Decomposing a function, such as writing x2+1\sqrt{x^2 + 1} as f(g(x))f(g(x)), is the reverse skill.
  • Check the domain of the inner function and of the result.

Worked example

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

  1. f(g(x))=(2x+3)2−1=4x2+12x+8f(g(x)) = (2x + 3)^2 - 1 = 4x^2 + 12x + 8.
  2. g(f(x))=2(x2−1)+3=2x2+1g(f(x)) = 2(x^2 - 1) + 3 = 2x^2 + 1.
  3. The two results differ, showing order matters.
  4. Spot check at x=0x = 0: f(g(0))=f(3)=8f(g(0)) = f(3) = 8 and g(f(0))=g(−1)=1g(f(0)) = g(-1) = 1.

Answer: f(g(x))=4x2+12x+8f(g(x)) = 4x^2 + 12x + 8, g(f(x))=2x2+1g(f(x)) = 2x^2 + 1

Common mistakes

  • Multiplying f(x)⋅g(x)f(x) \cdot g(x) instead of composing.
  • Applying the outer function first.
  • Dropping parentheses when substituting, as in 2x+322x + 3^2.

Practice questions

Try each one, then open the answer. Numerical answers on this page are verified by an automated calculation check.

  1. 1.With f(x)=3xf(x) = 3x and g(x)=x+4g(x) = x + 4, find f(g(2))f(g(2)).

    Show answer

    1818

  2. 2.With the same functions, find g(f(2))g(f(2)).

    Show answer

    1010

  3. 3.With f(x)=xf(x) = \sqrt{x} and g(x)=x2+9g(x) = x^2 + 9, find f(g(4))f(g(4)).

    Show answer

    55

Keep practising

More in Precalculus