algebra calculators

Function Composition Calculator

Evaluate the composite function (f∘g)(x) = f(g(x)) for linear, quadratic, exponential, or logarithmic f and linear g at any x value. Use it to check composition homework or explore how nested functions behave.

About this calculator

Function composition means applying one function to the output of another: (f∘g)(x) = f(g(x)). You first evaluate the inner function g(x) = a·x + b to get an intermediate value, then feed that result into f. If f is linear, f(u) = a·u + b, so (f∘g)(x) = a(a_g·x + b_g) + b_f. If f is quadratic, (f∘g)(x) = a_f·(a_g·x + b_g)² + b_f·(a_g·x + b_g). If f is exponential, (f∘g)(x) = a_f^(a_g·x + b_g). If f is logarithmic, (f∘g)(x) = ln(a_g·x + b_g), valid only when the argument is positive. Note that composition is not commutative: (f∘g)(x) generally differs from (g∘f)(x). This operation is fundamental in calculus, particularly when applying the chain rule for differentiation.

How to use

Let f(x) = 2x + 1 (linear, a = 2, b = 1) and g(x) = 3x − 4 (a = 3, b = −4). Evaluate (f∘g)(5). Step 1 — compute g(5): 3×5 + (−4) = 15 − 4 = 11. Step 2 — compute f(11): 2×11 + 1 = 22 + 1 = 23. Using the formula directly: f_coeff_a × (g_coeff_a × eval_point + g_coeff_b) + f_coeff_b = 2×(3×5 + (−4)) + 1 = 2×11 + 1 = 23. Enter f type = Linear, f_a = 2, f_b = 1, g_a = 3, g_b = −4, x = 5, and the calculator returns 23.

Frequently asked questions

What does function composition mean and how is it different from multiplication?

Function composition means chaining two functions so that the output of one becomes the input of the other: (f∘g)(x) = f(g(x)). This is fundamentally different from multiplying two functions, which would give (f·g)(x) = f(x)·g(x). For example, if f(x) = x² and g(x) = x + 1, then (f∘g)(2) = f(3) = 9, while (f·g)(2) = 4 × 3 = 12. The composition notation ∘ explicitly signals the chaining operation. Composition is the basis of the chain rule in calculus and is used extensively in computer science to build complex operations from simpler ones.

Why is function composition not commutative?

Commutativity would mean f∘g = g∘f for all inputs, but this is generally false. Consider f(x) = x² and g(x) = x + 3: (f∘g)(1) = f(4) = 16, but (g∘f)(1) = g(1) = 4. The order matters because you are substituting the entire expression of one function into the other, and the algebraic operations do not cancel each other symmetrically. Only in special cases, such as when f and g are inverse functions of each other, does (f∘g)(x) = (g∘f)(x) = x hold. Always specify clearly which function is the outer one and which is the inner one.

How do you find the domain of a composite function f(g(x))?

The domain of f(g(x)) has two requirements: first, x must be in the domain of g so that g(x) is defined; second, the output g(x) must fall within the domain of f so that f(g(x)) is defined. For example, if g(x) = x − 2 and f(u) = ln(u), then g is defined for all real x, but f requires u > 0, so you need x − 2 > 0, meaning x > 2. When f is a square root or logarithm, domain restrictions from the outer function are often the binding constraint. Always check both conditions systematically rather than assuming the composite domain equals the domain of either individual function.