acalculator

What is the inverse function of f?

Type a function of x. The page solves y = f(x) for x and gives the inverse function f⁻¹(x), then checks that f⁻¹(f(x)) = x.

Your numbers

Use x, + - * / ^, brackets, pi, e, sqrt, ln, sin, cos, tan.
f⁻¹(x) =
2/(x - 4) + 3

The inverse of f(x) = 2/(x - 3) + 4 is f⁻¹(x) = 2/(x - 4) + 3.

f⁻¹(x) =: 2/(x - 4) + 3. The inverse of f(x) = 2/(x - 3) + 4 is f⁻¹(x) = 2/(x - 4) + 3.

How to calculate

Finds the formula of the inverse function f⁻¹(x) of a one-to-one function, checked by composing it with f.

Example with the default inputs (Function f(x) 2/(x - 3) + 4): The inverse of f(x) = 2/(x - 3) + 4 is f⁻¹(x) = 2/(x - 4) + 3.

Method: Solve y = f(x) for x by undoing each operation of f in reverse order, then swap x and y. The answer is shown only when f⁻¹(f(x)) = x at test points.

  • The variable is x; angles are in radians; ln is the natural logarithm.
  • f⁻¹ is defined on the range of f.
  • An answer that fails its check is not shown.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Function f(x) 2/(x - 3) + 4 gives f⁻¹(x) = 2/(x - 4) + 3.Source: OpenStax, College Algebra 2e, section 3.7 Inverse Functions, Example 8. https://openstax.org/books/college-algebra-2e/pages/3-7-inverse-functions
  2. Function f(x) 2 + sqrt(x - 4) gives f⁻¹(x) = (x - 2)^2 + 4.

How it works

To invert f, the page solves y = f(x) for x by undoing the operations of f, from the outside in, and then writes the result with x in place of y.

This works when x appears once in f. When it appears more than once, a computer algebra system (nerdamer, open source) first tries to rewrite f with x once: as partial fractions ((2x + 3)/(x − 1) = 2 + 5/(x − 1)), then factored ((x² + 2x + 1) = (x + 1)²). Each rewrite is checked numerically at 20 points. The algebra runs in the background after you start typing.

Each step undoes one operation, where u is the part that holds x and c the part that does not:

  • y = u + c or c + u gives u = y − c; y = u − c gives u = y + c; y = c − u gives u = c − y; y = −u gives u = −y.
  • y = c u gives u = y/c (a fraction c = p/q gives u = y q/p); y = u/c gives u = y c; y = c/u gives u = c/y.
  • y = u^c gives u = y^(1/c), written sqrt(y) for c = 2 and cbrt(y) for c = 3; y = c^u gives u = ln(y)/ln(c).
  • sin, cos, tan give asin, acos, atan, and the other way round; sinh, cosh, tanh give asinh, acosh, atanh, and the other way round; exp gives ln; ln gives e^y; log10 gives 10^y; sqrt gives y^2; cbrt gives y^3.

Any other function (such as abs) cannot be undone, and the page says so.

The answer is checked before it is shown. f⁻¹(f(x)) is worked out at 18 test points (−33.1, −7.31, −3.17, −1.73, −0.91, −0.37, −0.043, 0.21, 0.57, 0.77, 1.33, 2.63, 3.37, 4.19, 8.93, 17.3, 41.3 and 97.7). At every point where f(x) and f⁻¹(f(x)) are real numbers, f⁻¹(f(x)) must equal x to 10⁻⁹ × max(1, |x|), plus an allowance for rounding: 100 times |f⁻¹(y + 10⁻¹⁵ max(1, |y|)) − f⁻¹(y)| with y = f(x) (large where f is nearly flat, as e^(4x) − 1 is at x = −33.1). There must be at least 3 such points. If the check fails, f is not one-to-one there (x², sin(x)) and the page says there is no inverse.

The inverse is written in the syntax you type; it holds on the range of f.

What you can type

  • A number has at most 15 digits in a row. A computer number keeps only about 16 digits, so a longer one (9007199254740993) would stand for a nearby number (9007199254740992), and the page asks for fewer digits instead. Write very large or very small numbers with a power of ten (1e-20).
  • The function f uses the variable x. Numbers can have decimals (2.5) and powers of ten (1e-3).
  • Operations: + − * / and ^ for powers. Brackets group. A number or bracket next to a letter multiplies: 2x, 3(x + 1), x sin(x).
  • Constants: pi (or π) and e.
  • Functions: sqrt, cbrt, ln (and log, the same natural logarithm), log10, exp, abs (or |x|), sin, cos, tan, sec, csc, cot, asin, acos, atan (arcsin, arccos, arctan also work), sinh, cosh, tanh and their inverses. Angles are in radians. sin x without brackets means sin(x); sin x^2 means sin(x²).

What gets no answer

  • A constant f (no x in it): it has no inverse.
  • f where x cannot be written once (x + eˣ), or a function this page cannot undo (|x|).
  • f that is not one-to-one on its domain (x², sin(x)), or a check at fewer than 3 points.

Worked examples by hand

f(x) = 2/(x − 3) + 4 (OpenStax College Algebra 2e, section 3.7, Example 8). y − 4 = 2/(x − 3), so x − 3 = 2/(y − 4) and x = 2/(y − 4) + 3. The inverse is f⁻¹(x) = 2/(x − 4) + 3.

f(x) = 2 + √(x − 4) (OpenStax College Algebra 2e, section 3.7, Example 9). y − 2 = √(x − 4), so x − 4 = (y − 2)² and x = (y − 2)² + 4. The inverse is f⁻¹(x) = (x − 2)^2 + 4, for x ≥ 2 (the range of f).

Other questions people ask

What is an inverse function?

The inverse of f undoes it: if f(a) = b then f⁻¹(b) = a, so f⁻¹(f(x)) = x. For f(x) = 2x + 3 the inverse is f⁻¹(x) = (x − 3)/2: take 3 away, then halve.

How do I find the inverse of a function?

Write y = f(x), solve the equation for x in terms of y, then swap the letters. For y = 2/(x − 3) + 4: y − 4 = 2/(x − 3), so x − 3 = 2/(y − 4) and x = 2/(y − 4) + 3. Swapping gives f⁻¹(x) = 2/(x − 4) + 3.

Why does x^2 have no inverse?

Because it is not one-to-one: f(2) = f(−2) = 4, so no single formula can send 4 back to both. The page checks f⁻¹(f(x)) = x at test points and says so when it fails. Restricted to x ≥ 0, x² does have an inverse, √x; a function such as √x or √(x − 4) + 2 already has that restriction built in.

What is the domain of the inverse?

The domain of f⁻¹ is the range of f. For f(x) = 2 + √(x − 4), the range is y ≥ 2, so f⁻¹(x) = (x − 2)² + 4 holds for x ≥ 2 only; outside that range the formula gives numbers, but they are not values of the inverse.

Which functions can the page invert?

Functions in which x can be written once: 2/(x − 3) + 4, √(x − 4) + 2, e^(2x) − 1, ln(x + 3), 5/9 (x − 32). A fraction such as (2x + 3)/(x − 1), with x twice, works when the algebra can rewrite it with x once (here 2 + 5/(x − 1)). An equation such as y = x + eˣ has no inverse in elementary functions.

How is the answer checked?

The page works out f⁻¹(f(x)) at 18 test points across the domain of f; at every point where both are real it must equal x to 1 part in 10⁹, and there must be at least 3 such points. This also shows f is one-to-one there.