Algebra & Functions · Linear function

Linear function

A function of the form f(x) = mx + b: start from f(0) = b, and each step of 1 in x changes the output by m. Its graph is a straight line with slope m that crosses the y-axis at b.

Linear functions in this visualization

A linear function has the form f(x)=mx+bf(x) = mx + b, where mm and bb are fixed numbers. Its value at 0 is f(0)=bf(0) = b, so its graph crosses the yy-axis at (0,b)(0, b): bb is the yy-intercept. Each time the input grows by 1, the output changes by mm, whatever the input was. The graph is a straight line and mm is its slope.

Linear function
f(x)=mx+b,f(x+1)−f(x)=mf(x) = mx + b, \qquad f(x + 1) - f(x) = m

It is often written y=mx+by = mx + b, and kk is also common for the slope. The steps from x=0x = 0 to the input read the formula as a walk from bb: each step of 1 to the right adds mm, and each step to the left takes mm away. A last step shorter than 1 changes the output in proportion to its length, so the walk works for every input, not only whole numbers.

Why the graph is a straight line

Equal steps in the input give equal changes in the output: going from xx to x+hx + h always changes the output by mhmh. So between any two points of the graph, rise over run is mh/h=mmh / h = m, the same number every time, which is what a straight line of slope mm does. Every point of the graph lies on the line through (0,b)(0, b) with that slope. The other way round, every line that is not vertical is the graph of a linear function. A vertical line is not the graph of any function: it would give one input infinitely many outputs.

What b and m each do

Change only bb and every output changes by the same amount, because mxmx does not depend on bb. The whole line moves up or down without turning: the old line and the new one are parallel and never meet.

Keep bb and change mm instead, and the output at xx changes by Δm⋅x\Delta m \cdot x: nothing at x=0x = 0, more the farther xx is from 0, in opposite directions on the two sides. So the line turns about (0,b)(0, b), the one point it keeps. Lines with the same slope and different intercepts are parallel; lines with the same intercept all pass through one point of the yy-axis.

Two special cases, and the names

When m=0m = 0, every input gives the same output bb: a constant function, whose graph is horizontal. Many books count it as linear, since mx+bmx + b still has degree at most 1; others keep the name for m≠0m \ne 0, when the degree is exactly 1.

When b=0b = 0, the line passes through the origin and the output is proportional to the input: doubling xx doubles f(x)f(x). With b≠0b \ne 0 that fails, since f(2x)=2mx+bf(2x) = 2mx + b is not 2f(x)2f(x). In linear algebra only this proportional kind, f(x)=mxf(x) = mx, counts as linear; mx+bmx + b with b≠0b \ne 0 is called affine.

Controls

  • The y-intercept and the input move with the arrow keys, 0.1 at a time (0.01 with Shift). Press on the line away from the y-axis and drag to turn it about (0, b).

Related