01 / 21

Compose Two
Functions

Learn how to feed one function into another to build powerful new relationships: from notation to real-world applications.

Algebra 1

What Is Function Composition?

Function composition takes the output of one function and uses it as the input of another. If you have two functions \( f \) and \( g \), the composition \( f(g(x)) \) means: first evaluate \( g(x) \), then plug that result into \( f \).

The Machine Analogy

\(x\)
\(g\)
\(g(x)\)
\(f\)
\(f(g(x))\)

Step 1: Feed \( x \) into the green machine \( g \) to get \( g(x) \).
Step 2: Feed that result into the purple machine \( f \) to get \( f(g(x)) \).

Why Does It Matter?

Weather Balloon
\( h(t) \) = height over time, \( T(y) \) = temp at height. Then \( T(h(t)) \) gives temp at the balloon's location over time.
Shopping Discount
\( C(n) \) = cost for \( n \) items, \( D(c) \) = discount on cost \( c \). Then \( D(C(n)) \) gives your final price.

The Notation

The composition of \( f \) with \( g \) is written as:

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

\( f \circ g \)
Read as "f composed with g" or "f of g of x." The small circle \( \circ \) is the composition operator.
Order Matters
\( g \) is evaluated first (inner), then \( f \) (outer). The rightmost function always acts first.

Visualizing \( f(g(x)) \)

Domain g outputs f outputs
\(x\)
\(2\)
\(g(x)\)
\(g(2)\)
\(f(g(x))\)
\(f(g(2))\)
\(g\)
\(f\)

\( f \circ g \) vs \( g \circ f \)

\( f \circ g \) \( g \circ f \)
Meaning \( f(g(x)) \) \( g(f(x)) \)
Inner function \( g \) \( f \)
Outer function \( f \) \( g \)
Generally equal? No: \( f \circ g \neq g \circ f \) in most cases

How to Evaluate a Composition

1
Identify inner and outer. In \( f(g(x)) \), the inner function is \( g \) and the outer is \( f \).
2
Substitute the inner into the outer. Everywhere the outer function has its variable, replace it with the entire inner function.
3
Simplify. Expand, combine like terms, and reduce to get your final expression.
4
Check with a number. Pick a value like \( x = 1 \), compute step-by-step both ways, and verify they match.

Example 1: Linear Composition

Let \( f(x) = 2x + 3 \) and \( g(x) = x - 1 \). Find \( (f \circ g)(x) \).

1
Write the template: \( f(g(x)) = 2(\,\underbrace{g(x)}_{\text{inner}}\,) + 3 \)
2
Substitute: \( = 2(x - 1) + 3 \)
3
Simplify: \( = 2x - 2 + 3 = 2x + 1 \)

Example 2: Composition with a Quadratic

Let \( f(x) = x^2 \) and \( g(x) = 3x + 2 \). Find \( (f \circ g)(x) \).

1
Template: \( f(g(x)) = (g(x))^2 \)
2
Substitute: \( = (3x + 2)^2 \)
3
Expand: \( = 9x^2 + 12x + 4 \)

Example 3: Both Directions

Let \( f(x) = x + 4 \) and \( g(x) = x^2 \). Compare \( f \circ g \) and \( g \circ f \).

\( (f \circ g)(x) \) \( (g \circ f)(x) \)
Setup \( f(g(x)) = g(x) + 4 \) \( g(f(x)) = (f(x))^2 \)
Substitute \( x^2 + 4 \) \( (x + 4)^2 \)
Simplified \( x^2 + 4 \) \( x^2 + 8x + 16 \)
At \( x = 2 \) 8 36

Evaluating at a Point

Given \( f(x) = 5x - 1 \) and \( g(x) = x^2 + 3 \), find \( (f \circ g)(2) \).

1
Inner first: \( g(2) = (2)^2 + 3 = 4 + 3 = 7 \)
2
Outer next: \( f(7) = 5(7) - 1 = 35 - 1 = 34 \)

Extending to Three Functions

Composition works with more than two functions. For \( (f \circ g \circ h)(x) \), evaluate right to left:

\(x\)
\(h\)
\(g\)
\(f\)
\(f(g(h(x)))\)

Domain Restrictions

When composing \( f(g(x)) \), the domain requires two conditions:

1
\( x \) must be in the domain of \( g \). The inner function must accept \( x \) as input.
2
\( g(x) \) must be in the domain of \( f \). The output of \( g \) must be valid input for \( f \).

Common Mistakes

✕ Wrong Order
Computing \( g(f(x)) \) when asked for \( f(g(x)) \). Remember: the inner function (right side of \( \circ \)) goes first.
✕ Multiplying Instead
Treating \( f \circ g \) as \( f(x) \cdot g(x) \). Composition means substitution, not multiplication.
✕ Partial Substitution
Replacing only the first \( x \) in the outer function. You must replace every occurrence of the variable.

Summary Table

Concept Details
Notation \( (f \circ g)(x) = f(g(x)) \)
Read as "f composed with g" or "f of g of x"
Order Inner (\( g \)) first, outer (\( f \)) second
Commutative? No: \( f \circ g \neq g \circ f \) generally
Domain \( x \in \text{dom}(g) \) and \( g(x) \in \text{dom}(f) \)
Key method Replace the variable in the outer with the entire inner expression

Question 1 of 5

If \( f(x) = 3x \) and \( g(x) = x + 5 \), what is \( (f \circ g)(x) \)?

Question 2 of 5

If \( f(x) = x^2 \) and \( g(x) = x - 3 \), what is \( (f \circ g)(4) \)?

Question 3 of 5

Given \( f(x) = x + 1 \) and \( g(x) = 2x \), which statement is true?

Question 4 of 5

The expression \( (f \circ g)(x) \) means:

Question 5 of 5

If \( f(x) = \sqrt{x} \) and \( g(x) = x - 9 \), what is the domain of \( (f \circ g)(x) \)?