LightMySky

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.

No account needed. Progress saves in this browser.

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

Last stop you fed a number into one rule and read off the output. This time there are two rules, and you chain them: the output of one becomes the input of the next. That is a composite function. The notation fg(x) means apply g first, then f, which you can read as f of g of x. The order is baked into the name, and keeping it straight is the whole trick of this topic.

input: 2g: x + 4, so 6f: 3x - 2, so 16output: 16
Two machines in a row: the output of g feeds straight into f.

The letters are read inside-out. In fg(x), g is the inner rule and f is the outer one, so you always start with g. Work from the inside out: feed the input into g, take that result, and feed it into f. It is tempting to read fg as f first, because f is written first, but the second letter is the one that acts first. Keep the inside-out habit and the order never trips you.

Here is the surprise that trips people up: fg(x) and gf(x) are usually not the same. Swapping the order swaps which rule sits on the inside, and a different inside usually gives a different answer. Sometimes they match, but you cannot assume it. When a question asks you to show they differ, one input that gives two different outputs is all you need.

Try it together

Find fg(2) and gf(2) for f(x) = 3x - 2 and g(x) = x + 4. For fg(2), start with g: g(2) is 2 + 4, which is 6. Now feed 6 into f: f(6) is 3(6) - 2, which is 18 - 2 = 16. So fg(2) is 16. For gf(2), start with f: f(2) is 3(2) - 2, which is 4. Feed 4 into g: g(4) is 4 + 4 = 8. So gf(2) is 8. Same input, two different outputs, because the order changed.

g(2) = 6f(6) = 3(6) - 2 = 16so fg(2) = 16f(2) = 4g(4) = 8so gf(2) = 8
Try it together

Now write the expression. For f(x) = 2x + 3 and g(x) = x - 2, find fg(x). The inside is g, so fg(x) = f(g(x)) = f(x - 2). Feed x - 2 into f: 2(x - 2) + 3 = 2x - 4 + 3 = 2x - 1. So fg(x) is 2x - 1. Check it at x = 2 by the pipeline: g(2) is 0, and f(0) is 3, and 2(2) - 1 is also 3, so they agree. For comparison, gf(x) = g(f(x)) = (2x + 3) - 2 = 2x + 1, which is different.

fg(x) = f(g(x))= f(x - 2)= 2(x - 2) + 3= 2x - 1check at x = 2: 3
Try it together

Finally, show with one number that the order matters. Take f(x) = x squared and g(x) = 2x - 1, and test the input 3. For fg(3), start with g: g(3) is 2(3) - 1 = 5. Feed 5 into f: f(5) is 5 squared = 25. For gf(3), start with f: f(3) is 3 squared = 9. Feed 9 into g: g(9) is 2(9) - 1 = 17. So fg(3) is 25 and gf(3) is 17. One input, two different outputs, and that single example is enough to show the composites differ.

fg: g(3) = 5f(5) = 25gf: f(3) = 9g(9) = 1725 is not 17

Evaluate a composite inside-out: apply the inner rule first, then feed its output into the outer rule, and remember that fg(x) and gf(x) are usually different because the order changes which rule is on the inside.

2 · Watch

Take it off screen

Print a worksheetA4 with an answer key page for grown-ups. No screen, no internet.

Where it sits

Where this leads

Jobs that lean on this skill. Follow one to see everything it is built on.

Then practise

24 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.

Spotted a problem on this page? Tell us
Composite Functions · Mathematics, ages 15 to 16 · LightMySky