Function Composition Calculator
Test cases replayed : 2 of 2 match · Methodology · No outside source listed
Enter f(x) = ax² + bx + c and g(x) = dx² + ex + k (use 0 for missing terms; a = 0 makes f linear). The calculator expands f(g(x)) and g(f(x)) and evaluates both at your x.
Result
(f ∘ g)(x) = f(g(x))
(g ∘ f)(x) = g(f(x))
- g(x)
- f(x)
- f(g(x)): coefficient of x⁴
- f(g(x)): coefficient of x³
- f(g(x)): coefficient of x²
- f(g(x)): coefficient of x
- f(g(x)): coefficient of the constant
- g(f(x)): coefficient of x⁴
- g(f(x)): coefficient of x³
- g(f(x)): coefficient of x²
- g(f(x)): coefficient of x
- g(f(x)): coefficient of the constant
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- f: a, coefficient of x²: enter a number.
- f: b, coefficient of x: enter a number.
- f: c, constant: enter a number.
- g: d, coefficient of x²: enter a number.
- g: e, coefficient of x: enter a number.
- g: k, constant: enter a number.
- Value of x: enter a number.
- Read the result: (f ∘ g)(x) = f(g(x)); the panel also shows (g ∘ f)(x) = g(f(x)), g(x), f(x), f(g(x)): coefficient of x⁴, f(g(x)): coefficient of x³, f(g(x)): coefficient of x², f(g(x)): coefficient of x, f(g(x)): coefficient of the constant, g(f(x)): coefficient of x⁴, g(f(x)): coefficient of x³, g(f(x)): coefficient of x², g(f(x)): coefficient of x and g(f(x)): coefficient of the constant.
How this calculator works
Composition: (f ∘ g)(x) = f(g(x)), so g is applied first and its output is the input of f. In general f(g(x)) ≠ g(f(x)).
Expanding f(g(x)) = a(dx² + ex + k)² + b(dx² + ex + k) + c gives a d² x⁴ + 2ade x³ + (a(e² + 2dk) + bd) x² + (2aek + be) x + (ak² + bk + c). g(f(x)) is the same with the roles of the two functions swapped.
Read the expanded polynomial from the coefficients listed, highest power first. The domain of a composition of polynomials is all real numbers.
The formula
| Symbol | Meaning |
|---|---|
| f: a, coefficient of x² | |
| f: b, coefficient of x | |
| f: c, constant | |
| g: d, coefficient of x² | |
| g: e, coefficient of x | |
| g: k, constant | |
| Value of x | |
| g(x) | |
| (f ∘ g)(x) = f(g(x)) |
Worked example
| f: a, coefficient of x² | 0 |
|---|---|
| f: b, coefficient of x | 2 |
| f: c, constant | 1 |
| g: d, coefficient of x² | 1 |
| g: e, coefficient of x | 0 |
| g: k, constant | -3 |
| Value of x | 2 |
| (g ∘ f)(x) = g(f(x)) | 22 |
|---|---|
| g(x) | 1 |
| f(x) | 5 |
| f(g(x)): coefficient of x⁴ | 0 |
| f(g(x)): coefficient of x³ | 0 |
| f(g(x)): coefficient of x² | 2 |
| f(g(x)): coefficient of x | 0 |
| f(g(x)): coefficient of the constant | -5 |
| g(f(x)): coefficient of x⁴ | 0 |
| g(f(x)): coefficient of x³ | 0 |
| g(f(x)): coefficient of x² | 4 |
| g(f(x)): coefficient of x | 4 |
| g(f(x)): coefficient of the constant | -2 |
(f ∘ g)(x) = f(g(x)) 3
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
What is f(g(x)) if f(x) = 2x + 1 and g(x) = x² − 3?
f(g(x)) = 2(x² − 3) + 1 = 2x² − 5, and g(f(x)) = (2x + 1)² − 3 = 4x² + 4x − 2. At x = 2 they give 3 and 22.
Is function composition the same as multiplication?
No. f(g(x)) feeds g's output into f; f(x) · g(x) multiplies the two outputs.
In what order do I evaluate f(g(2))?
Inside first: compute g(2), then put that number into f.