Enter two functions f(x) and g(x) to get the composite functions f(g(x)) and g(f(x)), plus f + g, f − g, f · g and f / g. Each result is simplified, evaluated at a chosen x and given its domain, with the substitution shown step by step.
Last updated:
Examples:
Use x as the variable: + − * / ^, sqrt, cbrt, abs, ln, log, e^x, sin, cos, tan and pi. Implicit multiplication like 2x works.
(f ∘ g)(x) = f(g(x))
(g ∘ f)(x) = g(f(x))
All combinations
Step by step
Advertisement
Advertisement
How to use the Function Composition Calculator
Enter f(x), for example x^2 + 1.
Enter g(x), for example 2x - 3.
Optionally enter an x value to evaluate every combination there.
Press Calculate (results also update as you type).
Read f(g(x)) and g(f(x)), the combination table and the steps.
Operations on functions
Combination
Definition
Domain
(f + g)(x)
f(x) + g(x)
Dom f ∩ Dom g
(f − g)(x)
f(x) − g(x)
Dom f ∩ Dom g
(f · g)(x)
f(x) · g(x)
Dom f ∩ Dom g
(f / g)(x)
f(x) / g(x)
Dom f ∩ Dom g, with g(x) ≠ 0
(f ∘ g)(x)
f(g(x))
x ∈ Dom g with g(x) ∈ Dom f
(g ∘ f)(x)
g(f(x))
x ∈ Dom f with f(x) ∈ Dom g
Worked example: f(x) = √(x + 1), g(x) = x² − 3
f(g(x)) = √((x² − 3) + 1) = √(x² − 2). It needs x² − 2 ≥ 0, so the domain is (−∞, −√2] ∪ [√2, ∞).
g(f(x)) = (√(x + 1))² − 3, which simplifies to x − 2. The simplified form looks defined everywhere, but √(x + 1) must exist first, so the domain is [−1, ∞).
At x = 2: g(2) = 1 and f(1) = √2, so f(g(2)) = √2. Also f(2) = √3 and g(√3) = 0, so g(f(2)) = 0.
Tips
Use parentheses when substituting: replace x with (g(x)), not just g(x), so powers and minus signs apply to the whole expression.
Read the circle right to left: in f ∘ g, g acts first.
Decomposing a function means the reverse: writing h(x) = (3x + 1)⁵ as f(g(x)) with g(x) = 3x + 1 and f(x) = x⁵, which is the key step of the chain rule.
Inverse check: f and g are inverses exactly when f(g(x)) = x and g(f(x)) = x on their domains.
Frequently asked questions
What does (f ∘ g)(x) mean?
(f ∘ g)(x) = f(g(x)): first apply g to x, then apply f to the result. To find the formula, replace every x in f with the whole expression g(x). For f(x) = x² + 1 and g(x) = 2x − 3, f(g(x)) = (2x − 3)² + 1 = 4x² − 12x + 10.
Is f(g(x)) the same as g(f(x))?
Usually not. Composition is not commutative. With the same example, g(f(x)) = 2(x² + 1) − 3 = 2x² − 1, which is different from f(g(x)). The two are equal only for special pairs, such as a function and its inverse.
How do you find the domain of a composite function?
The domain of f ∘ g contains the x-values that are in the domain of g and whose output g(x) is in the domain of f. Work it out from the unsimplified form: for f(x) = √x and g(x) = x − 4 you need x − 4 ≥ 0, so the domain is [4, ∞).
How do I evaluate f(g(a))?
Work from the inside out: compute g(a) first, then plug that number into f. For example with g(2) = 1 and f(x) = x² + 1, f(g(2)) = f(1) = 2.
What is the domain of f/g?
It is the intersection of the domains of f and g, minus every x where g(x) = 0, because division by zero is undefined. The domains of f + g, f − g and f · g are simply the intersection of the two domains.
Why can the simplified formula have a bigger domain?
Simplifying can cancel a restriction. With f(x) = x² and g(x) = √x, f(g(x)) simplifies to x, but the composition only exists for x ≥ 0 because √x must be defined first. Always take the domain from the original composition.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.