Composition and Evaluating Functions Calculator
This composition of functions calculator gives you f(g(x)) and g(f(x)) together — and on the second tab it works as an evaluating functions calculator, putting a number into a function and telling you when there is no value there.
Type 2x + 3 and x² and you get f(g(x)) = 2x² + 3 and g(f(x)) = (2x + 3)².
Composition of Functions: Inside First
Composing means feeding one function into another. The notation reads from the inside out, the way brackets always do:
f(g(x)) — work out g, then hand the answer to f.
With f(x) = 2x + 3 and g(x) = x², the inside is x², so every x in f becomes x²: 2x² + 3. Reading left to right and applying f first is the commonest way to get these wrong, and it is worth saying the order out loud once before starting.
Why the Order Changes the Answer
Swap them and you get a different function, not a different form of the same one:
f(g(x)) = (x + 2)² but g(f(x)) = x² + 2 for f = x², g = x + 2
Squaring then adding two is not adding two then squaring. The two happen to agree at x = −½, and that is worth noticing precisely because it proves nothing: agreeing somewhere is not being equal. A question that asks for one will not accept the other, so this page gives you both and says which is which.
The Restriction That Survives Simplifying
This is where marks go, and no tidy answer warns you about it.
Take f(x) = x² and g(x) = √(x − 1). Composing gives (√(x − 1))², and the square and the root cancel:
f(g(x)) = x − 1 — but only for x ≥ 1
The neat form x − 1 would happily accept x = 0. The real composition cannot, because √(x − 1) was never defined below 1 and nothing that happens afterwards can rescue it. The restriction came from the inside function and it survives the cancelling.
Write the condition beside the answer. For these questions the marks are usually as much for that as for the algebra, and this page prints it for you: the answer, the point where the tidy form lies, and the condition solved.
It is worth seeing why this is not a quirk of one example. The inside function decides what is allowed to enter the whole machine: whatever g refuses, the composition refuses, because nothing ever reaches f in the first place. Then f can refuse more on top — a fraction with a zero on the bottom, a log of something negative. Both sets of limits apply, and simplifying the algebra afterwards has no power over either of them, because the limits were never about the algebra.
The reverse is worth knowing too: a composition can be defined in places neither original expression looks comfortable with. √x only takes numbers from 0 upwards, but compose it with 2x − 1 and you get √(2x − 1), which is fine from ½ upwards. The domain moved, and it moved because the inside function changed what arrives.
Evaluating Functions: Putting a Number In
The second tab does the other job. Replace every x with the number, brackets and all:
f(x) = x² − 2x → f(−6) = (−6)² − 2(−6) = 36 + 12 = 48
Those brackets matter more than they look. (−6)² is 36; −6² is −36. Writing the substitution down with the brackets in place, before doing any arithmetic, removes most of the errors in this topic at a stroke.
Evaluating is also the honest way to check a composition you have just worked out. Pick any number, run it through g and then f one at a time, and compare that with your composed expression at the same number. If the two disagree, the composition is wrong and you have found out in fifteen seconds. This page runs exactly that check on every answer before showing it to you.
Fill the value box on the first tab too and you get f(g(5)) as well — inside first, then outside, exactly as the notation says.
When a Composite Function Has No Value at All
A function can simply have no value at the number you were handed, and saying so is the full mark rather than a failure. √(x − 4) at x = 1 asks for the square root of −3, and there is none.
One case catches almost everyone. (x² − 4)/(x − 2) tidies to x + 2, which is perfectly happy at 2 — but the original had a zero on the bottom there and never had a value. Cancelling does not create a value. The question is about the function you were given, not the tidier one, and this page refuses that point and names the reason.
When Two Functions Are Inverses
If a composition comes back as plain x, it is tempting to call the two functions inverses and stop. That is half a proof.
Both orders have to come back x. Take f(x) = √x and g(x) = x²: one direction gives x and looks conclusive, but the other gives √(x²), which is |x| — not x for a single negative number. They are not inverses.
Compare 2x + 3 with (x − 3)/2: both orders give x, and those two really are inverses of each other. This page checks the direction you did not check.
Using the Composition of Functions Calculator
Pick Compose or Evaluate at the top. On Compose, type both functions; the value box is optional. On Evaluate, type one function and a number.
Write them the way you write them on paper — ^ for powers, / for division, brackets wherever you would put them. Fractions and decimals both work and nothing is rounded. The value box wants a number, not an expression with x in it, and will say so rather than quietly reading x as zero.
Composition and Evaluating Functions FAQ
How do you find the composition of two functions?
Is f(g(x)) the same as g(f(x))?
How do you evaluate a function at a number?
Why does the domain of a composite function change?
Inside first, then outside — and if the answer tidies up, check what tidied away with it.