What is a linear function?
Learning Objectives
- State the definition of a linear (first-degree) function \(f \colon \mathbb{R} \to \mathbb{R},\; f(x) = ax + b,\; a \neq 0\).
- Explain why the requirement \(a \neq 0\) is part of the definition.
- Recognise the case \(b = 0\) as direct proportionality.
- Identify the coefficients \(a\) and \(b\), and compute \(b = f(0)\).
- Prove and use that the rate of change of a linear function is the constant \(a\).
- Recognise a linear function restricted to \(\mathbb{N}\) as an arithmetic progression.
From functions in general to a first family
In the previous course we built the general theory of functions: the definition, the graph, composition, monotonicity, parity. That theory is deliberately abstract — it speaks about every function at once. We now turn to specific families, beginning with the simplest one whose values genuinely change: the linear function.
We have already met its shape. In the Sequences course, an arithmetic progression grew by the same fixed amount at every step — a constant rate of change. A linear function is exactly this idea, freed from the integers and defined for every real input.
Linear function
A linear function (or first-degree function) is a function \(f \colon \mathbb{R} \to \mathbb{R}\) of the form
\[f(x) = ax + b,\]
where \(a\) and \(b\) are fixed real numbers and \(a \neq 0\).
The number \(a\) is the coefficient of \(x\) (the leading coefficient); the number \(b\) is the constant term. The condition \(a \neq 0\) is part of the definition, not an afterthought — we return to it below.
Why \(a \neq 0\)?
If we allowed \(a = 0\), the rule would collapse to \(f(x) = b\): the same output for every input — a constant function. A constant function has nothing first-degree about it; the variable \(x\) has vanished. The name "first-degree" records that \(x\) appears to the first power with a genuine, non-zero coefficient. Excluding \(a = 0\) keeps the constant functions in their own category, where they belong.
Linear or not?
Linear. \(f(x) = 3x - 7\) is linear, with \(a = 3\) and \(b = -7\).
Constant, not linear. \(f(x) = 4\) is not linear: here \(a = 0\), so it is a constant function.
Second-degree, not linear. \(f(x) = x^2 + x\) is not linear: the term \(x^2\) makes it second-degree. (Such functions are the subject of the next course.)
Simplify first. \(f(x) = (2x + 1) - (x - 5)\) is linear. It looks complicated, but simplifying gives \(f(x) = 2x + 1 - x + 5 = x + 6\), so \(a = 1\) and \(b = 6\). Always simplify before judging the degree.
Direct proportionality
The special case \(b = 0\) deserves its own name. A linear function of the form
\[f(x) = ax \qquad (a \neq 0)\]
expresses a direct proportionality: we say that \(f(x)\) is directly proportional to \(x\), and the constant \(a\) is the constant of proportionality.
Two features single it out among linear functions. First, \(f(0) = a \cdot 0 = 0\): the output is zero exactly when the input is. Second, scaling the input scales the output by the same factor: \(f(kx) = a(kx) = k \cdot (ax) = k\,f(x)\). Doubling \(x\) doubles \(f(x)\); halving \(x\) halves it.
Proportionality in the wild
A unit price. At a fixed unit price of €3, the cost of \(x\) identical items is \(C(x) = 3x\) euros. Cost is directly proportional to quantity; the constant of proportionality is the price.
Constant speed. A vehicle moving at a constant speed of \(60\) km/h covers \(d(t) = 60t\) kilometres in \(t\) hours. Distance is directly proportional to time.
By contrast, a taxi that charges a €5 base fare plus €2 per kilometre costs \(f(x) = 2x + 5\) euros. This is linear but not a direct proportionality: because of the base fare, a ride of \(0\) km still costs €5, so \(f(0) \neq 0\).
Reading off \(b\)
The constant term has a direct meaning: it is the value of the function at \(0\). Indeed,
\[f(0) = a \cdot 0 + b = b.\]
So \(b\) is simply \(f(0)\), the "starting value" of the function — the base fare, the initial amount, the value before anything happens. The coefficient \(a\), by contrast, governs how the function changes. We make that precise now.
The rate of change is constant
Let \(f(x) = ax + b\) be a linear function. For any two distinct inputs \(x_1 \neq x_2\),
\[\frac{f(x_2) - f(x_1)}{x_2 - x_1} = a.\]
That is, the change in output divided by the change in input is always the same number \(a\), no matter which two inputs are chosen.
Compute the difference of the two values directly:
\[f(x_2) - f(x_1) = (ax_2 + b) - (ax_1 + b) = ax_2 - ax_1 = a(x_2 - x_1).\]
The two copies of \(b\) cancel. Since \(x_1 \neq x_2\), the denominator \(x_2 - x_1\) is non-zero, so we may divide:
\[\frac{f(x_2) - f(x_1)}{x_2 - x_1} = \frac{a(x_2 - x_1)}{x_2 - x_1} = a.\]
The result does not depend on \(x_1\) or \(x_2\).
This quantity — the constant change in output per unit change in input — is the rate of change of the linear function, and it equals the coefficient \(a\). It is what makes \(a\) the most important number attached to the function. In the next lesson we draw the graph and discover that this same \(a\) has a vivid geometric name: the slope of the line.
Back to arithmetic progressions
Feed a linear function only the natural numbers \(n = 0, 1, 2, \ldots\) and watch the outputs:
\[f(0) = b,\quad f(1) = a + b,\quad f(2) = 2a + b,\quad f(3) = 3a + b,\ \ldots\]
Each term exceeds the previous one by exactly \(a\). This is an arithmetic progression with first term \(b\) and common difference \(a\). So an arithmetic progression is nothing but a linear function sampled at the integers, and the common difference \(d\) is the rate of change \(a\). The "constant step" that defined those progressions and the "constant rate of change" we just proved are the same phenomenon.
Connection to Computer Science
Linear functions describe the most common way a cost grows: a fixed overhead plus a steady per-unit charge. If a task takes \(b\) seconds to set up and then \(a\) seconds for each of \(x\) records it processes, the total time is \(ax + b\). The constant \(b\) is the startup cost paid once; the coefficient \(a\) is the cost that accumulates with the size of the input. When programmers say an algorithm runs "in linear time," they mean precisely that its cost behaves like such a function of the input size.
Isn't a constant function "linear" too?
In everyday speech, "linear" suggests a straight line — and the graph of a constant function \(f(x) = b\) is a perfectly straight (horizontal) line. So why does our definition exclude it by demanding \(a \neq 0\)?
The answer is classification by degree. We are sorting functions by the highest power of \(x\) that genuinely appears. A constant function has degree \(0\) (no \(x\) at all); a first-degree function has degree \(1\). Lumping them together would blur a distinction we will rely on constantly: a first-degree function takes every real value exactly once, whereas a constant function takes a single value forever. They behave differently, so we name them differently.
One honest warning about words. In linear algebra, a later subject, "linear" is reserved for the proportional case \(f(x) = ax\) (where \(b = 0\)), and functions \(ax + b\) with \(b \neq 0\) are called affine. The school-mathematics convention we follow uses "linear function" / "first-degree function" for the whole family \(ax + b\), \(a \neq 0\). Both conventions are standard; what matters is knowing which one is in force. In this course, "linear" means \(ax + b\) with \(a \neq 0\).
Exercises
Exercise 1
For each rule \(f \colon \mathbb{R} \to \mathbb{R}\), decide whether it defines a first-degree (linear) function. Simplify first where needed.
Exercise 2
Consider the linear function \(f \colon \mathbb{R} \to \mathbb{R},\; f(x) = -2x + 5\).
Exercise 3
Decide whether each statement about linear functions is true or false.
Exercise 4
A linear function \(f(x) = ax + b\) satisfies \(f(1) = 4\) and \(f(4) = 13\). Find its coefficients and \(f(0)\).
Exercise 5
Classify each function \(f \colon \mathbb{R} \to \mathbb{R}\) as first-degree (linear) or not. Simplify before deciding.
Summary
A linear (first-degree) function is \(f \colon \mathbb{R} \to \mathbb{R},\; f(x) = ax + b\) with \(a \neq 0\). The condition \(a \neq 0\) excludes the constant functions, which form their own (degree-zero) category.
The constant term is the value at zero: \(b = f(0)\). The case \(b = 0\) is direct proportionality, \(f(x) = ax\), characterised by \(f(0) = 0\) and \(f(kx) = k\,f(x)\).
The rate of change \(\dfrac{f(x_2) - f(x_1)}{x_2 - x_1}\) is the constant \(a\) for every pair of distinct inputs — the defining feature of linearity.
Sampled at the natural numbers, a linear function is an arithmetic progression with first term \(b\) and common difference \(a\).