f of g calculator

Compose Functions Instantly

Enter two functions in terms of x, then evaluate g(x) and f(g(x)) at your chosen x-value.

Supported: +, -, *, /, ^, parentheses, sin, cos, tan, asin, acos, atan, sqrt, abs, ln, log, exp, min, max, floor, ceil, round, pi, e.

What is f(g(x))?

In algebra, f(g(x)) means function composition. You run the inner function first, then feed that output into the outer function:

  • Step 1: Compute g(x)
  • Step 2: Plug that result into f

Think of it like two machines in sequence. Machine g transforms x first. Machine f transforms whatever comes out of g. Composition appears constantly in precalculus, calculus, statistics, physics, economics, and computer science.

How to use this f of g calculator

1) Enter the outer function f(x)

Example: x^2 + 1. This means “take an input, square it, then add 1.”

2) Enter the inner function g(x)

Example: 2*x - 3. This means “double x, then subtract 3.”

3) Enter your x-value and calculate

The calculator displays:

  • g(x) at your chosen x
  • f(g(x)) at that same x
  • The composed symbolic expression for f(g(x))

Worked examples

Example A: Polynomial inside polynomial

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

  • f(g(x)) = (2*x - 3)^2 + 1
  • If x = 4, then g(4) = 5
  • So f(g(4)) = f(5) = 26

Example B: Trigonometric composition

If f(x) = sin(x) and g(x) = x^2, then f(g(x)) = sin(x^2). This is a classic calculus expression.

Example C: Domain-sensitive composition

Suppose f(x) = sqrt(x) and g(x) = x - 7. Then f(g(x)) = sqrt(x - 7), which is defined only when x ≥ 7. If you enter x = 2, the calculator will return an undefined/domain error.

Common mistakes when composing functions

  • Reversing order: f(g(x)) is usually different from g(f(x)).
  • Skipping parentheses: write f(g(x)) as f( ... ) with the full inner function inside.
  • Forgetting multiplication symbols: use 2*x instead of 2x for best reliability.
  • Ignoring domain restrictions: square roots, logs, and denominators can make expressions undefined.

Why this matters

Function composition helps describe layered systems:

  • Temperature conversion chains
  • Signal processing transformations
  • Economics models with nested relationships
  • Machine learning pipelines where one transform feeds another

Mastering composition gives you better control over algebraic structure and prepares you for inverse functions, derivatives via the chain rule, and advanced modeling.

Quick input tips

  • Use ^ for powers (example: x^3).
  • Use ln(x) for natural log and log(x) for base-10 log.
  • Use radians for trig functions.
  • Constants available: pi and e.

Bottom line

This f of g calculator is designed for fast homework checks, exam prep, and concept reinforcement. Enter your functions, compute instantly, and use the symbolic composition output to verify your manual algebra.

🔗 Related Calculators