NapkinCalc

Precalculus — Functions

Composition — machines feeding machines

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

f(g(x)) wires g's output into f's input. Order matters — composition is not commutative, and the checks prove it with a concrete x:

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
✓ pass c1!=c2c_{1} != c_{2} order matters: f(g(3)) ≠ g(f(3))