Composite Function Calculator
This composite function calculator finds f(g(x)) and g(f(x)) for two polynomial functions, expands them, and evaluates both at a value of x you choose. For example, with f(x) = 2x + 3 and g(x) = x², f(g(x)) = 2x² + 3 and g(f(x)) = 4x² + 12x + 9.
Result
Enter values and press Calculate to see the result.
Formula
Apply g first, then f: replace every x in f with g(x).
The other order. In general f(g(x)) and g(f(x)) are different.
How to use this calculator
- Type f(x) and g(x) as polynomials, e.g. 2x + 3 and x^2.
- Choose a value of x to evaluate the composite functions at.
- Press Calculate to see f(g(x)) and g(f(x)) expanded, their values, and the substitution steps. To graph the function, open it in the graphing calculator.
Worked examples
f(g(x)) and g(f(x)) for a linear and a quadratic function
f(g(x)): replace x in 2x + 3 with x², giving 2x² + 3.
g(f(x)): square 2x + 3, giving 4x² + 12x + 9.
At x = 2: g(2) = 4, so f(g(2)) = 11; f(2) = 7, so g(f(2)) = 49.
A shift inside a quadratic
f(g(x)) = (x + 1)² − 1 = x² + 2x.
g(f(x)) = (x² − 1) + 1 = x².
At x = 3: f(g(3)) = f(4) = 15 and g(f(3)) = g(8) = 9.
A cubic composed with a linear function
f(g(x)) = (x − 2)³ = x³ − 6x² + 12x − 8.
g(f(x)) = x³ − 2.
At x = 1 both are −1: (1 − 2)³ = −1 and 1³ − 2 = −1.
Common mistakes
- Multiplying instead of composing: f(g(x)) is not f(x)·g(x).
- Working in the wrong order: f(g(x)) applies g first.
- Substituting without brackets: with g(x) = x + 1, f(x) = x² gives (x + 1)², not x² + 1.
- Assuming f(g(x)) = g(f(x)) — it usually isn’t.
Frequently asked questions
How do you find f of g of x?
Write f(x), then replace every x with the whole expression g(x) in brackets, and simplify. For f(x) = 2x + 3 and g(x) = x², f(g(x)) = 2x² + 3.
What is the domain of a composite function?
The x-values in the domain of g whose output g(x) is in the domain of f. For the polynomials this calculator takes, both domains are all real numbers, so f(g(x)) is defined everywhere.
Can I graph the function?
Yes — copy f(g(x)) into the Sumzo graphing calculator to plot it, see where it crosses the x-axis and read a table of values.
Which functions can I enter?
Polynomials up to degree 6, such as 3x^2 - x + 4 or (x + 1)^3. Fractions like 1/2 x work as coefficients.