NapkinCalc

Algebra 2A — Functions & Quadratics

Functions — machines with one output

ELI5: a function is a machine: drop an input in, get exactly one output. Write f(x) = 2x + 1 and "f(3)" means "run 3 through the machine" → 7. Composition f(g(x)) chains two machines: run g first, feed its output into f.

ffn(x)=2x+1f_{fn}\left(x\right) = 2 \cdot x + 1 a doubling-and-add-one machine
gfn(x)=x2g_{fn}\left(x\right) = x^{2} a squaring machine
comp=ffn(gfn(3))comp = \mathrm{f_{fn}}\left(\mathrm{g_{fn}}\left(3\right)\right) = 1919 g(3) = 9, then f(9) = 19
✓ pass comp==19comp == 19 the machines chained: f(g(3)) = 19

Real-world hook: composition is pipelines — convert miles→km, then km→travel-time; or quantity→raw-cost, then cost→price-with-margin. Each stage is a machine feeding the next.

Try it yourself: with the same f and g, compute (g ∘ f)(2) = g(f(2)). (Order matters — f first this time!)

gof=25gof = 25 ✏️ Your turn: compute g(f(2)). Run f on 2 first, then square the result.
✓ pass abs(gofgfn(ffn(2)))<109\mathrm{abs}\left(gof - \mathrm{g_{fn}}\left(\mathrm{f_{fn}}\left(2\right)\right)\right) < 10^{-9} green when it equals g(f(2))