Skip to content
ENExplore Calculators

Composite Function Calculator

Compute (f∘g)(x) = f(g(x)) by evaluating two functions in sequence at a given x value.

About Composite Function Calculator

Function composition (f∘g)(x) means applying g first, then f to the result: f(g(x)). Note that composition is generally not commutative: f(g(x)) ≠ g(f(x)) in most cases. This calculator evaluates both orders for comparison.

Formulas

Composition

(f∘g)(x) = f(g(x))

f
Outer function
g
Inner function
x
Input value

Reverse composition

(g∘f)(x) = g(f(x))

f
First function applied
g
Second function applied

Worked example

With the default values below, Composite Function Calculator returns (f∘g)(x) = f(g(x)) of 26.00000000. Change any input above and every figure here is recalculated in your browser.

Inputs used

f(x)
x^2 + 1
g(x)
2*x - 3
x value
4

Results

(f∘g)(x) = f(g(x))
26.00000000
(g∘f)(x) = g(f(x))
31.00000000
g(x)
5.00000000
f(x)
17.00000000

Step by step

  1. 1Values used
  2. 2Composition
  3. 3Reverse composition
  4. 4(f∘g)(x) = f(g(x))= 26.00000000
  5. 5(g∘f)(x) = g(f(x))= 31.00000000
  6. 6g(x)= 5.00000000
  7. 7f(x)= 17.00000000

Assumptions and limits

  • The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 8 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Is f(g(x)) the same as g(f(x))?

Not in general. Function composition is not commutative — the order matters. This calculator shows both so you can compare.

What expressions can I use?

Any expression supported by the parser: polynomials, trig functions, logarithms, exponentials, square roots, etc. Use x as the variable.

Composite Function Calculator – Calculate (f∘g)(x) = f(g(x))