9. Functions & Graphs
Middle SchoolA function is a machine that turns each input into exactly one output. Graphs make functions visible. This chapter defines functions precisely, reads their behaviour from graphs, and introduces transformations.
Domain, range and the vertical-line test
A function f assigns to every input x in its domain exactly one output f(x); the set of outputs produced is the range. The defining rule is single-valuedness: one input, one output.
On a graph this becomes the vertical-line test: a curve is a function only if no vertical line crosses it more than once. A straight line y = mx + c has slope m (rise over run) and y-intercept c. Between two points:
Transformations reshape a graph predictably. Starting from y = f(x):
- f(x) + k shifts up by k; f(x + k) shifts left by k.
- a·f(x) stretches vertically by factor a; −f(x) reflects in the x-axis.
Functions as reliable machines
The single-valued rule is what makes a function trustworthy: feed it 3 today and it returns 9; feed it 3 next year and it still returns 9. A relation that could give two different answers for the same input (like "y² = x") is not a function — you could not rely on it. That is precisely what the vertical-line test detects.
Transformations are worth internalising because they let you understand a complicated graph as a simple one that has been moved and stretched. The one counter-intuitive case is the horizontal shift: f(x + 2) moves the graph left, not right. The reason is that the input reaches its "trigger" value 2 units sooner, so every feature happens earlier along the x-axis.
Worked example: line through two points, then composition
Find the equation of the line through (1, 4) and (3, 10).
- Slope m = (10 − 4)/(3 − 1) = 6/2 = 3.
- Use point-slope with (1, 4): y − 4 = 3(x − 1).
- Expand: y = 3x − 3 + 4 = 3x + 1. Check (3, 10): 3(3) + 1 = 10. ✓
If f(x) = 2x + 1 and g(x) = x², find f(g(3)).
- Inner first: g(3) = 3² = 9.
- Feed into f: f(9) = 2(9) + 1 = 19.
Test your understanding
Is the circle x² + y² = 25 a function?
No. For x = 3 it gives both y = 4 and y = −4, so a vertical line cuts it twice — it fails the vertical-line test. A circle is a valid relation, but to make it a function you must restrict to one half, e.g. the upper semicircle y = +√(25 − x²).
What is the domain of f(x) = 1/(x − 2)?
Everything except where the denominator is zero. Setting x − 2 = 0 gives x = 2, which must be excluded. Domain: all reals except 2, written x ≠ 2. At x = 2 the graph has a vertical asymptote.
How does the graph of y = f(x − 3) − 2 relate to y = f(x)?
Two shifts. The (x − 3) moves the graph 3 units right (input reaches its value later), and the − 2 moves it 2 units down. So the whole graph translates by the vector (+3, −2), with its shape unchanged.
Do f(g(x)) and g(f(x)) always give the same result?
No — composition is generally not commutative. With f(x) = 2x + 1, g(x) = x²: f(g(x)) = 2x² + 1, but g(f(x)) = (2x + 1)² = 4x² + 4x + 1. Order matters because you are literally doing one operation before the other.
How the ideas connect
Every key idea in this chapter, branching from the core concept — use it to see the whole picture at a glance.
The key facts, visualised
Worked problems, step by step
Follow each solution line by line, then try to reproduce it on paper before moving on.
Example 1Find the equation of the line through (1, 3) and (3, 7).
- Slope m = (7 - 3)/(3 - 1) = 2
- Use y - 3 = 2(x - 1)
- Simplify: y = 2x + 1
Example 2If f(x) = x + 2 and g(x) = 3x, find f(g(2)).
- g(2) = 3 x 2 = 6
- f(6) = 6 + 2 = 8
- So f(g(2)) = 8
Now you try
Work each one out first, then tap to reveal the worked answer.