Read this lesson as text
Inverse Functions
Math for CS · Axiom Academy
Reversing a function: when and how inverses exist Injective ensures the reverse mapping is well-defined (no output came from two different inputs) Surjective ensures the reverse mapping is total (every element of B has something to map back to) The inverse "undoes" the function: applying f then f^ -1 (or vice versa) brings you back to where you started. Example 2: f(x) = 2^x (with domain , codomain _ >0 ) Always verify by checking both compositions equal the identity: For finite functions defined by a table, simply reverse the mapping: This is bijective (each output appears exactly once), so the inverse is: Just swap the rows: if f(2) = a , then f^ -1 (a) = 2 . If f is not bijective, a true inverse does not exist. But there are workarounds: f^ -1 exists if and only if f is bijective f^ -1 (b) = a f(a) = b — just reverse the mapping Find inverses algebraically: set y = f(x) , solve for x Verify: f f^ -1 = and f^ -1 f = (g f)^ -1 = f^ -1 g^ -1 — "socks and shoes" rule
This is the written version of the interactive lesson above. See the full Math for CS course.