For example, if the function x → 3x + 2 is given, then its inverse function is x → (x - 2) / 3. This is usually written as:
- f : x → 3x + 2
- f -1 : x → (x - 2) / 3
Generally, if f(x) is any function, and g is its inverse, then g(f(x)) = x and f(g(x)) = x. In other words, an inverse function undoes what the original function does. In the above example, we can prove f -1 is the inverse by substituting (x - 2) / 3 into f, so
- 3(x - 2) / 3 + 2 = x.
For a function f to have a valid inverse, it must be a bijection, that is:
- each element in the codomain must be "hit" by f: otherwise there would be no way of defining the inverse of f for some elements
- each element in the codomain must be "hit" by f only once: otherwise the inverse function would have to send that element back to more than one value.
If one represents the function f graphically in an x-y coordinate system, then the graph of f -1 is the reflection of the graph of f across the line y = x.
Algebraically, one computes the inverse function of f by solving the equation
- y = f(x)
- y = f -1(x).