Intermediate level

Linear function

A linear function y = ax + b draws a straight line. Meet the meaning of the slope and the intercept, the zero, the formula of a line through two points, the general form, and the conditions for parallel and perpendicular lines.

Before you start

This topic builds on earlier ideas. Before you start, it's worth working through the lessons below — they'll make everything click:

All formulas

  • Slope–intercept form

    f(x)=ax+bf(x) = ax + b

    a — the slope, b — the intercept

  • Slope from two points

    a=y2y1x2x1a = \frac{y_2 - y_1}{x_2 - x_1}

    the rise divided by the run

  • The zero

    x0=ba(a0)x_0 = -\frac{b}{a} \quad (a \neq 0)

    where the graph crosses the x-axis

  • The value at zero

    f(0)=bf(0) = b

    where the graph crosses the y-axis

  • General form

    Ax+By+C=0Ax + By + C = 0

    reducible to the slope–intercept form whenever B ≠ 0

  • Condition for parallel lines

    a1=a2a_1 = a_2

    parallel lines have equal slopes

  • Condition for perpendicular lines

    a1a2=1a_1 \cdot a_2 = -1

    hence a₂ = −1/a₁

A linear function is a function given by

f(x)=ax+bf(x) = ax + b

where aa and bb are fixed numbers. Its graph is — always, without exception — a straight line. The number aa is the slope, the number bb the intercept.

What a and b mean

Both numbers have a plain meaning, and the graph shows it at once:

  • bb is the starting value: f(0)=bf(0) = b, the height at which the line crosses the yy-axis;
  • aa is the rate of change: by that much the value grows when the argument grows by one.
−1012345−4−20246xyΔy = 2x₀ = 1.5b = −3f(x) = 2x − 3
The line f(x) = 2x − 3: it crosses the y-axis at −3, and every step of one to the right lifts it by two.

The dashed guide on the drawing is exactly how the slope is read off: one right, two up. Hence the other, equally good definition of aa — the rise divided by the run:

a=y2y1x2x1a = \frac{y_2 - y_1}{x_2 - x_1}

Monotonicity

Whether the function increases is decided by the sign of aa alone:

−4−3−2−101234−4−3−2−101234xya > 0a < 0a = 0
Three linear functions: increasing (a > 0), decreasing (a < 0) and constant (a = 0).
  • a>0a > 0 — the function increases, the line rises to the right;
  • a<0a < 0 — the function decreases, the line falls;
  • a=0a = 0 — the function is constant, f(x)=bf(x) = b, a horizontal line.

The intercept bb has nothing to do with monotonicity — it slides the line up or down without changing how steep it is.

The zero

The zero is the argument whose value is zero, that is the solution of ax+b=0ax + b = 0:

x0=ba(a0)x_0 = -\frac{b}{a} \qquad (a \neq 0)
Find the zero of f(x) = 2x − 6 and both axis crossings of its graph.

When a=0a = 0 there is no point in using the formula: a constant function f(x)=bf(x) = b either has no zeros at all (for b0b \neq 0) or takes the value zero everywhere (for b=0b = 0).

The line through two points

Two points determine exactly one line, so from them the formula can be recovered. First the slope, then the intercept:

Find the linear function whose graph passes through A(1, 3) and B(3, 7).

The order of subtraction in the numerator and the denominator must be the same — otherwise the sign comes out reversed. If the numerator starts from y2y_2, the denominator starts from x2x_2.

The general form

The same set of points can be described by an equation in which yy does not stand alone on the left:

Ax+By+C=0Ax + By + C = 0

That is the general form. To read the slope off it, just solve for yy:

Turn 4x − 2y + 6 = 0 into the slope–intercept form.

The change is only possible when B0B \neq 0. The equation x=3x = 3 describes a vertical line, and such a line — as we know from the vertical line test — is not the graph of any function.

Parallel and perpendicular lines

Only the coefficient aa carries the steepness of a line, so both conditions on the mutual position of two lines are about it:

a1=a2(parallel),a1a2=1(perpendicular)a_1 = a_2 \quad \text{(parallel)}, \qquad a_1 \cdot a_2 = -1 \quad \text{(perpendicular)}
−3−2−1012345−4−3−2−101234xyy = 2x − 1y = −0.5x + 2
Perpendicular lines: the product of their slopes is 2 · (−0.5) = −1.

The condition gives a handy formula: a line perpendicular to one of slope aa has slope

a=1aa_\perp = -\frac{1}{a}

the reciprocal with the opposite sign. For a=3a = 3 that is 13-\frac{1}{3}; for a=25a = -\frac{2}{5} it is 52\frac{5}{2}.

Direct proportionality

When b=0b = 0 the formula collapses to y=axy = ax and the graph passes through the origin. The ratio yx\frac{y}{x} is then constant and equal to aa — this is direct proportionality.

Distance at a constant speed behaves like that (s=vts = vt), and so does the cost of buying at a fixed price per item. When b0b \neq 0 a "joining fee" appears: a subscription added to a bill, the flag-fall of a taxi, the standing charge on an electricity invoice.

A taxi charges a fixed fee of 8 plus 3 per kilometre. Write the cost as a function and find after how many kilometres it passes 50.

Exercises

One session covers everything this lesson teaches: the zero, the slope from two points, the whole formula from two points, the general form turned into the slope–intercept one, and the slope of a perpendicular line. Type a formula in any correct spelling — 2x+1, 1+2x and 2*x+1 all mean the same thing.

Practice

Work through a set of exercises — they get harder as you go. At the end you'll see your score and the mistakes worth reviewing.

Exercise 1 of 8Score: 0
f(x) = 2x − 6 → x₀

Common mistakes

  • Swapping aa and bb — the steepness is aa, the crossing with the yy-axis is bb.
  • The sign of the zero — the formula gives x0=bax_0 = -\frac{b}{a}, not ba\frac{b}{a}.
  • Subtracting in opposite orders — numerator and denominator must start from the same point.
  • Dividing only one term — when solving for yy, the whole side of the equation is divided.
  • Perpendicularity as a bare reciprocal — the sign has to change too: a=1aa_\perp = -\frac{1}{a}.
  • Calling a vertical line a linear functionx=3x = 3 is not the graph of a function.

Formula card

Topic: Linear function

  • Slope–intercept form

    f(x)=ax+bf(x) = ax + b

    a — the slope, b — the intercept

  • Slope from two points

    a=y2y1x2x1a = \frac{y_2 - y_1}{x_2 - x_1}

    the rise divided by the run

  • The zero

    x0=ba(a0)x_0 = -\frac{b}{a} \quad (a \neq 0)

    where the graph crosses the x-axis

  • The value at zero

    f(0)=bf(0) = b

    where the graph crosses the y-axis

  • General form

    Ax+By+C=0Ax + By + C = 0

    reducible to the slope–intercept form whenever B ≠ 0

  • Condition for parallel lines

    a1=a2a_1 = a_2

    parallel lines have equal slopes

  • Condition for perpendicular lines

    a1a2=1a_1 \cdot a_2 = -1

    hence a₂ = −1/a₁

−1012345−4−20246xyΔy = 2x₀ = 1.5b = −3f(x) = 2x − 3
The slope is the rise per unit of argument: one step right, two steps up — a = 2.
−4−3−2−101234−4−3−2−101234xya > 0a < 0a = 0
The sign of the slope decides the monotonicity: a > 0 increasing, a < 0 decreasing, a = 0 constant.

Frequently asked questions

Related articles