In mathematics, an inverse function is in simple terms a function which "does the reverse" of a given function. More formally, if f is a function with domain X, then f −1 is its inverse function if and only if for every we have:
For example, if the function x → 3x + 2 is given, then its inverse function is x → (x−2) / 3. This is usually written as:
The superscript "−1" is not an exponent. Similarly, as long as we are not in trigonometry, f 2(x) means "do f twice", that is f(f(x)), not the square of f(x). For example, if : f : x → 3x + 2, then f 2 : x = 3 ((3x + 2)) + 2, or 9x + 8. However, in trigonometry, for historical reasons, sin2(x) usually does mean the square of sin(x). As such, the prefix arc is sometimes used to denote inverse trigonometric functions, e.g. arcsin x for the inverse of sin(x).
If a function f has an inverse then f is said to be invertible.
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.
Similarly this can be shown for substituting f into f−1.
Indeed, an equivalent definition of an inverse function g of f, is to require that g o f be the identity function on the domain of f, and f o g be the identity function on the codomain of f, where "o" represents function composition.
For a function f to have a valid inverse, it must be a bijection, that is:
- (f is onto) 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.
- (f is one-to-one) 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 f is a real-valued function, then for f to have a valid inverse, it must pass the horizontal line test, that is a horizontal line placed on the graph of f must pass through f exactly once for all real k.
It is possible to work around this condition, by redefining f's codomain to be precisely its range, and by admitting a multi-valued function as an inverse.
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
for x, and then exchanging y and x to get