Composite function calculator guide
Function composition uses the output of one function as the input of another. For f(g(x)), evaluate g at x first and then evaluate f at that result. Reverse the order for g(f(x)).
The order usually matters. This calculator evaluates numeric compositions with a restricted local expression parser. It does not download a math library, execute entered JavaScript, or claim to symbolically simplify a formula.
How to evaluate composite functions
- Enter f and g: Use x as the variable and the supported operators, constants, and one-argument functions listed below the fields.
- Enter x: Provide a finite numeric input that belongs to the domain of the inner functions.
- Evaluate: Select Evaluate compositions to compute both possible orders.
- Follow the intermediate value: Read the inner-function result before the final value to verify the substitution order.
Formula and variables
The inside function is evaluated first. Its output must belong to the domain of the outside function for the composition to be defined.
(f o g)(x) = f(g(x)); (g o f)(x) = g(f(x))- f, g — Functions
- Rules that assign outputs to valid inputs.
- x — Initial input
- The numeric value supplied to the inner function.
- o — Composition operator
- Indicates that one function receives the output of another.
Composition is not commutative
Let f(x) = x^2 + 1, g(x) = 2x - 3, and x = 4.
- f(x)
- x^2 + 1
- g(x)
- 2x - 3
- x
- 4
- g(4) = 5, so f(g(4)) = f(5) = 26
- f(4) = 17, so g(f(4)) = g(17) = 31
Result: f(g(4)) = 26, while g(f(4)) = 31.
Changing the order changes the intermediate input and therefore changes the result.
Understanding your results
f(g(x))
The result of g is substituted for every x in f through numeric evaluation.
Domain errors
A square root of a negative number, logarithm of a nonpositive number, division by zero, or inverse-trigonometric input outside its real domain produces an error instead of a misleading number.
Assumptions
- Functions are interpreted as real-valued expressions of one variable x.
- Trigonometric inputs and outputs use radians.
- log means base 10 and ln means the natural logarithm.
- Both stages of a composition must produce finite real numbers.
Limitations
- The calculator evaluates at one numeric x; it does not produce a symbolic composition formula.
- Piecewise functions, factorials, matrices, complex results, user-defined functions, and multivariable expressions are not supported.
- Implicit multiplication is supported for forms such as 2x and 3(x+1), but ambiguous notation should be written with an explicit operator.
- Floating-point evaluation can introduce small rounding differences.
Common mistakes
- Multiplying f(x) and g(x) instead of composing them.
- Evaluating the outside function first.
- Assuming f composed with g equals g composed with f.
- Ignoring the domain of the outer function at the inner output.
- Using degrees in trigonometric formulas when the parser uses radians.
Practical use cases
Algebra practice
Check the numeric substitution steps for two composition orders.
Model chains
Evaluate a two-stage model where the output of one relationship becomes the input of another.
Planning and decision guide
Check domains in both stages
For f(g(x)), x must be valid for g and g(x) must be valid for f. Repeat that reasoning separately for g(f(x)); one order can be defined even when the other is not.
Frequently asked questions
What does f(g(x)) mean?
Evaluate g at x, then use that output as the input to f.
Is composition the same as multiplication?
No. f(g(x)) generally differs from f(x) times g(x).
Does order matter?
Usually yes. Function composition is generally not commutative.
Which logarithms are supported?
Use ln for the natural logarithm and log for base 10.
Does this calculator simplify symbolic formulas?
No. It performs safe real-number evaluation at the entered x and reports intermediate numeric values.
Sources and review
- Composition of Functions — OpenStax Precalculus 2e. Accessed 2026-08-29.
- Composition of Functions — OpenStax College Algebra 2e. Accessed 2026-08-29.
Reviewed 2026-08-29.