Skip to content
LoveToCalc

Definition — what does that mean?

Composite function

Run g first, then f on whatever g gives back — and know that the other order is a different function.

In Swedish: Sammansatt funktion

y=f(g(x))

x
The input value
y
The composed function, evaluated at x

What the formula says

(f ∘ g)(x) = f(g(x))

The composite function f ∘ g, read “f composed with g” or “f of g”, takes an x, lets g work on it, and then hands g’s answer to f. It is a definition: this is what composition means, and it holds for any functions f and g where g’s values can be put into f.

Read it from the inside out. The function next to x works first, even though it comes last in the name f ∘ g. Swap f and g and you usually get a different function altogether.

Worked examples

Let f(x) = 2x + 1 and g(x) = x².

f(g(3)). First g: g(3) = 3² = 9. Then f on that: f(9) = 2 · 9 + 1 = 19.

g(f(3)). First f: f(3) = 2 · 3 + 1 = 7. Then g: g(7) = 7² = 49. The same two functions and the same x, but a different answer, because they work in a different order.

The whole expression. Put g(x) where f has its x: f(g(x)) = 2x² + 1. The other way round, g(f(x)) = (2x + 1)² = 4x² + 4x + 1. Check with x = 3: 2 · 9 + 1 = 19 and 36 + 12 + 1 = 49.

When the inner function decides the domain. Let f(x) = √x and g(x) = x². Then f(g(x)) = √(x²) = |x|, which can be worked out for every x. But g(f(x)) = (√x)² = x can only be worked out for x ≥ 0, because √x has to exist first.

To differentiate a composite function, use the chain rule. If the composition gives x back unchanged in both orders, f and g are each other’s inverses.

Common mistakes

Common questions

Which function goes first, f or g? g, the one next to x. In (f ∘ g)(x) = f(g(x)), g(x) is worked out first, and that answer is what f works on.

Is f ∘ g the same as g ∘ f? Usually not. With f(x) = 2x + 1 and g(x) = x², f(g(3)) = 19 but g(f(3)) = 49. There are pairs where the order does not matter, such as a function and its inverse, but they are the exception.

Where do composite functions come up? Anywhere one result is worked on further. A discounted price that then has sales tax added is a composition of two functions, and differentiating something like sin(3x) or e^(x²) means seeing it as one.

Last reviewed October 6, 2026 ·How pages are reviewed

Functions and graphsAll formulas