STEMviz
Mathematics · Functions, Equations and Trigonometry

Composite Functions and Inverse Functions

Builds composite functions by chaining two rules together and defines the inverse function as the one-to-one function's exact reverse, with algebraic methods for both.

Composite Functions and Inverse Functions

Chapter 1 established what a function is and how to find its domain and range. This chapter develops two ways of combining or undoing functions: building a new function by feeding the output of one function into another (composition), and reversing a function entirely so that effect and cause swap places (the inverse function). Both ideas recur constantly for the rest of the course — composition is the algebraic engine behind the chain rule in Block D, and the inverse-function relationship underlies logarithms, inverse trigonometric functions and every "solve for the input" problem you will meet.

You need the domain/range toolkit from Chapter 1, confident algebraic manipulation, and the horizontal line test. Nothing here requires calculus.

1. Composite Functions: Definition

Given two functions ff and gg, the composite function f∘gf \circ g (read "ff of gg", or "ff composed with gg") is defined by

(f∘g)(x)=f(g(x))(f \circ g)(x) = f(g(x))

The instruction is to evaluate gg first, then feed that entire output into ff. Composition is not multiplication — f∘gf \circ g is a new function built by chaining two machines, not by multiplying f(x)f(x) and g(x)g(x) together.

Worked example 1. Let f(x)=x2+1f(x) = x^2 + 1 and g(x)=2x−3g(x) = 2x - 3. Find (f∘g)(x)(f\circ g)(x) and (g∘f)(x)(g \circ f)(x).

(f∘g)(x)=f(g(x))=f(2x−3)=(2x−3)2+1=4x2−12x+9+1=4x2−12x+10(f\circ g)(x) = f(g(x)) = f(2x-3) = (2x-3)^2 + 1 = 4x^2 - 12x + 9 + 1 = 4x^2-12x+10 (g∘f)(x)=g(f(x))=g(x2+1)=2(x2+1)−3=2x2−1(g\circ f)(x) = g(f(x)) = g(x^2+1) = 2(x^2+1) - 3 = 2x^2 - 1

Key distinction. In general f∘g≠g∘ff\circ g \neq g \circ f — composition is not commutative. The example above gives two different quadratics, which settles the question for this pair, but it is worth remembering as a general rule, not a coincidence of this example.

2. Evaluating a Composite Function at a Number

To evaluate (f∘g)(a)(f\circ g)(a) for a specific number aa, two routes give the same answer: substitute aa into the simplified formula for f∘gf\circ g, or work from the inside out, computing g(a)g(a) first and then applying ff to that result.

Worked example 2. Using ff and gg from Example 1, find (f∘g)(3)(f\circ g)(3) by both routes.

Inside-out: g(3)=2(3)−3=3g(3) = 2(3)-3 = 3, then f(3)=32+1=10f(3) = 3^2+1 = 10.

Formula first: (f∘g)(x)=4x2−12x+10(f\circ g)(x) = 4x^2-12x+10, so (f∘g)(3)=4(9)−36+10=36−36+10=10(f\circ g)(3) = 4(9)-36+10 = 36-36+10=10.

Both give 1010. The inside-out method is usually faster for a single numerical evaluation; the simplified formula is better when (f∘g)(f\circ g) must be evaluated repeatedly or analysed further (e.g. for its own domain or range).

3. The Domain of a Composite Function

The domain of f∘gf\circ g is more subtle than it looks, because two conditions must both hold: xx must be a valid input to gg, and the resulting output g(x)g(x) must be a valid input to ff.

Definition. domain(f∘g)={x∈domain(g):g(x)∈domain(f)}\text{domain}(f\circ g) = \{x \in \text{domain}(g) : g(x) \in \text{domain}(f)\}.

Worked example 3. Let f(x)=xf(x) = \sqrt{x} (domain x≥0x\geq0) and g(x)=x−5g(x) = x - 5 (domain R\mathbb{R}). Find the domain of (f∘g)(x)=x−5(f\circ g)(x) = \sqrt{x-5}.

Every real xx is a valid input to gg, so the first condition imposes no restriction. But the output g(x)=x−5g(x)=x-5 must lie in the domain of ff, i.e. g(x)≥0g(x) \geq 0:

x−5≥0⟹x≥5x - 5 \geq 0 \quad\Longrightarrow\quad x \geq 5

So domain(f∘g)=[5,∞)\text{domain}(f\circ g) = [5,\infty) — exactly what direct inspection of x−5\sqrt{x-5} would also give, confirming the two-condition rule is consistent with the shortcut of just finding the domain of the simplified formula. The shortcut can fail, however, when algebraic simplification removes a restriction that genuinely belongs to the composite (see the pitfalls section).

4. Decomposing a Function into Components

The reverse operation — recognising that a given function is really a composite of two simpler functions — is a skill needed constantly in Block D (the chain rule) and useful here for simplifying complicated expressions.

Worked example 4. Express h(x)=3x2+7h(x) = \sqrt{3x^2+7} as a composite f(g(x))f(g(x)) of two simpler functions.

The "last operation performed" when evaluating hh at a number is taking a square root — everything else happens first, inside the root. So let the inner function be the expression under the root, and the outer function be the operation applied to it:

g(x)=3x2+7,f(x)=x⟹f(g(x))=3x2+7=h(x)g(x) = 3x^2+7, \qquad f(x) = \sqrt{x} \qquad \Longrightarrow \qquad f(g(x)) = \sqrt{3x^2+7} = h(x)

This decomposition is not unique — g(x)=x2g(x)=x^2 and f(x)=3x+7f(x)=\sqrt{3x+7} also reconstruct hh correctly: f(g(x))=3x2+7=h(x)f(g(x))=\sqrt{3x^2+7}=h(x). However, not every superficially plausible split works — e.g. g(x)=3xg(x)=3x and f(x)=x2+7f(x)=\sqrt{x^2+7} give f(g(x))=9x2+7≠h(x)f(g(x))=\sqrt{9x^2+7}\neq h(x) — so always verify a proposed decomposition by recomposing it.

5. The Inverse of a Function: Definition and Existence

The inverse function f−1f^{-1} of ff "undoes" ff: it takes an output of ff back to the input that produced it.

Definition. If ff is one-to-one, its inverse f−1f^{-1} is the function satisfying f−1(f(x))=xf^{-1}(f(x)) = x for every xx in the domain of ff, and f(f−1(y))=yf(f^{-1}(y)) = y for every yy in the range of ff.

The requirement that ff be one-to-one (Chapter 1, the horizontal line test) is not a technicality — it is forced by the definition of a function. If some output y0y_0 were produced by two different inputs x1≠x2x_1 \neq x_2, then f−1(y0)f^{-1}(y_0) would have to equal both x1x_1 and x2x_2 simultaneously, which is impossible for a function (exactly one output per input). This is why f(x)=x2f(x)=x^2 on all of R\mathbb{R} has no inverse function, while f(x)=x2f(x)=x^2 restricted to x≥0x\geq0 does.

Two further facts follow directly from the definition:

  • domain(f−1)=range(f)\text{domain}(f^{-1}) = \text{range}(f) and range(f−1)=domain(f)\text{range}(f^{-1}) = \text{domain}(f) — inverting a function swaps the roles of domain and range exactly.
  • The graphs of ff and f−1f^{-1} are reflections of each other in the line y=xy=x, because if (a,b)(a,b) lies on the graph of ff (so f(a)=bf(a)=b), then (b,a)(b,a) lies on the graph of f−1f^{-1} (so f−1(b)=af^{-1}(b)=a) — and reflecting a point in y=xy=x swaps its coordinates exactly.

6. Finding the Inverse of a Function Algebraically

The standard algebraic procedure has three steps: write y=f(x)y=f(x); swap xx and yy; solve the new equation for yy.

Worked example 5 (the routine case). Find f−1(x)f^{-1}(x) for f(x)=3x+7f(x) = 3x+7.

y=3x+7→swapx=3y+7→solve for yy=x−73y = 3x+7 \quad\xrightarrow{\text{swap}}\quad x = 3y+7 \quad\xrightarrow{\text{solve for } y}\quad y = \frac{x-7}{3}

So f−1(x)=x−73f^{-1}(x) = \dfrac{x-7}{3}. Check: f(f−1(x))=3(x−73)+7=x−7+7=xf(f^{-1}(x)) = 3\left(\dfrac{x-7}{3}\right)+7 = x-7+7=x. ✓.

Worked example 6 (the edge case — domain restriction required). Find f−1(x)f^{-1}(x) for f(x)=x2+4f(x) = x^2+4, x≥0x \geq 0, and state its domain.

ff restricted to x≥0x\geq0 is one-to-one (Chapter 1), so an inverse exists on this restricted domain. Swap and solve:

y=x2+4, x≥0→swapx=y2+4, y≥0→solvey=x−4y = x^2+4,\ x\geq0 \quad\xrightarrow{\text{swap}}\quad x = y^2+4,\ y\geq0 \quad\xrightarrow{\text{solve}}\quad y = \sqrt{x-4}

Taking the positive square root when solving x=y2+4x=y^2+4 is the critical step — it is forced by the restriction y≥0y\geq0 carried over from the original domain of ff, not a free choice. Omitting this restriction gives y=±x−4y=\pm\sqrt{x-4}, which is not even a function. So f−1(x)=x−4f^{-1}(x) = \sqrt{x-4} with domain x≥4x\geq4 — which, consistent with the domain/range-swapping rule above, is exactly range(f)\text{range}(f).

7. Verifying an Inverse

Because the swap-and-solve procedure involves irreversible-looking algebraic steps (squaring, taking reciprocals), an inverse found this way should be checked by confirming both composition identities:

f−1(f(x))=xandf(f−1(x))=xf^{-1}(f(x)) = x \qquad \text{and} \qquad f(f^{-1}(x)) = x

Checking only one direction is not sufficient in general (though for most functions met at this level, if one direction works algebraically the other does too) — but the habit of checking matters more for catching an arithmetic slip during the solve step than for a genuine logical gap.

Common Exam Pitfalls

  • Writing f∘gf\circ g as f(x)⋅g(x)f(x)\cdot g(x). Composition means substitution of one whole function into another, never multiplication of the two formulas.
  • Assuming composition is commutative. f∘gf\circ g and g∘fg\circ f are generally different functions; always compute the one actually asked for, in the stated order.
  • Ignoring the inner restriction on the domain of a composite. Even if the simplified formula for f∘gf\circ g looks unrestricted, a restriction coming from domain(f)\text{domain}(f) on the output of gg can still apply before any algebraic simplification occurs.
  • Treating f−1(x)f^{-1}(x) as 1f(x)\dfrac{1}{f(x)}. The −1-1 superscript on a function name denotes the inverse function, not a reciprocal — these are unrelated operations that happen to share notation.
  • Forgetting that a function needs to be one-to-one before an inverse function exists. Applying the swap-and-solve procedure to a non-one-to-one function (like unrestricted x2x^2) produces a relation, not a function — check or impose one-to-one-ness first.
  • Dropping the sign restriction carried from the original domain when solving for yy after a squaring step. This restriction is not optional — it is what makes the resulting inverse a genuine function rather than a two-valued relation.

Summary

  • The composite function (f∘g)(x)=f(g(x))(f\circ g)(x) = f(g(x)) applies gg first, then ff to the result; composition is not commutative in general.
  • domain(f∘g)={x∈domain(g):g(x)∈domain(f)}\text{domain}(f\circ g) = \{x\in\text{domain}(g) : g(x)\in\text{domain}(f)\} — both the input to gg and the output of gg (as an input to ff) must be valid.
  • A function has an inverse function f−1f^{-1} exactly when it is one-to-one; f−1(f(x))=xf^{-1}(f(x))=x and f(f−1(y))=yf(f^{-1}(y))=y.
  • Domain and range swap under inversion: domain(f−1)=range(f)\text{domain}(f^{-1})=\text{range}(f), range(f−1)=domain(f)\text{range}(f^{-1})=\text{domain}(f); the graphs of ff and f−1f^{-1} are reflections of each other in y=xy=x.
  • To find f−1f^{-1} algebraically: write y=f(x)y=f(x), swap xx and yy, solve for yy — carrying forward any sign restriction from the original domain when a square root appears.
  • Verify an inverse by checking f−1(f(x))=xf^{-1}(f(x))=x and f(f−1(x))=xf(f^{-1}(x))=x.