composite function calculator

Composite Function Calculator (f∘g and g∘f)

Enter two functions in terms of x, then choose a value for x. Use operators + - * / ^ and functions like sin, cos, tan, sqrt, abs, ln, log, exp.

Enter your functions and click Calculate Composite Functions to see results.

What is a composite function?

A composite function is a function created by plugging one function into another. If you have two functions, f(x) and g(x), then:

  • (f∘g)(x) means f(g(x))
  • (g∘f)(x) means g(f(x))

Function composition is one of the most useful ideas in algebra, precalculus, and calculus. It appears in transformation problems, inverse function checks, and real-world models where one process feeds into another.

How to use this calculator

Step-by-step

  • Type your first function in the f(x) box.
  • Type your second function in the g(x) box.
  • Enter a value for x.
  • Click the calculate button.

The calculator returns:

  • The value of f(x) at your chosen x
  • The value of g(x) at your chosen x
  • The value of f(g(x))
  • The value of g(f(x))
  • The symbolic substituted expressions for both compositions

Why f(g(x)) is usually not the same as g(f(x))

Composition is generally not commutative. That means changing the order usually changes the result. Think of it as applying two machines in sequence: machine A then machine B is often different from B then A.

If f(x) = x + 2 and g(x) = x^2:
f(g(x)) = x^2 + 2
g(f(x)) = (x + 2)^2 = x^2 + 4x + 4

Worked examples

Example 1: Polynomial composition

Let f(x) = x² + 1 and g(x) = 2x - 3. Then:

  • f(g(x)) = (2x - 3)² + 1
  • g(f(x)) = 2(x² + 1) - 3 = 2x² - 1

Notice how one expression becomes quadratic-in-a-binomial, while the other is a simpler quadratic expression.

Example 2: Trigonometric and quadratic

Let f(x) = sin(x) and g(x) = x².

  • f(g(x)) = sin(x²)
  • g(f(x)) = (sin(x))²

These are very different functions. One oscillates with a squared input, and the other is a squared trigonometric output.

Domain reminders for composition

Domain restrictions matter in composite function problems. For example:

  • If f(x) = sqrt(x), then its input must be nonnegative.
  • So in f(g(x)), you must ensure g(x) ≥ 0.
  • If a denominator can become zero, that x-value is excluded.
  • If using logarithms, input must be positive.

This calculator evaluates specific numeric points and reports errors when a point is invalid.

Common mistakes students make

  • Forgetting parentheses when substituting: write f(g(x)) as f( ... ) carefully.
  • Mixing order: f(g(x)) is not the same as g(f(x)).
  • Ignoring domain restrictions before evaluating.
  • Assuming composition means multiplication. It does not.

Quick FAQ

Can I use this for inverse functions?

Yes. If two functions are inverses, then f(g(x)) = x and g(f(x)) = x on appropriate domains.

Does this support constants like pi and e?

Yes. You can type pi and e directly in the function expressions.

What if my expression does not work?

Make sure you use explicit multiplication (for example, write 2*x instead of 2x) and valid function names.

Final thoughts

A composite function calculator is a fast way to verify homework, test intuition, and understand how function composition behaves. Use it to compare f∘g and g∘f, check domains, and build confidence with algebraic substitution.

🔗 Related Calculators