LESSON 3 · Algebra Unlocked
Build a Function Chain
Pick three real functions and write them as a chain. Example: length(trim(lowercase("Hello World "))). The innermost converts to lowercase, the next trims whitespace, the outer counts characters. Output: 11.
Now try a numeric chain. Let f(x) = 2x + 1 and g(x) = x². Compute g(f(3)). First f(3) = 7. Then g(7) = 49. Now compute f(g(3)): g(3) = 9, f(9) = 19. Same inputs, different order, different answer. Composition is not commutative.
Try the inverse test. Let f(x) = 2x + 1. What function undoes it? g(x) = (x − 1) / 2. Check: g(f(5)) = g(11) = 5. Composition of inverses returns the original input every time. Five minutes of this drill converts f(x) from homework to tool.