1. Identify the order
In f(g(x)), g is inside the parentheses, so evaluate g first. The result becomes the input of f.
Get the composed rule, the value of g(x), the final value of f(g(x)), substitution steps, and an order comparison with g(f(x)).
In f(g(x)), g is inside the parentheses, so evaluate g first. The result becomes the input of f.
To write a composed rule, replace every x in f(x) with the entire expression g(x). Parentheses preserve the intended operations.
The original input must be allowed by g, and g(x) must be an allowed input for f. Either condition can make the composition undefined.
Composition is generally not commutative: f(g(x)) and g(f(x)) often have different rules and values.
(f ∘ g)(x) = f(g(x))
For f(x)=2x+3 and g(x)=x²−1, substitution gives f(g(x))=2(x²−1)+3. At x=4, first find g(4)=15, then f(15)=33.
If f(x)=3x−2 and g(x)=x²+1, then f(g(x))=3(x²+1)−2=3x²+1.
If f(x)=sqrt(x), then the inner output must be nonnegative. For g(x)=x−5, the real composition requires x≥5.
If g(x)=1/x, then x=0 is excluded before the outer function is evaluated.
With f(x)=x+1 and g(x)=x², f(g(x))=x²+1, while g(f(x))=(x+1)².
The calculator parses a restricted mathematical grammar and evaluates it locally; it does not use JavaScript eval and does not send function rules or values to a server. Intermediate and final calculations use browser floating-point arithmetic and display up to 12 significant digits.
Inputs are limited to 180 characters, 240 expression nodes, 40 levels of nesting, and |x|≤10¹². Undefined real operations—such as division by zero, sqrt(−1), ln(0), or a non-real power—produce an error instead of a misleading result. The composed expression is substitution form, not a full symbolic simplification. Last reviewed: 4 August 2026.
It means apply g to x first, then apply f to the output. It is also written (f∘g)(x).
Usually not. Reversing the order changes which function receives the original input and can change both the value and the allowed domain.
Replace every occurrence of x in the outer rule f(x) with the full inner rule g(x). Put the inner rule in parentheses when needed.
The input may cause division by zero or an invalid logarithm or root in g. Alternatively, g may return a value outside the domain of f. The error message identifies which stage failed.
log(x) means base 10, while ln(x) means the natural logarithm. Both require a positive real input.
No. The calculator uses radians, matching the standard JavaScript mathematical functions. For example, enter pi/2 for 90 degrees.