Composition of Functions
The composition of functions puts one function inside another. The composition (f \circ g)(x) = f(g(x)) means: first find g(x), then use that output as the input of f. Order matters, because f(g(x)) and g(f(x)) are usually different. Composition shows up whenever one step feeds into the next, like a discount followed by sales tax.
Before this lesson: You should know Function Operations, Function Notation and Multiplying Binomials.
What Composition Means
Think of each function as a machine. A composition sends an input through two machines in a row. The output of the first machine becomes the input of the second.
(f \circ g)(x) = f(g(x))
Read f \circ g as “f composed with g” or “f of g.” The small circle is not a multiplication sign. Work from the inside out: the function next to x acts first.
Domain of a Composition
An input x is in the domain of f \circ g when two things are true:
- x is in the domain of g, so g(x) exists.
- g(x) is in the domain of f, so f can use it.
How to Compose Functions
- To evaluate f(g(a)), find g(a) first.
- Then substitute that number into f.
- To find a formula for f(g(x)), replace every x in f with the whole expression g(x), in parentheses.
- Simplify, and check the domain.
Worked Examples
In Examples 1 and 2, f(x) = 2x + 1 and g(x) = x^2 - 3.
Example 1: Evaluate a composition
Find (f \circ g)(2).
- Start inside. Find g(2): g(2) = 2^2 - 3
- Simplify: g(2) = 4 - 3 = 1
- Put the output into f: f(1) = 2(1) + 1
- Simplify: f(1) = 3
Answer: (f \circ g)(2) = 3
Example 2: Find both compositions
Find (f \circ g)(x) and (g \circ f)(x).
- For f(g(x)), replace x in f with g(x): f(g(x)) = 2(x^2 - 3) + 1
- Distribute (see distributive property): 2x^2 - 6 + 1
- Combine like terms: f(g(x)) = 2x^2 - 5
- For g(f(x)), replace x in g with f(x): g(f(x)) = (2x + 1)^2 - 3
- Square the binomial (see special products of binomials): 4x^2 + 4x + 1 - 3
- Combine like terms: g(f(x)) = 4x^2 + 4x - 2
Answer: (f \circ g)(x) = 2x^2 - 5 and (g \circ f)(x) = 4x^2 + 4x - 2. They are different, so order matters.
Example 3: Domain of a composition
Let f(x) = \sqrt{x} and g(x) = x - 5. Find f(g(x)), g(f(x)) and the domain of each.
- Replace x in f with x - 5: f(g(x)) = \sqrt{x - 5}
- The square root needs x - 5 \ge 0. Add 5 to both sides: x \ge 5. Domain: [5, \infty)
- Replace x in g with \sqrt{x}: g(f(x)) = \sqrt{x} - 5
- Here \sqrt{x} must exist first, so x \ge 0. Domain: [0, \infty)
- Check one value: f(g(9)) = \sqrt{9 - 5} = \sqrt{4} = 2
Answer: f(g(x)) = \sqrt{x - 5} with domain [5, \infty). g(f(x)) = \sqrt{x} - 5 with domain [0, \infty).
Example 4: Break a function apart
Write h(x) = (3x - 2)^4 as a composition f(g(x)).
- Ask what happens first to x: it is multiplied by 3 and then 2 is subtracted. That is the inside function: g(x) = 3x - 2
- Then the result is raised to the 4th power. That is the outside function: f(x) = x^4
- Check: f(g(x)) = (3x - 2)^4 = h(x)
Answer: g(x) = 3x - 2 and f(x) = x^4. Breaking functions apart like this is a key skill in calculus.
Example 5: Word problem with a sale
A store takes 20% off every price, then adds 6% sales tax. Write functions for each step and a composition for the final price. Find the final price of a $50 item.
- The discount keeps 80% of the price: d(p) = 0.8p
- The tax adds 6%, so it multiplies by 1.06: t(p) = 1.06p
- The discount happens first, so it is inside: t(d(p)) = 1.06(0.8p)
- Multiply the decimals: t(d(p)) = 0.848p
- Evaluate at 50: t(d(50)) = 0.848(50) = 42.4
Answer: The final price is 0.848p, so a $50 item costs $42.40.
Common Mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Working from the outside in | For f(g(2)), finding f(2) first | Start with the inside: g(2). |
| Treating ∘ as multiplication | (f \circ g)(x) = f(x) \cdot g(x) | ∘ means substitute: f(g(x)). |
| Forgetting parentheses | f(g(x)) = 2x^2 - 3 + 1 | Put g(x) in parentheses: 2(x^2 - 3) + 1. |
| Assuming order doesn’t matter | Saying f(g(x)) = g(f(x)) | Find both. They are usually different. |
| Squaring a binomial term by term | (2x + 1)^2 = 4x^2 + 1 | Include the middle term: 4x^2 + 4x + 1. |
Practice Problems
In problems 1–5, f(x) = x + 4 and g(x) = 3x^2.
- Find (f \circ g)(1).
- Find (g \circ f)(1).
- Find (f \circ g)(x).
- Find (g \circ f)(x).
- Find (f \circ f)(x).
- Let f(x) = \sqrt{x} and g(x) = x + 9. Find f(g(x)) and its domain.
- Write h(x) = \sqrt{x^2 + 1} as f(g(x)).
- Write h(x) = \frac{1}{x - 7} as f(g(x)).
- Let f(x) = x + 2 and g(x) = x - 2. Show that f(g(x)) = g(f(x)) = x.
- A ripple spreads in a pond. Its radius is r(t) = 3t cm after t seconds, and the area of a circle is A(r) = \pi r^2. Find A(r(t)) and the area after 4 seconds.
Show answers
- Inside first: g(1) = 3(1)^2 = 3
Then f: f(3) = 3 + 4 = 7 - Inside first: f(1) = 1 + 4 = 5
Then g: g(5) = 3(5)^2 = 3(25) = 75 - Replace x in f with 3x^2: f(g(x)) = 3x^2 + 4
- Replace x in g with x + 4: g(f(x)) = 3(x + 4)^2
Square the binomial: 3(x^2 + 8x + 16)
Distribute: g(f(x)) = 3x^2 + 24x + 48 - Replace x in f with x + 4: f(f(x)) = (x + 4) + 4
Combine: f(f(x)) = x + 8 - Replace x in f with x + 9: f(g(x)) = \sqrt{x + 9}
Need x + 9 \ge 0
Subtract 9 from both sides: x \ge -9. Domain: [-9, \infty) - Inside: g(x) = x^2 + 1
Outside: f(x) = \sqrt{x} - Inside: g(x) = x - 7
Outside: f(x) = \frac{1}{x} - f(g(x)) = (x - 2) + 2 = x
g(f(x)) = (x + 2) - 2 = x
Both give x. Functions that undo each other like this are inverse functions, the next lesson. - Replace r in A with 3t: A(r(t)) = \pi(3t)^2
Square: A(r(t)) = 9\pi t^2
At t = 4: 9\pi(4)^2 = 9\pi(16) = 144\pi
Use a calculator: 144\pi \approx 452.39 cm²
FAQ
What does f(g(x)) mean?
It means put x into g first, then put that output into f. It is also written (f \circ g)(x).
Is f(g(x)) the same as g(f(x))?
Usually not. In Example 2, f(g(x)) = 2x^2 - 5 but g(f(x)) = 4x^2 + 4x - 2. They are equal only in special cases, such as inverse functions.
How do you find the domain of a composite function?
Keep the inputs that work in the inside function, and whose outputs also work in the outside function. Using the simplified formula alone can miss a restriction.
How do you decompose a function?
Find the first thing that happens to x. That is the inside function g. Whatever is done to that result is the outside function f.
Summary
- (f \circ g)(x) = f(g(x)): apply g first, then f.
- To evaluate, work from the inside out. To find a formula, replace x in f with (g(x)).
- Order matters: f(g(x)) and g(f(x)) are usually different.
- The domain includes only inputs that work in g and give outputs that work in f.
Previous lesson: Function Operations
Next lesson: Inverse Functions
Back to the Algebra 2 Index