Function Composition Examples in Math

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Function Composition.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in Math.

Concept Recap

Function composition applies one function to the output of another: (f∘g)(x)=f(g(x))(f \circ g)(x) = f(g(x)), meaning evaluate gg first, then apply ff to the result.

Chain two machines togetherβ€”output of the first goes into the second.

Read the full concept explanation β†’

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: Composition feeds the result of the inner function straight into the outer function.

Common stuck point: The procedure for function composition is the easy part; the trap is applying ff before gg in (f∘g)(x)(f\circ g)(x). Asking "Is the output of one function being used as the input of another, in a fixed order?" first is what keeps a correct-looking calculation from being attached to the wrong concept.

Sense of Study hint: Ask: Is the output of one function being used as the input of another, in a fixed order?

Worked Examples

Example 1

easy
Given f(x)=2x+1f(x) = 2x + 1 and g(x)=x2g(x) = x^2, find (f∘g)(3)(f \circ g)(3).

Answer

1919

First step

1
(f∘g)(3)(f \circ g)(3) means f(g(3))f(g(3)), so evaluate the inner function first.

Full solution

  1. 2
    Compute g(3)=32=9g(3) = 3^2 = 9.
  2. 3
    Substitute that result into ff: f(9)=2(9)+1=19f(9) = 2(9) + 1 = 19.
Function composition works from the inside out: evaluate the inner function first, then feed its output into the outer function.

Example 2

medium
Given f(x)=x+3f(x) = x + 3 and g(x)=2x2βˆ’1g(x) = 2x^2 - 1, find the formula for (g∘f)(x)(g \circ f)(x).

Example 3

easy
Given f(x)=x2f(x)=x^2 and g(x)=xβˆ’3g(x)=x-3, compute both (f∘g)(5)(f\circ g)(5) and (g∘f)(5)(g\circ f)(5) and notice the order matters.

Example 4

medium
Given f(x)=xβˆ’1f(x)=\sqrt{x-1} and g(x)=x2g(x)=x^2, find (f∘g)(x)(f\circ g)(x) and state its domain.

Example 5

medium
Express h(x)=2x+5h(x)=\sqrt{2x+5} as a composition f∘gf\circ g with simple f,gf,g.

Example 6

hard
Let f(x)=11βˆ’xf(x)=\frac{1}{1-x}. Compute f(f(x))f(f(x)) and f(f(f(x)))f(f(f(x))) and describe what you observe.

Example 7

challenge
Define f1(x)=xx+1f_1(x)=\frac{x}{x+1} and fn+1=f1∘fnf_{n+1}=f_1\circ f_n. Find a closed form for fn(x)f_n(x).

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

easy
Given f(x)=xβˆ’4f(x) = x - 4 and g(x)=3xg(x) = 3x, find (f∘g)(5)(f \circ g)(5).

Example 2

hard
Given f(x)=xf(x) = \sqrt{x} and g(x)=x2+5g(x) = x^2 + 5, find the domain of (f∘g)(x)(f \circ g)(x).

Example 3

easy
If f(x)=x+1f(x)=x+1 and g(x)=2xg(x)=2x, find (f∘g)(3)(f\circ g)(3).

Example 4

easy
If f(x)=x2f(x)=x^2 and g(x)=x+3g(x)=x+3, find (f∘g)(1)(f\circ g)(1).

Example 5

easy
If f(x)=2xf(x)=2x and g(x)=xβˆ’1g(x)=x-1, find (g∘f)(4)(g\circ f)(4).

Example 6

easy
If f(x)=x+2f(x)=x+2 and g(x)=3xg(x)=3x, find (f∘g)(x)(f\circ g)(x).

Example 7

easy
If f(x)=xβˆ’5f(x)=x-5 and g(x)=x+5g(x)=x+5, find (f∘g)(x)(f\circ g)(x).

Example 8

easy
If f(x)=x2f(x)=x^2, find (f∘f)(2)(f\circ f)(2).

Example 9

easy
If f(x)=xf(x)=\sqrt{x} and g(x)=x+9g(x)=x+9, find (f∘g)(0)(f\circ g)(0).

Example 10

easy
If f(x)=3x+1f(x)=3x+1 and g(x)=xg(x)=x, find (f∘g)(x)(f\circ g)(x).

Example 11

medium
If f(x)=x+1f(x)=x+1 and g(x)=x2g(x)=x^2, find (f∘g)(x)(f\circ g)(x) and (g∘f)(x)(g\circ f)(x).

Example 12

medium
If f(x)=2xβˆ’1f(x)=2x-1 and g(x)=x+12g(x)=\frac{x+1}{2}, find (f∘g)(x)(f\circ g)(x).

Example 13

medium
If h(x)=(x+3)2h(x)=(x+3)^2, write hh as f∘gf\circ g.

Example 14

medium
If f(x)=x2+1f(x)=x^2+1 and (f∘g)(x)=x2+2x+2(f\circ g)(x)=x^2+2x+2, find g(x)g(x) (linear).

Example 15

medium
If f(x)=1xf(x)=\frac{1}{x} and g(x)=xβˆ’2g(x)=x-2, find the domain of (f∘g)(x)(f\circ g)(x).

Example 16

medium
If f(x)=3xf(x)=3x, find a function gg with (f∘g)(x)=x(f\circ g)(x)=x.

Example 17

medium
If f(x)=x+af(x)=x+a and (f∘f)(x)=x+6(f\circ f)(x)=x+6, find aa.

Example 18

medium
If f(x)=2xf(x)=2x and g(x)=x+1g(x)=x+1, find (f∘g∘f)(2)(f\circ g\circ f)(2).

Example 19

challenge
If f(x)=xx+1f(x)=\frac{x}{x+1}, find (f∘f)(x)(f\circ f)(x) simplified.

Example 20

challenge
If (f∘g)(x)=4x2+4x+2(f\circ g)(x)=4x^2+4x+2 and f(x)=x2+1f(x)=x^2+1, find a linear g(x)g(x).

Example 21

challenge
Functions satisfy f(x)=2x+3f(x)=2x+3 and f(g(x))=g(f(x))f(g(x))=g(f(x)) for all xx, with gg linear g(x)=mx+bg(x)=mx+b. Find a relation between mm and bb.

Example 22

medium
If f(x)=xβˆ’4f(x)=x-4 and g(x)=x2g(x)=x^2, find (g∘f)(x)(g\circ f)(x).

Example 23

easy
If f(x)=4xβˆ’3f(x)=4x-3 and g(x)=x+2g(x)=x+2, find (f∘g)(5)(f\circ g)(5).

Example 24

easy
If f(x)=x2βˆ’1f(x)=x^2-1 and g(x)=2xg(x)=2x, find (f∘g)(3)(f\circ g)(3).

Example 25

easy
If f(x)=x+7f(x)=x+7 and g(x)=2xβˆ’1g(x)=2x-1, find (f∘g)(x)(f\circ g)(x).

Example 26

medium
If f(x)=2x+5f(x)=2x+5 and g(x)=x2βˆ’4g(x)=x^2-4, find (f∘g)(x)(f\circ g)(x).

Example 27

medium
If f(x)=x2+xf(x)=x^2+x and g(x)=xβˆ’1g(x)=x-1, find (f∘g)(x)(f\circ g)(x) simplified.

Example 28

medium
If f(x)=1xβˆ’3f(x)=\frac{1}{x-3} and g(x)=x+1g(x)=x+1, find the domain of (f∘g)(x)(f\circ g)(x).

Example 29

medium
If f(x)=2x+1f(x)=2x+1 and (f∘g)(x)=2x+7(f\circ g)(x)=2x+7, find a linear g(x)g(x).

Example 30

medium
If g(x)=xβˆ’2g(x)=x-2 and (f∘g)(x)=x2βˆ’4x+1(f\circ g)(x)=x^2-4x+1, find f(x)f(x).

Example 31

medium
If f(x)=3xβˆ’1f(x)=3x-1, find (f∘f)(x)(f\circ f)(x).

Example 32

medium
Express h(x)=(3xβˆ’7)4h(x)=(3x-7)^4 as f∘gf\circ g.

Example 33

medium
If f(x)=1xf(x)=\frac{1}{x}, find (f∘f)(x)(f\circ f)(x) for xβ‰ 0x\ne 0.

Example 34

hard
Given f(x)=x2+1f(x)=x^2+1 and (g∘f)(x)=2x2+5(g\circ f)(x)=2x^2+5, find g(x)g(x).

Example 35

hard
If f(x)=x+1xβˆ’1f(x)=\frac{x+1}{x-1}, find (f∘f)(x)(f\circ f)(x) in simplified form for xβ‰ 1x\ne 1.

Example 36

hard
If f(x)=ax+bf(x)=ax+b and (f∘f)(x)=9x+8(f\circ f)(x)=9x+8, find all real (a,b)(a,b).

Example 37

hard
Find a function gg with (g∘g)(x)=4x+3(g\circ g)(x)=4x+3, assuming gg is linear.

Example 38

hard
If f(x)=2x+1f(x)=2x+1 and g(x)=xβˆ’3g(x)=x-3, find (f∘g)βˆ’1(x)(f\circ g)^{-1}(x).

Example 39

challenge
Find all linear functions f(x)=ax+bf(x)=ax+b (with aβ‰ 0a\ne 0) such that f∘f=fβˆ’1f\circ f= f^{-1}.

Related Concepts

Background Knowledge

These ideas may be useful before you work through the harder examples.

function definition