Composition on a Graph

Category: Functions   Level: 201

f(g(1)): up to g, across to y = x, up to f

You can compose functions on a graph without any algebra. Go up to g, slide across to the line y = x to turn the output into an input, then go up to f.

Step through it

Watch it

Animated walkthrough

Step by step

Step 1: Draw f, g, and y = x

Graph g(x) = x + 1 and f(x) = x². Add the helper line y = x. It turns any height into the same x.

g(x) = x + 1, f(x) = x2, y = x

Step 1: Draw f, g, and y = x

Step 2: Go up to g

Start at x = 1 and go up until you hit g. The height there is g(1) = 2.

g(1) = 2

Step 2: Go up to g

Step 3: Slide across to y = x

The output 2 has to become the next input. Slide sideways to the line y = x, which puts you right above x = 2.

height 2 → x = 2

Step 3: Slide across to y = x

Step 4: Go up to f

From (2, 2) go up to f. The height there is f(2) = 4, so f(g(1)) = 4. Three moves, no algebra.

f(g(1)) = f(2) = 4

Step 4: Go up to f

Step 5: Plot the whole composition

Repeat for every x and you trace y = (x + 1)², the graph of f ∘ g. It passes through (1, 4), the point the three moves found.

(f ∘ g)(x) = (x + 1)2, (f ∘ g)(1) = 4

Step 5: Plot the whole composition

All steps at once

Storyboard

Generate it yourself

cd svg-generator
python3 -m svgmath render function-composition-graph --out /tmp/function-composition-graph

Source: svgmath/diagrams/function_operations.py