MathematicsCore20 min read

Functions and Graphs

Domain, range, and the shapes you should recognise before plotting a point

This topic appears in:

01

A function is a machine with one output per input

Definition

Domain — The set of all values of x for which f(x) is defined. In practice you find it by asking what would break: a denominator becoming zero, or a square root of a negative number.

A function f from a set A to a set B assigns to every element of A exactly one element of B. Written f: A → B, with y = f(x), the input x is the independent variable and the output y the dependent one.

Three sets are involved and the exam distinguishes them. The domain is the set of allowed inputs. The codomain is the set the outputs are drawn from. The range is the set of outputs actually produced, and it can be smaller than the codomain.

FunctionWhat breaksDomain
f(x) = 3x − 5nothingall real x
f(x) = 1/(x − 4)denominator zero at x = 4x ≠ 4
f(x) = √(x − 2)root of a negative below x = 2x ≥ 2
f(x) = 1/√(x − 2)both faults at oncex > 2
f(x) = x²nothingall real x, but range y ≥ 0
02

The graph shapes worth knowing by sight

Recognising the family a function belongs to tells you the shape, the domain, the range and the asymptotes before you plot anything. It also catches a wrong table of values in seconds.

  • Constant f(x) = c — a horizontal line. Range is the single value c.
  • Linear f(x) = mx + c — a straight line, domain and range both all of ℝ (unless m = 0).
  • Quadratic f(x) = ax² + bx + c — a parabola. The range is bounded on one side by the vertex.
  • Cubic — two turning points at most, ends going opposite ways, range all of ℝ.
  • Reciprocal f(x) = k/x — two branches with both axes as asymptotes.
  • Exponential f(x) = aˣ — through (0, 1), never negative, the x-axis an asymptote.
  • Modulus f(x) = |x| — a V shape with a corner at the origin; range y ≥ 0.

Look at the reciprocal graph. Two separate branches, and the curve approaches both axes for ever without touching either — x = 0 is excluded from the domain and y = 0 is never in the range.

03

Types of function, and why bijections matter

The classification you met in Class 9 becomes useful here, because it decides whether a function can be undone.

A function is one-one (injective) if different inputs always give different outputs; onto (surjective) if every element of the codomain is used; and bijective if it is both. Only a bijection has an inverse, because undoing requires each output to identify its input uniquely.

Worked example

For f(x) = 3x − 7, find f⁻¹(x) and verify that f(f⁻¹(x)) = x.

  1. Write y = 3x − 7.Replacing f(x) by y makes the next step easier to see.
  2. Make x the subject: 3x = y + 7, so x = (y + 7)/3.The inverse undoes each operation in reverse order: add 7, then divide by 3.
  3. Swap the letters back: f⁻¹(x) = (x + 7)/3.By convention the input of any function is called x.
  4. Check: f(f⁻¹(x)) = 3[(x + 7)/3] − 7 = (x + 7) − 7 = xA correct inverse always composes back to x. This check costs one line and catches sign errors.

f⁻¹(x) = (x + 7)/3

Why f(x) = x² has no inverse over all of ℝ

Both 3 and −3 map to 9, so f is not one-one, and asking "which input gave 9" has two answers. Restricting the domain to x ≥ 0 fixes it, and only then is f⁻¹(x) = √x a genuine function. Whenever a question asks you to state a restriction, this is what it is testing.

04

Composition of functions

The composite (fg)(x), also written f(g(x)), means: apply g first, then apply f to the result. The order in which they are written is the reverse of the order in which they act, which is the source of nearly every error here.

Composition is not commutative: fg and gf are usually different functions, and exam questions are built on exactly that.

(f ∘ g)(x) = f(g(x))inner function first(f ∘ f⁻¹)(x) = x(f⁻¹ ∘ f)(x) = xa function and its inverse cancel in either order
Worked example

If f(x) = x + 4 and g(x) = x², find fg(2) and gf(2).

  1. fg(2) = f(g(2)). First g(2) = 4.The inner function acts first, however the composite is written.
  2. Then f(4) = 4 + 4 = 8.
  3. gf(2) = g(f(2)). First f(2) = 6, then g(6) = 36.The same two functions in the other order.
  4. 8 ≠ 36, confirming that composition is not commutative.Stating this conclusion is often worth a mark in itself.

fg(2) = 8; gf(2) = 36

Before you leave this chapter

  1. Domain = allowed inputs. Find it by asking what breaks: a zero denominator or a negative under a square root.
  2. Range = the outputs actually produced, which may be smaller than the codomain.
  3. Recognise the seven standard shapes before plotting; the shape checks your table of values.
  4. Only a bijection has an inverse. Find it by making x the subject, then swapping the letters.
  5. In f(g(x)) the inner function acts first, and fg is generally not the same as gf.
06

Inverse functions, and when one exists

An inverse function undoes what the function did. If f takes 3 to 11, then f⁻¹ takes 11 back to 3, and the composition f⁻¹f(x) = x leaves every input exactly where it started.

Not every function has one. If two different inputs share an output, the reverse journey has no way of deciding which input to return to — the undoing is ambiguous. So an inverse exists only when the function is one-to-one, which is what the horizontal line test checks: no horizontal line may cross the graph more than once.

This is why f(x) = x² has no inverse over all real numbers — both 3 and −3 give 9 — but does have one if the domain is restricted to x ⩾ 0. Restricting the domain to force a function to be one-to-one is a standard exam instruction, not a technicality.

Worked example

The function f is defined by f(x) = 2x − 5 for x ∈ ℝ. Find f⁻¹(x), and state its domain and range.

  1. Write y = 2x − 5.Naming the output is what makes the next step a matter of ordinary algebra.
  2. Rearrange for x: y + 5 = 2x, so x = (y + 5)/2.Making x the subject is literally the undoing — you are asking which input produced this output.
  3. Swap the letters: f⁻¹(x) = (x + 5)/2.The inverse is a function of its own input, so the variable is renamed to x by convention.
  4. Domain of f⁻¹ = range of f = ℝ. Range of f⁻¹ = domain of f = ℝ.Domain and range always swap, because the arrows have been reversed. This is worth a mark of its own and is regularly forgotten.

f⁻¹(x) = (x + 5)/2, with domain and range both ℝ

The graph of an inverse is a reflection

Reversing every input–output pair swaps the coordinates of every point: (a, b) becomes (b, a). Geometrically that is a reflection in the line y = x. So the graph of f⁻¹ can always be sketched by reflecting the graph of f in that line — and any point where the two graphs meet must lie on y = x, which is often the quickest route to a solution.

07

Transforming a graph

Four changes to a formula move or reshape its graph in predictable ways. The one that consistently causes trouble is that changes made inside the bracket behave in the opposite direction to expectation, because they act on the input before the function ever sees it.

To get f(x − 3) to produce the value that f gave at 0, you must feed in x = 3. The whole graph therefore arrives 3 units later — a shift to the right, from a minus sign.

ChangeEffect on the graphDirection
f(x) + atranslation a units upoutside — as expected
f(x + a)translation a units leftinside — reversed
a·f(x)stretch, scale factor a, from the x-axisoutside — as expected
f(ax)stretch, scale factor 1/a, from the y-axisinside — reversed
−f(x)reflection in the x-axisoutside
f(−x)reflection in the y-axisinside

Order matters when transformations are combined

For something like y = 2f(x + 1) − 3, apply the inside change first (translate 1 left), then the outside ones in the order they act on the output (stretch by 2, then translate 3 down). Applying them in a different order generally lands the curve somewhere else, and questions are set specifically to catch that.

Practice questions

6 questions · 20 marks · full working on every one

Try each one on paper first, then open the working. The marks are shown where they are actually awarded, because that is where they are actually lost.

Short questions

3 · 6 marks

Two marks each, in the style of the short-question section of the paper. Answer in two or three lines.

SQ1[2 marks]
State the domain of f(x) = 1 / (x² − 9).
Model answer

The denominator is zero when x² = 9, that is at x = 3 and x = −3. The domain is therefore all real numbers except 3 and −3.

Examiner tip. Factorise the denominator first — x² − 9 = (x − 3)(x + 3) — so that both excluded values are visible. Quoting only one of them loses a mark.

SQ2[2 marks]
Explain why f(x) = x² defined on all of ℝ has no inverse function.
Model answer

It is not one-one: f(3) = f(−3) = 9, so the output 9 does not identify a unique input. An inverse would have to assign two values to 9, which no function may do. Restricting the domain to x ≥ 0 makes it one-one and the inverse √x then exists.

Examiner tip. Give a concrete pair of inputs. "It is not one-one" alone usually scores 1 out of 2.

SQ3[2 marks]
State the range of f(x) = x² + 3.
Model answer

Since x² ≥ 0 for every real x, the smallest value of f is 3, reached at x = 0. The range is f(x) ≥ 3.

Examiner tip. Range questions on quadratics are answered from the vertex. Find the turning point and decide whether the parabola opens up or down.

Solved numericals

2 · 8 marks

Full working, one step per line, with the marks shown where they are awarded.

N1[4 marks]
Given f(x) = 2x + 1 and g(x) = x² − 3, find fg(x), gf(x) and the value of x for which fg(x) = gf(x).
Full working
  1. fg(x) = f(x² − 3) = 2(x² − 3) + 1 = 2x² − 5substitute the whole of g into f[1]
  2. gf(x) = g(2x + 1) = (2x + 1)² − 3 = 4x² + 4x − 2expand the bracket fully[1]
  3. Set them equal: 2x² − 5 = 4x² + 4x − 2, so 2x² + 4x + 3 = 0[1]
  4. Discriminant = 16 − 24 = −8 < 0, so there is no real value of x for which they are equala reasoned "no solution" is the answer, not an omission[1]

fg(x) = 2x² − 5; gf(x) = 4x² + 4x − 2; no real x makes them equal

Examiner tip. When a quadratic you have derived has a negative discriminant, say so explicitly. An unfinished answer and a correct "no real solution" look very different to an examiner.

N2[4 marks]
The function f(x) = (2x − 3)/(x + 1) is defined for x ≠ −1. Find f⁻¹(x).
Full working
  1. Let y = (2x − 3)/(x + 1) and multiply up: y(x + 1) = 2x − 3clear the fraction before rearranging[1]
  2. xy + y = 2x − 3, so xy − 2x = −3 − ygather every term containing x on one side[1]
  3. x(y − 2) = −(3 + y), so x = −(y + 3)/(y − 2)factorising out x is the key step[1]
  4. f⁻¹(x) = −(x + 3)/(x − 2), or equivalently (x + 3)/(2 − x)either form accepted[1]

f⁻¹(x) = (x + 3)/(2 − x), x ≠ 2

Examiner tip. For a fractional function, always clear the denominator first and then collect the x terms. Trying to rearrange while the fraction is still there is where students get stuck.

Long questions

1 · 6 marks

Theory and numerical together, as they appear in the long-question section.

LQ1[6 marks]
The function f is defined by f(x) = √(x − 4).
  1. State the domain and the range of f.
  2. Find f⁻¹(x) and state its domain.
  3. Explain the relationship between the domain and range of f and those of f⁻¹.
Mark scheme
  1. Need x − 4 ≥ 0, so the domain is x ≥ 4a square root requires a non-negative argument[1]
  2. A square root is never negative, so the range is f(x) ≥ 0[1]
  3. y = √(x − 4) gives y² = x − 4, so x = y² + 4squaring is safe here because y ≥ 0[1]
  4. f⁻¹(x) = x² + 4[1]
  5. Domain of f⁻¹ is x ≥ 0not all of ℝ — it must match the range of f[1]
  6. The domain of f⁻¹ is the range of f, and the range of f⁻¹ is the domain of f — the inverse swaps the two sets[1]

(a) domain x ≥ 4, range f(x) ≥ 0 (b) f⁻¹(x) = x² + 4 with domain x ≥ 0 (c) inverting swaps domain and range

Examiner tip. Part (b) is only worth full marks with its domain restriction. x² + 4 alone would be defined for every x, which would not be the inverse of this f.