STEMviz
Mathematics · Functions, Equations and Trigonometry

The Concept of a Function, Domain and Range

Defines functions, domain and range, and develops the methods — restriction checklists, the solve-for-x technique, and graph reading — used to find them for any formula.

The Concept of a Function, Domain and Range

A function is the single most important organising idea in the rest of this course: every topic from quadratics to derivatives is really a statement about how one function behaves. Before any of that can be built, you need a precise definition — not "a function is like a machine" but a definition precise enough to decide, for a given pairing of numbers, whether it qualifies. This chapter builds that definition, then develops the two sets that attach to every function: its domain (what you are allowed to put in) and its range (what can come out).

To work through this chapter you need confidence with set notation (∈\in, R\mathbb{R}, interval notation), inequalities, and the graphs of y=x2y=x^2, y=xy=\sqrt{x} and y=1xy=\dfrac{1}{x} from earlier study. Nothing here requires calculus; it is the algebraic foundation the rest of Block B stands on.

1. Relations and the Definition of a Function

A relation is simply any rule that associates elements of one set with elements of another. Not every relation is useful for prediction: knowing an input might allow several possible outputs, which makes it useless as a model of a deterministic process. A function ff from a set AA (the domain) to a set BB is a relation in which

Definition. Every element of AA is mapped to exactly one element of BB. We write f:A→Bf : A \to B, and for x∈Ax \in A the resulting element of BB is f(x)f(x), read "ff of xx".

The phrase "exactly one" is the entire content of the definition. A={1,2,3}A = \{1,2,3\} mapped to B={4,5}B=\{4,5\} by 1↦4, 2↦4, 3↦51 \mapsto 4,\ 2\mapsto 4,\ 3 \mapsto 5 is a function (every input has one output, even though two inputs share an output). But the rule "xx maps to a number whose square is xx" is not a function on x≥0x \geq 0, because x=4x=4 would have to map to both 22 and −2-2.

The vertical line test. On a Cartesian graph, a curve represents a function of xx if and only if no vertical line x=cx = c cuts the curve more than once. The circle x2+y2=25x^2+y^2=25 fails this test (the vertical line x=3x=3 meets it at y=4y=4 and y=−4y=-4) and so is not the graph of a function of xx, even though it is a perfectly good relation.

2. Domain: What Is Allowed In

The domain of ff is the complete set of input values for which f(x)f(x) is defined. When a function is given by a formula without a stated domain, the convention is the natural domain: every real xx for which the formula produces a real number.

Three situations restrict the natural domain, and they are worth having as a checklist:

  • Division by zero is forbidden. If f(x)=1x−3f(x) = \dfrac{1}{x-3}, then x=3x=3 must be excluded: domain={x∈R:x≠3}\text{domain} = \{x \in \mathbb{R} : x \neq 3\}.
  • Square roots (and other even roots) of negative numbers are forbidden, over the reals. If f(x)=2x−6f(x) = \sqrt{2x-6}, we need 2x−6≥02x - 6 \geq 0, i.e. x≥3x \geq 3.
  • Logarithms of non-positive numbers are forbidden (covered fully in Block A, but the domain rule recurs here): log⁡\log requires a strictly positive argument.

Worked example 1. Find the domain of f(x)=x+2x−5f(x) = \dfrac{\sqrt{x+2}}{x-5}.

Two restrictions apply simultaneously. The square root demands x+2≥0x + 2 \geq 0, so x≥−2x \geq -2. The denominator demands x−5≠0x - 5 \neq 0, so x≠5x \neq 5. Combining both,

domain={x∈R:x≥−2}∖{5}=[−2,5)∪(5,∞)\text{domain} = \{x \in \mathbb{R} : x \geq -2\} \setminus \{5\} = [-2,5) \cup (5,\infty)

Notice that the point x=5x=5 is removed from an otherwise unbroken interval — a single excluded point does not split the domain into "two branches" in any deeper sense, it is just one value deleted from a continuum, and the interval notation must show that with two half-open intervals meeting at the gap.

3. Range: What Can Come Out

The range of ff (sometimes called the image) is the set of all actual output values f(x)f(x) as xx runs over the whole domain. Unlike the domain, the range frequently cannot be read off the formula by inspection — it usually requires understanding the shape of the graph, or an algebraic argument.

Worked example 2 (the routine case). State the range of g(x)=x2+3g(x) = x^2 + 3 for x∈Rx \in \mathbb{R}.

Since x2≥0x^2 \geq 0 for every real xx, with equality only at x=0x=0, adding 33 gives g(x)≥3g(x) \geq 3, and every value ≥3\geq 3 is attained (by x=±y−3x = \pm\sqrt{y-3} for y≥3y \geq 3). So range=[3,∞)\text{range} = [3, \infty).

Worked example 3 (the edge case). State the range of h(x)=1x−2h(x) = \dfrac{1}{x-2} for x∈R,x≠2x \in \mathbb{R}, x \neq 2.

A tempting but wrong instinct is "the range is also all reals except 2" — copying the excluded domain value into the range is a common error. Instead, ask: is there any real number yy that h(x)h(x) can never equal? Setting y=1x−2y = \dfrac{1}{x-2} and solving for xx,

y(x−2)=1⟹x=2+1y,y≠0y(x-2) = 1 \quad\Longrightarrow\quad x = 2 + \frac{1}{y}, \qquad y \neq 0

This rearrangement is only invalid when y=0y = 0, because then there would be no finite xx with 1x−2=0\dfrac{1}{x-2}=0 (a fraction with a nonzero numerator is never zero). Every other value of yy does correspond to some valid x≠2x \neq 2. Hence

range={y∈R:y≠0}\text{range} = \{y \in \mathbb{R} : y \neq 0\}

The excluded value in the range (y=0y=0) came from the horizontal asymptote of the reciprocal shape, not from the excluded domain value (x=2x=2, which gives the vertical asymptote) — the two restrictions have different causes and there is no reason, in general, for them to coincide or to look alike.

Key distinction. Domain restrictions come from the formula (denominators, roots, logs) and are found by inspecting xx. Range restrictions come from the shape of the output and are found by analysing what values f(x)f(x) actually achieves — often by trying to solve for xx in terms of yy, or by graphing.

4. Finding the Range by Solving for xx

The method used in Worked example 3 generalises: given y=f(x)y = f(x), rearrange to express xx in terms of yy. The range is exactly the set of yy for which that rearrangement is valid (produces a real xx, and a defined one).

Worked example 4. Find the range of f(x)=2x+1x−1f(x) = \dfrac{2x+1}{x-1}, x≠1x \neq 1.

y(x−1)=2x+1 ⟹ yx−y=2x+1 ⟹ x(y−2)=y+1 ⟹ x=y+1y−2y(x-1) = 2x+1 \ \Longrightarrow\ yx - y = 2x + 1 \ \Longrightarrow\ x(y-2) = y + 1 \ \Longrightarrow\ x = \frac{y+1}{y-2}

This is defined for every yy except y=2y = 2. So range={y∈R:y≠2}\text{range} = \{y \in \mathbb{R} : y \neq 2\} — and indeed y=2y=2 is the horizontal asymptote of this rational function, a connection that Chapter 7 will make systematic.

For functions built from x2x^2, x\sqrt{x} or trigonometric pieces, solving for xx is often messier than simply tracking the minimum/maximum behaviour of the expression directly, as in Worked example 2 — choose whichever method suits the formula.

5. Domain and Range from a Graph

When a function is presented graphically rather than algebraically, the domain is read off the horizontal extent of the curve (project every point onto the xx-axis) and the range is read off the vertical extent (project every point onto the yy-axis). Open circles or dashed boundary lines mark values approached but never attained (as at a vertical or horizontal asymptote); filled circles mark values that are attained.

Warning. A graph with an arrowhead trailing off to the edge of the page is a visual convention meaning "continues indefinitely in this direction," not a claim that the function stops there. Misreading a truncated axis as the true domain is one of the commonest graph-reading errors.

6. Function Notation and Evaluating f(a)f(a)

Writing y=f(x)y = f(x) names the function ff and asserts that yy is whatever ff produces from xx. Evaluating ff at a specific input means substituting that input for every occurrence of xx in the formula — including inputs that are themselves expressions.

Worked example 5. Given f(x)=x2−3x+1f(x) = x^2 - 3x + 1, find f(2)f(2), f(−1)f(-1) and f(a+1)f(a+1).

f(2)=4−6+1=−1,f(−1)=1+3+1=5f(2) = 4 - 6 + 1 = -1, \qquad f(-1) = 1 + 3 + 1 = 5 f(a+1)=(a+1)2−3(a+1)+1=a2+2a+1−3a−3+1=a2−a−1f(a+1) = (a+1)^2 - 3(a+1) + 1 = a^2 + 2a + 1 - 3a - 3 + 1 = a^2 - a - 1

Note that f(a+1)≠f(a)+1f(a+1) \neq f(a) + 1 and f(a+1)≠f(a)+f(1)f(a+1) \neq f(a) + f(1) in general — function notation is not distributive over addition, and treating it as if it were is one of the most persistent algebra errors at this level.

7. One-to-One Functions and the Horizontal Line Test

A function ff is one-to-one (or injective) if distinct inputs always give distinct outputs: x1≠x2  ⟹  f(x1)≠f(x2)x_1 \neq x_2 \implies f(x_1) \neq f(x_2), equivalently f(x1)=f(x2)  ⟹  x1=x2f(x_1) = f(x_2) \implies x_1 = x_2. Graphically, ff is one-to-one exactly when no horizontal line y=cy=c meets its graph more than once — the horizontal line test.

f(x)=x2f(x) = x^2 on all of R\mathbb{R} is not one-to-one, since f(2)=f(−2)=4f(2)=f(-2)=4; restricted to x≥0x \geq 0, it is one-to-one. This property matters immediately: Chapter 2 shows that a function has an inverse function (in the full sense) exactly when it is one-to-one on its domain.

Common Exam Pitfalls

  • Writing the range as "all reals except the excluded domain value." The excluded value in a rational function's range comes from its horizontal asymptote, which is generally a different number from the vertical asymptote excluded from the domain (Worked example 3).
  • Forgetting to combine multiple domain restrictions. When a formula has both a root and a denominator, every restriction must be satisfied simultaneously — take the intersection, not just one of them.
  • Treating f(a+b)f(a+b) as f(a)+f(b)f(a) + f(b). Function notation means "substitute," not "distribute." Always expand the whole input first, then substitute.
  • Misreading a graph's domain/range from where the drawing happens to stop, rather than from arrowheads (continues forever), open circles (value excluded) or filled circles (value included).
  • Confusing a relation satisfying the vertical line test incidentally with it being "the only function possible" for that curve — many different formulas can share one graph on a restricted domain; always check what domain is actually specified.
  • Quoting the range of y=x2+cy=x^2+c incorrectly after a reflection or restriction — re-derive it from the vertex/shape each time rather than pattern-matching to a memorised shape.

Summary

  • A function f:A→Bf:A\to B assigns to every element of AA exactly one element of BB; this is tested graphically by the vertical line test.
  • The domain is the set of valid inputs; for a formula, exclude values making a denominator zero, an even root negative, or a logarithm's argument non-positive, and intersect all such restrictions.
  • The range is the set of actual outputs; find it either by analysing the shape of f(x)f(x) directly (e.g. x2≥0x^2 \geq 0) or by solving y=f(x)y=f(x) for xx and finding which yy give a valid xx.
  • For f(x)=1x−2f(x)=\dfrac{1}{x-2}: domain excludes x=2x=2 (vertical asymptote), range excludes y=0y=0 (horizontal asymptote) — these are generally different numbers for different reasons.
  • Function notation f(a+1)f(a+1) means substitute a+1a+1 for xx throughout; it is not distributive: f(a+1)≠f(a)+f(1)f(a+1) \neq f(a)+f(1) in general.
  • A function is one-to-one when no two inputs share an output, tested by the horizontal line test; this property is the prerequisite for a genuine inverse function (Chapter 2).