Study and Productivity

Composite and Inverse Functions: f(g(x)), Hidden Domain Restrictions and Finding f^-1

Compose functions in the right order, find the true domain of a composite, and invert functions step by step, including rational ones, with full checks.

Saizul Amin
Saizul Amin3 Nov 2026 · 4 min read
Composite and Inverse Functions: f(g(x)), Hidden Domain Restrictions and Finding f^-1

Composite and Inverse Functions: f(g(x)), Hidden Domain Restrictions and Finding f^-1

Composition and inverses turn functions into building blocks. Composition chains two functions together; an inverse runs a function backwards. Both are simple to define, yet the marks are usually lost on details: the order of the chain, a domain restriction that disappears when you simplify, or a function that has no inverse at all. This guide covers each of those carefully.

Composition: inside first

The notation f(g(x)) means: take x, apply g, then apply f to the result. To find it as a formula, replace every x in f with the whole expression for g(x), in brackets.

Let f(x) = x^2 and g(x) = sqrt(x + 3).

  • f(g(x)) = (sqrt(x + 3))^2 = x + 3.
  • g(f(x)) = sqrt(x^2 + 3).

These are different functions, which shows that order matters. To evaluate at a number, work from the inside out: f(g(6)) = f(sqrt(9)) = f(3) = 9, and g(f(1)) = g(1) = sqrt(4) = 2.

The domain of a composite

For f(g(x)) to exist, two things must be true: x must be allowed in g, and the value g(x) must be allowed in f.

In our example, f(g(x)) simplifies to x + 3, which looks as if it accepts every real number. But the inner function sqrt(x + 3) needs x + 3 ≥ 0, so x ≥ -3. The true domain is therefore [-3, ∞). Simplifying hid the restriction, and this is the single most common error with composites.

By contrast, g(f(x)) = sqrt(x^2 + 3) is defined for every real x, because x^2 + 3 is always at least 3.

The rule: find the domain from the nested, unsimplified form, never from the tidy final expression.

Inverses: undo in reverse order

A function has an inverse only if it is one-to-one, meaning no two inputs share an output. On a graph, no horizontal line may cross the curve more than once.

To find the inverse, write y = f(x), solve for x, then swap the letters.

Example: f(x) = 2e^x - 5.

  1. y = 2e^x - 5.
  2. Add 5: y + 5 = 2e^x.
  3. Divide by 2: (y + 5)/2 = e^x.
  4. Take natural logs: x = ln((y + 5)/2).
  5. Swap: f^-1(x) = ln((x + 5)/2).

The range of f is y > -5, because 2e^x is always positive. That range becomes the domain of the inverse, and indeed ln((x + 5)/2) needs x > -5. Check: f(0) = 2 - 5 = -3, and f^-1(-3) = ln(1) = 0.

A rational function

When x appears twice, as in h(x) = (3x - 2)/(x + 4), undoing operations one at a time does not work. Instead collect the x terms.

  1. y = (3x - 2)/(x + 4).
  2. Multiply out: y(x + 4) = 3x - 2, so xy + 4y = 3x - 2.
  3. Gather x terms on one side: xy - 3x = -2 - 4y.
  4. Factor: x(y - 3) = -(4y + 2).
  5. Divide: x = (4y + 2)/(3 - y).
  6. Swap: h^-1(x) = (4x + 2)/(3 - x).

Check with a number: h(1) = 1/5, and h^-1(1/5) = (0.8 + 2)/(3 - 0.2) = 2.8/2.8 = 1. The value x = 3 is excluded from the inverse because h never outputs 3, the height of its horizontal asymptote.

When a function is not one-to-one

f(x) = x^2 sends both 2 and -2 to 4, so it has no inverse on all real numbers. Restrict the domain to x ≥ 0 and the inverse becomes sqrt(x). The restriction is part of the answer and must be stated.

Common mistakes

  1. Applying the functions in the wrong order: f(g(x)) is g first.
  2. Taking the domain from the simplified composite.
  3. Confusing f^-1(x) with 1/f(x). The inverse is not the reciprocal.
  4. Forgetting to swap x and y at the end, or swapping at the start and then mislabelling.
  5. Claiming an inverse for a function that is not one-to-one without restricting it.

How to check your answer

For an inverse, compose the two: f(f^-1(x)) and f^-1(f(x)) should both simplify to x on the appropriate domain. Test a numerical value, as above. On a graph, f and its inverse should be mirror images across the line y = x.

Doing it with the tool

Type f(x) = x^2 and g(x) = sqrt(x + 3) into the Function Composition and Inverse Function Finder. The composition tab shows both composites with their domains in interval notation, so you can see [-3, ∞) appear even though the formula is x + 3. Enter 6 to watch f(g(6)) evaluated from the inside out. In the inverse tab, enter (3x - 2)/(x + 4) or 2e^x - 5 to see each step named, the one-to-one check and the graph reflected in y = x. Practice questions cover evaluating, composing and inverting.

Limits

The finder inverts functions by undoing operations, so it does not handle general functions where x appears several times, apart from the linear-over-linear form. Domains are found numerically over a limited interval, so endpoints may be rounded. It is a study aid for checking work, not a substitute for writing the algebra yourself in an assessment.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages