Skip to content
FiftyCalc Free calculators for all 50 states

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

Sample figures

(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.

Function Composition Calculator

f: a, coefficient of x²: enter a number. Prefilled example: 0.

f: b, coefficient of x: enter a number. Prefilled example: 2.

f: c, constant: enter a number. Prefilled example: 1.

g: d, coefficient of x²: enter a number. Prefilled example: 1.

g: e, coefficient of x: enter a number. Prefilled example: 0.

g: k, constant: enter a number. Prefilled example: -3.

Value of x: enter a number. Prefilled example: 2.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. f: a, coefficient of x²: enter a number.
  2. f: b, coefficient of x: enter a number.
  3. f: c, constant: enter a number.
  4. g: d, coefficient of x²: enter a number.
  5. g: e, coefficient of x: enter a number.
  6. g: k, constant: enter a number.
  7. Value of x: enter a number.
  8. 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

  1. Gx=d×x2+e×x+k
  2. Fgx=a×Gx2+b×Gx+c
Symbols used in the formula
SymbolMeaning
af: a, coefficient of x²
bf: b, coefficient of x
cf: c, constant
dg: d, coefficient of x²
eg: e, coefficient of x
kg: k, constant
xValue of x
Gxg(x)
Fgx(f ∘ g)(x) = f(g(x))

Worked example

f: a, coefficient of x²0
f: b, coefficient of x2
f: c, constant1
g: d, coefficient of x²1
g: e, coefficient of x0
g: k, constant-3
Value of x2
(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 x0
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 x4
g(f(x)): coefficient of the constant-2
  1. Gx=1×22+0×2+−3=1
  2. Fgx=0×12+2×1+1=3

(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.

Related calculators