About the Function Composition Calculator
Composition chains two functions so that the output of one becomes the input of the other. It is how complicated formulas are built from simple ones: is a square root applied after subtracting 4, and is squaring and adding one applied after a linear map. Recognising these layers is essential for the chain rule, for inverse functions and for modelling processes that happen in stages.
This calculator substitutes one function into another, expands and simplifies the result, and works out the domain of the composite, including the restrictions inherited from the inner function. If you supply a value it also evaluates the composition there from the inside out, so you can see how the number moves through each function in turn.
What is function composition?
The composition of with , written , is defined as : first apply , then apply to the result. The function written on the right acts first, which is the reverse of the reading order.
Composition is not commutative. For and , while . A function can also be composed with itself: applies twice.
How to use the Function Composition Calculator
- Enter the outer function f(x) and the second function g(x), both in terms of .
- Choose the composition: f∘g, g∘f, f∘f or g∘g.
- Optionally enter a value of to evaluate the composite at that point.
- Press Compose to see the substitution, the simplified result and its domain.
- Compare with the reverse order to see how the result changes.
Formulas
Definition
Domain of a composition
Associativity
Inverse check
Worked example: f(g(x)), f = x² + 1, g = 2x − 3, at x = 2
The example uses and and builds . Every in is replaced by the whole expression , giving , which expands to .
The example also evaluates at . In stages, and ; the simplified formula gives , the same value. Both functions are polynomials, so the domain is all real numbers.
The solution below is generated by the same engine that powers the calculator above.
Final answer
How we read your problem
Find (f ∘ g)(x) = f(g(x)) and evaluate it.
Step-by-step solution
Write the functions
(f ∘ g)(x) means f(g(x)): put g(x) in place of every x in f
Substitute
Expand and collect like terms
Domain: x must be allowed in g, and g(x) must be allowed in f
Evaluate inside-out at x = 2: first g(2) = 1
Then f(1) = 2
Formulas used
Composition
Composition feeds the output of g into f. The order matters: f∘g applies g first and is usually different from g∘f. The domain is worked out before simplifying, since cancelling factors can hide values the composite cannot accept.
Verification
- Checked: f(g(x)) and the final formula agree at sample points.
- Checked: the simplified formula also gives 2 at x = 2.
Detailed explanation
Substituting correctly
The safest way to compose is to rewrite the outer function with empty brackets in place of , such as , and then place the entire inner expression inside every bracket. The brackets matter: replacing in with gives , not .
Once substituted, the result is expanded and like terms are collected. The calculator shows the unsimplified substitution first so you can compare it with your own working, then the simplified form.
Finding the domain
An input belongs to the domain of only if accepts it and accepts what produces. For and , accepts every number, but needs a non-negative input, so and the domain is .
Restrictions from the inner function survive even when simplification hides them. With and , the composite simplifies to , yet only is allowed because must be defined first. That is why the domain is computed from both stages, not just from the final formula.
Where composition is used
The chain rule in calculus differentiates a composition: . Spotting the inner and outer functions is the first step in using it. Composition also describes changes of units, repeated percentage changes and transformations of graphs: is composed with a shift of two to the right.
Decomposition is the reverse skill: given , choose an inner function and an outer function so that . There is usually more than one valid choice, and the best one is the split that makes the next step, such as differentiating or inverting, easiest. Practising with the calculator in both directions builds the habit of seeing functions as layers.
Common mistakes
- Applying the functions in the wrong order; in the inner function acts first.
- Multiplying the functions instead of composing them: is not .
- Dropping brackets when substituting, which changes powers and signs.
- Taking the domain only from the simplified formula and losing restrictions from the inner function.
- Assuming ; check both orders.
Tips
- Evaluate at a simple number in stages to check a simplified composite.
- Write the outer function with empty brackets before substituting.
- List the domain conditions of the inner function first, then those of the outer one.
- Use the inverse function calculator, then compose to confirm .
- Name the inner and outer functions before differentiating with the chain rule.
Frequently asked questions
What does f(g(x)) mean?
It means apply g to x first, then apply f to the result. The composite is written f∘g, and the function on the right always acts first.
Is f∘g the same as g∘f?
Usually not. For f(x) = x² and g(x) = x + 1, f(g(x)) = (x + 1)² but g(f(x)) = x² + 1. The calculator lets you compute both orders.
How do you find the domain of a composite function?
Take the inputs allowed by the inner function, then keep only those whose outputs are allowed by the outer function. Restrictions from the inner function remain even if the simplified formula hides them.
Can I compose a function with itself?
Yes. Choose f∘f or g∘g. For f(x) = 2x + 1, f(f(x)) = 4x + 3, so f(f(3)) = 15.
How is composition related to the chain rule?
The chain rule differentiates a composition: the derivative of f(g(x)) is f′(g(x)) times g′(x). Identifying the inner and outer functions is the first step.
Does the calculator evaluate the composite at a point?
Yes. Enter a value of x and it evaluates inside-out: first the inner function at that value, then the outer function at the result. Substituting the same value into the simplified formula should give the same number.
How do I check that two functions are inverses?
Compose them in both orders. If f(g(x)) and g(f(x)) both simplify to x on the relevant domains, the functions are inverses of each other.
Compose your functions
Enter f(x) and g(x) above to see the composite simplified, evaluated and with its domain.