# Composite functions

Up a level : IB Mathematics
Previous page : Various definitions
Next page : Functions, Quiz 2, composite functions Composite functions [SL/HL]

If we have a function f (x) and a function g(x)  then the function

y=f (g (x))

is the function we get by first applying the function g then the function f.

The expression f (g (x)) is read “f of g of x“.

One can often see this written as

y=(f g)(x)

Say we have f (x)=2x+3 and g (x)=x2+x, then we have that

f (g (x))=f (x2+x)=2(x2+x)+3=2x2+2x+3

We thus replace g (x) by x2+x, then use that instead of x in f (x)=2x+3.

If we instead look at

g (f (x))=g (2x+3)=(2x+3)2+(2x+3)
=4x2+12x+9+2x+3
=4x2+14x+12

then we get a different result. We thus have that f (g (x)) is usually not equal to
g (f (x)).

If you are given a value for x, say if you are to find f (g(2)) then don’t spend time creating the composite function first, unless you need it later on. Instead calculate g (2) = 22+2 =6, then you calculate f (6)=2·6+3=15. This is way faster.