Chapter 09

9. Functions & Graphs

Middle School

A 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.

At a glance
Core ideaA function is a machine that gives each input exactly one output.
Key termVertical-line test: a graph is a function if no vertical line meets it twice.
You can…Find a line's slope and equation, and shift, stretch or reflect a graph.
Watch outf(x + 2) shifts the graph LEFT, not right.
01 · Theory

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:

slope  m = (y₂ − y₁) / (x₂ − x₁)

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.
02 · Explanation

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.

y = f(x) f(x) + k ↑ up f(x + k) ← left
Adding k outside the function lifts the whole graph up; adding k inside — f(x + k) — slides it left, the counter-intuitive shift.
03 · Practical

Worked example: line through two points, then composition

Problem A — equation of a line

Find the equation of the line through (1, 4) and (3, 10).

  1. Slope m = (10 − 4)/(3 − 1) = 6/2 = 3.
  2. Use point-slope with (1, 4): y − 4 = 3(x − 1).
  3. Expand: y = 3x − 3 + 4 = 3x + 1. Check (3, 10): 3(3) + 1 = 10. ✓
Problem B — composition

If f(x) = 2x + 1 and g(x) = x², find f(g(3)).

  1. Inner first: g(3) = 3² = 9.
  2. Feed into f: f(9) = 2(9) + 1 = 19.
04 · Q&A

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.

Concept mind map

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.

Function machineDomainRangeVertical-line testStraight-linegraphCompositionFunctions and Graphs
Infographic

The key facts, visualised

f(x)
Output of the function for input x
Domain
Set of allowed inputs
Range
Set of possible outputs
y=mx+c
Line with slope m, intercept c
Solved examples

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).

  1. Slope m = (7 - 3)/(3 - 1) = 2
  2. Use y - 3 = 2(x - 1)
  3. Simplify: y = 2x + 1

Example 2If f(x) = x + 2 and g(x) = 3x, find f(g(2)).

  1. g(2) = 3 x 2 = 6
  2. f(6) = 6 + 2 = 8
  3. So f(g(2)) = 8
Practice problem set

Now you try

Work each one out first, then tap to reveal the worked answer.

1Give the domain of f(x) = 1/x.
All real numbers except x = 0, since dividing by zero is undefined.
2Does a vertical line pass the vertical-line test as a function?
No, one input has many outputs, so it is not a function.
3For f(x) = 2x - 5, find f(4).
f(4) = 2(4) - 5 = 3.
4What is the slope of y = -3x + 2?
The slope is -3.
5If g(x) = x^2, find g(-3).
g(-3) = 9.
6Find the range of f(x) = x^2 for all real x.
Squares are never negative, so the range is y >= 0.