NapkinCalc

Precalculus A — Functions & Transformations

Composition — machines feeding machines

continues from lesson 1 — values defined earlier in the course stay live here

ELI5: f(g(x)) wires g's output straight into f's input — two machines on an assembly line. Order matters: f(g(x)) is usually not the same as g(f(x)), and the check proves it with a real number.

g(x)=2x+1g\left(x\right) = 2 \cdot x + 1 a second machine
c1=f(g(3))c_{1} = \mathrm{f}\left(\mathrm{g}\left(3\right)\right) = 2828 g first: g(3) = 7, then f(7) = 28
c2=g(f(3))c_{2} = \mathrm{g}\left(\mathrm{f}\left(3\right)\right) = 11 f first: f(3) = 0, then g(0) = 1
✓ pass abs(c128)<109\mathrm{abs}\left(c_{1} - 28\right) < 10^{-9} f∘g at 3 is 28
✓ pass c1!=c2c_{1} != c_{2} order matters: f(g(3)) ≠ g(f(3))

Real-world hook: composition is a pipeline — convert miles→km, then km→fuel-needed; or quantity→cost, then cost→price.

Try it yourself: with the same f and g above, compute g(f(2)) (run f first, then g).

gof=g(f(2))gof = \mathrm{g}\left(\mathrm{f}\left(2\right)\right) = 3-3 ✏️ Your turn: compute g(f(2)). Work out f(2) first, then feed it through g.
✓ pass abs(gofg(f(2)))<109\mathrm{abs}\left(gof - \mathrm{g}\left(\mathrm{f}\left(2\right)\right)\right) < 10^{-9} green when it equals g(f(2))