Composite functions
Apply one function to the output of another, writing fg(x) as f(g(x)), and keep the order of the two rules straight.
What a learner can do afterwards
- Work out fg(2) by finding g(2) first and then applying f
- Write and simplify an expression for fg(x)
- Show with one example that fg(x) and gf(x) usually differ
1 · Read
Previously, you put a number into one rule and read off the output. A composite function combines two rules: the output of one becomes the input of the next. The notation fg(x) means apply g first, then f, and is read as f of g of x. The notation tells you the order, so keep track of which rule acts first.
The letters are read inside-out. In fg(x), g is the inner rule and f is the outer one. Always start with g: put the input into g, then put its output into f. It is tempting to start with f because f is written first, but the second letter acts first. Working inside-out helps you keep the order straight.
The composites fg(x) and gf(x) are usually not the same. Swapping the order changes which rule is on the inside, and that usually gives a different answer. Sometimes they match, but you cannot assume it. To show they differ, you need just one input that gives two different outputs.
For f(x) = 3x - 2 and g(x) = x + 4, find both orders at input 2. For fg(2), g(2) = 6, then f(6) = 16. For gf(2), f(2) = 4, then g(4) = 8. The same input gives different results when the order changes. To compare or combine two composite values, calculate both inner outputs and both outer outputs, then add or subtract the final values in the requested order.
For f(x) = 3x + 4 and g(x) = x - 3, substitute the whole inner rule: fg(x) = 3(x - 3) + 4 = 3x - 5. Check at x = 4: g(4) = 1, f(1) = 7, and 3(4) - 5 = 7. The reverse order gives gf(x) = (3x + 4) - 3 = 3x + 1. Keep brackets around the inner expression until you expand.
For f(x) = x² and g(x) = 2x - 1, test input 3. For fg(3), g(3) = 5 and f(5) = 25. For gf(3), f(3) = 9 and g(9) = 17. Since 25 differs from 17, this one input proves the composites are different. Symbolically, fg(x) = (2x - 1)², while gf(x) = 2x² - 1. When substituting into a square, square the whole inner expression.
In fg(x), apply g first, then f. For a formula, substitute the whole inner rule and simplify. Changing the order may change the result; different outputs at one input prove two composites differ.
The practice questions and readings were written for this dataset. The referenced video is by Khan Academy.
More to read
Keeping the intermediate output
For f(x) = 5x - 3 and g(x) = x + 2, calculate fg(4). The inside function gives g(4) = 6. That 6 is the input to f, so f(6) = 27.
Write the intermediate value rather than combining the functions in your head. In gf(4), the inside function changes: f(4) = 17, then g(17) = 19. The same starting input gives different final outputs.
Substituting a whole rule
Let f(x) = 4x + 2 and g(x) = x - 5. The formula fg(x) uses g's whole output as f's input: 4(x - 5) + 2 = 4x - 18.
Brackets mark the complete substituted input. They show that 4 multiplies both x and -5. In the reverse order, gf(x) = (4x + 2) - 5 = 4x - 3. Compare complete expressions after simplifying.
When the outer rule squares
For f(x) = x² - 2 and g(x) = x + 6, the composite fg(x) is (x + 6)² - 2. The square applies to the entire inner output.
Expanding gives x² + 12x + 34. Writing x² + 6² - 2 would omit the two cross products. At input 1, the pipeline gives g(1) = 7 and f(7) = 47; the expanded formula gives 1 + 12 + 34 = 47 as well.
What a numerical check proves
A mismatch at one allowed input proves that two formulas are different. A match at one input does not prove that they agree everywhere.
For example, x² and x both give zero at input 0, but at input 2 they give 4 and 2. To establish that two polynomial composite formulas are identical, expand and compare their coefficients. Numerical checks can help locate errors, while the algebraic comparison checks the full formula.
Explore more
2 · Watch
Take it off screen
Where it sits
Where this leads
Jobs that lean on this skill. Follow one to see everything it is built on.
33 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.