Chalk−1

Math · College algebra · Worked example

Compose two functions in both orders

For f(x) = 2x + 1 and g(x) = x², find (f ∘ g)(x) and (g ∘ f)(x), and evaluate both at x = 3.

f⁡(x)=2⁢x+1,g⁡(x)=x2

Find f(g(x))

Put g(x) = x² into f: double it and add 1.

f⁡(g⁡(x))=2x2+1

Find g(f(x))

Put f(x) = 2x + 1 into g: square it.

g⁡(f⁡(x))=(2⁢x+1)2=4x2+4⁢x+1
g⁡(f⁡(x))=(2⁢x+1)2=4x2+4⁢x+1

Evaluate at 3

Inside first: g(3) = 9, then f(9) = 19. In the other order, f(3) = 7, then g(7) = 49.

f⁡(x)=2⁢x+1g⁡(x)=x2g⁡(3)=9f⁡(9)=19f⁡(3)=7g⁡(7)=49

Compare the orders

19 and 49 differ, so the two composites are different functions: composition is not commutative.

Result

(f ∘ g)(x) = 2x² + 1 and (g ∘ f)(x) = (2x + 1)² = 4x² + 4x + 1. At x = 3 they give 19 and 49.

Your turn

For f(x) = √x and g(x) = x − 4, find f(g(x)) and its domain.

Show the answer and explanation

f(g(x)) = √(x − 4), for x ≥ 4.

Apply g first, then take the square root: √(x − 4). Every real x is allowed in g, but the square root needs x − 4 ≥ 0, so the domain is x ≥ 4.

f⁡(g⁡(x))=x−4,x≥4

Keep exploring

In Graph, plot 2x² + 1 and (2x + 1)². The curves cross only where 2x² + 1 = (2x + 1)², at x = 0 and x = −2, so the two composites agree at just those inputs.

Return to the concept →
Sources and scope

Authored study material. Tool results depend on the stated inputs and model assumptions.

Make it concrete

Try in the workspace

Open the example inputs, change a value and keep a useful result on your board.

Check the values in Math See both composites in Graph Open worked example on a board Composition in Math Reference

Your existing work stays on this device. Examples open as editable copies.