Function Composition Calculator

Enter two functions f(x) and g(x) and an optional x value to evaluate. The Function Composition Calculator computes (f∘g)(x) and (g∘f)(x), showing you both composed expressions and their numeric results at your chosen point.

Enter the first function using x as the variable. Supported: +, -, *, /, ^, sqrt(), abs(), sin(), cos(), tan(), log(), exp()

Enter the second function using x as the variable.

Optional: enter a numeric value to evaluate both compositions at that point.

Results

(f∘g)(x) Expression

--

(g∘f)(x) Expression

--

(f∘g)(x₀) Value

--

(g∘f)(x₀) Value

--

f(x₀) Value

--

g(x₀) Value

--

Function Values at x₀

Results Table

Frequently Asked Questions

What is function composition?

Function composition is an operation where you apply one function to the result of another. (f∘g)(x) means you first apply g to x, then apply f to that result — written as f(g(x)). The order matters: (f∘g)(x) and (g∘f)(x) generally produce different results.

What is the difference between (f∘g)(x) and (g∘f)(x)?

(f∘g)(x) = f(g(x)) means g is applied first, then f. (g∘f)(x) = g(f(x)) means f is applied first, then g. These are usually not equal — function composition is not commutative in general.

How do I enter functions in the calculator?

Use standard mathematical notation with x as the variable. For example, enter x^2 + 1 for x² + 1, or 2*x + 3 for 2x + 3. You can also use functions like sqrt(x), abs(x), sin(x), cos(x), log(x), and exp(x).

What does evaluating a composition at a point mean?

Evaluating (f∘g)(x) at x = a gives you the numeric result of f(g(a)). For example, if g(x) = 2x + 3 and f(x) = x², then (f∘g)(2) = f(g(2)) = f(7) = 49. Enter your desired x value in the 'Evaluate at x' field.

Can function composition be performed with more than two functions?

Yes — three or more functions can be composed, such as (f∘g∘h)(x) = f(g(h(x))). This calculator handles two functions at a time: f(x) and g(x). For three functions, you can compose two first, use the result as a new function, and compose again.

When is (f∘g)(x) equal to (g∘f)(x)?

These two compositions are equal when f and g are inverses of each other — in that case, both compositions equal x. They can also be equal for specific function pairs, but it is not generally guaranteed.

What is the domain of a composite function?

The domain of (f∘g)(x) consists of all x values in the domain of g such that g(x) is also in the domain of f. In other words, you need g(x) to be defined, and then f must be defined at that resulting value.

Is function composition associative?

Yes — function composition is associative. That means (f∘g)∘h = f∘(g∘h) for any three functions. However, it is not commutative, so f∘g ≠ g∘f in general.

More Math Tools