๐ Key idea of this section
f(g(x)) means: run g FIRST, then feed its output into f. Read it inside-out. When linear machines chain, their slopes MULTIPLY.
What happens if you connect two machines in a row โ the chute of g pouring into the hopper of f? That chained machine is called the composition of f and g, written f(g(x)) or (f โ g)(x). The one rule you must remember: the inside machine runs first.
Let's set up two machines and watch closely:
f(x) = 2x + 1 (double, add 1) g(x) = 3x โ 2 (triple, subtract 2)
Worked example 1 โ a number through the chain. Find f(g(2)):
Step 1: g(2) = 3 ร 2 โ 2 (inside machine g runs first) Step 2: g(2) = 6 โ 2 = 4 (multiply, then subtract) Step 3: f(g(2)) = f(4) (feed g's output into f) Step 4: f(4) = 2 ร 4 + 1 = 9 (run f's recipe on 4)
So f(g(2)) = 9. The number 2 went into g, came out as 4, went into f, came out as 9.
Worked example 2 โ the chain's own formula. What recipe does the chained machine f(g(x)) follow?
Step 1: f(g(x)) = 2 ร g(x) + 1 (f doubles ITS input, whatever it is) Step 2: f(g(x)) = 2(3x โ 2) + 1 (g(x) IS 3x โ 2 โ substitute it in) Step 3: f(g(x)) = 6x โ 4 + 1 (distribute: 2ร3x = 6x, 2ร(โ2) = โ4) Step 4: f(g(x)) = 6x โ 3 (combine: โ4 + 1 = โ3)
Test drive with x = 2: 6 ร 2 โ 3 = 12 โ 3 = 9 โ โ matches example 1, as it must.
Worked example 3 โ the OTHER order. Find g(f(x)):
Step 1: g(f(x)) = 3 ร f(x) โ 2 (g triples ITS input, then takes 2) Step 2: g(f(x)) = 3(2x + 1) โ 2 (substitute f(x) = 2x + 1) Step 3: g(f(x)) = 6x + 3 โ 2 (distribute: 3ร2x = 6x, 3ร1 = 3) Step 4: g(f(x)) = 6x + 1 (combine: 3 โ 2 = 1)
Look carefully: f(g(x)) = 6x โ 3 but g(f(x)) = 6x + 1. Different recipes! Composition order matters. But notice something beautiful: both chains have slope 6, and 6 = 2 ร 3 โ the two slopes multiplied. That always happens:
Chain slope = (slope of f) ร (slope of g)
Why? If g multiplies every step by 3 and then f multiplies every result by 2, one step of x grows the final output by 3 ร 2 = 6. (We'll meet it again in the challenge problems โ problem 78 turns this into a detective puzzle.)
โ๏ธ Your Turn!
With f(x) = 4x โ 3 and g(x) = x + 5, find f(g(2)). Then find the formula for f(g(x)) and check your number with it.
๐ Show the answers
Answer: g(2) = 2 + 5 = 7; f(7) = 4 ร 7 โ 3 = 28 โ 3 = 25. Formula: f(g(x)) = 4(x + 5) โ 3 = 4x + 20 โ 3 = 4x + 17. Check: 4 ร 2 + 17 = 25 โ . Note the chain slope is 4 ร 1 = 4 โ g's slope is the hidden 1 in front of x.