Function Composition Calculator

Substitute one function into another in the correct order, simplify it, and determine where the composition is defined.

Drag & drop or upload an image or PDF

Enter f(x), g(x), and the order, such as find f(g(x))

Name each function and the requested operation, such as f(x) = 2x + 3.

Try an example

Composition feeds one function into another

In f(g(x)), the function g acts first. Its output becomes the input of f. Parentheses are essential because the entire expression for g(x) replaces each occurrence of x in f.

Order matters. The functions f composed with g and g composed with f usually produce different formulas and can have different domains. A composite input must be valid for the inner function, and the inner output must be accepted by the outer function.

How to use the function composition calculator

Enter the problem as written

Type or paste the full expression. You can also upload a clear photo or PDF and check the extracted text before solving.

Read the working, not only the answer

Each transformation is separated and explained so you can compare it with your own method.

Ask about any step

Continue in the same solution to request another method, check a restriction, or ask why a rule applies.

Definition of function composition

Evaluate g first, then use its complete output as the input to f.

A reliable way to work through it

Read from the inside out

Identify the innermost function and calculate or substitute it before applying the outer function.

Protect the substitution

Place the complete inner expression in parentheses wherever the outer function uses its input.

Check the composite domain

Keep inputs valid for the inner function and exclude any whose inner outputs violate the outer function domain.

Worked example

Find f(g(x)) when f(x) = x^2 + 1 and g(x) = 3x - 2

Replace the input of f with the entire expression g(x).

Substitute the formula for g.

Expand the squared binomial.

Add the remaining constant and combine like terms.

The composition is f(g(x)) = 9x^2 - 12x + 5 for every real x.

Common mistakes to check

Multiplying the function formulas

The notation f(g(x)) means substitution, not the product f(x)g(x).

Reversing the order

In f(g(x)), g is evaluated first. Switching the order normally changes the result.

Losing domain restrictions

Simplification can hide a denominator or radical restriction inherited from either component function.

Questions students ask

What does f composed with g mean?

It means apply g to the input first, then apply f to the output from g.

Are f(g(x)) and g(f(x)) always equal?

No. Function composition is generally order-dependent, so the two formulas and their domains can differ.

Is composition the same as multiplying functions?

No. Composition substitutes one function into another, while multiplication multiplies their output values.

How is the domain of a composition found?

The input must belong to the inner function domain, and the inner output must belong to the outer function domain.