Canadian flagMath101 · Independent Ontario learning libraryCreated and edited by Kamran
AlgebraGrades 9–124 min read

Function Composition

Function composition sends an input through one function and then uses that output as the input of another.

Cheat sheet
Composition builds a multi-step process by placing one function inside another.

Reading the notation

The composition of $f$ with $g$ is written

$$ (f\circ g)(x)=f(g(x)). $$

Read it from right to left: apply $g$ first, then apply $f$ to the result. The circle is not multiplication. It signals that one output feeds another input.

A machine interpretation

Imagine $g$ as the first machine and $f$ as the second. An input $x$ enters $g$, producing $g(x)$. That entire expression then enters $f$.

If $g$ converts hours to kilometres and $f$ converts kilometres to cost, then $f\circ g$ converts hours directly to cost. Composition turns linked relationships into one function.

Evaluating from values or a table

To find $(f\circ g)(2)$, first find $g(2)$. Suppose $g(2)=5$. Then look for $f(5)$. If $f(5)=-1$, the composition equals $-1$.

The intermediate value must be a valid input for $f$. A table may contain $g(2)$ but not contain the necessary row for $f(g(2))$; in that case the composition cannot be evaluated from the supplied data.

Finding a composition formula

Replace every $x$ in the outside function with the complete inside function. Parentheses are essential.

If

$$ f(x)=2x+3,\qquad g(x)=x^2-1, $$

then

$$ (f\circ g)(x)=f(x^2-1)=2(x^2-1)+3=2x^2+1. $$

Changing the order gives a different result:

$$ (g\circ f)(x)=g(2x+3)=(2x+3)^2-1. $$

Composition is generally not commutative.

Worked example with careful substitution

Domain restrictions

An input belongs to the domain of $f\circ g$ only when two conditions hold:

  1. $x$ is allowed by $g$;
  2. the output $g(x)$ is allowed as an input to $f$.

For example, if $f(x)=\sqrt{x}$ and $g(x)=x-5$, then

$$ (f\circ g)(x)=\sqrt{x-5} $$

requires $x\ge5$. The domain is not automatically the intersection of the original domains; the inside output condition matters.

Composition and inverse functions

Inverse functions are special because they undo one another under composition:

$$ (f\circ f^{-1})(x)=x,qquad(f^{-1}\circ f)(x)=x $$

on the appropriate domains. This identity is the strongest algebraic check that two candidate formulas are inverses.

Decomposing a function

Sometimes a complicated function can be recognized as a composition. For

$$ h(x)=\sqrt{5x+1}, $$

one choice is $g(x)=5x+1$ and $f(x)=\sqrt{x}$, so $h=f\circ g$. Decomposition helps explain transformations and prepares for the chain rule in calculus.

There may be more than one valid decomposition, depending on which meaningful steps are isolated.

Modelling chained relationships

Suppose a taxi distance is $d(t)=40t$ kilometres after $t$ hours, and fuel cost is $C(d)=0.18d$ dollars for distance $d$. Then

$$ (C\circ d)(t)=0.18(40t)=7.2t. $$

The composite model converts hours directly to fuel cost. Tracking units through the chain helps confirm the order.

Common mistakes

Applying the left function first. In $f\circ g$, $g$ acts first.

Multiplying $f(x)g(x)$. Composition is substitution, not multiplication.

Dropping parentheses. $f(3x-2)$ requires replacing every input with the entire expression.

Assuming $f\circ g=g\circ f$. Test the two orders separately.

Ignoring the inside output restriction. A composite can have a narrower domain.

Quick self-check

  • Which function acts first?
  • Did I substitute the complete inside expression with parentheses?
  • Are all intermediate outputs valid inputs for the next function?
  • Does the order match the real-world units or process?
  • If checking inverses, do both compositions return $x$?
Check your understanding

Try it yourself

Hints are part of learning. Open one whenever it makes the next step feel possible.

1 practice question
Question 1Compose two functions · Gentle

Let f(x) = 2x + 3 and g(x) = x² − 1. What is (f ∘ g)(x)?

End of lesson

Nice work making it this far.

Understanding grows through return visits. Save this lesson, try the practice, or continue when you are ready.

Lesson complete

That one is yours now.

Function Composition is saved to My Learning. Take the win—you earned it.

1Your Math101 collectionlesson completed
Search 464 published lessons, 123 answer guides, courses, and learning tools.
Your experience

Settings

Ontario math tutoringWork with KamranBook ↗