Linear functions in this visualization
A linear function has the form , where and are fixed numbers. Its value at 0 is , so its graph crosses the -axis at : is the -intercept. Each time the input grows by 1, the output changes by , whatever the input was. The graph is a straight line and is its slope.
It is often written , and is also common for the slope. The steps from to the input read the formula as a walk from : each step of 1 to the right adds , and each step to the left takes 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 to always changes the output by . So between any two points of the graph, rise over run is , the same number every time, which is what a straight line of slope does. Every point of the graph lies on the line through 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 and every output changes by the same amount, because does not depend on . The whole line moves up or down without turning: the old line and the new one are parallel and never meet.
Keep and change instead, and the output at changes by : nothing at , more the farther is from 0, in opposite directions on the two sides. So the line turns about , 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 -axis.
Two special cases, and the names
When , every input gives the same output : a constant function, whose graph is horizontal. Many books count it as linear, since still has degree at most 1; others keep the name for , when the degree is exactly 1.
When , the line passes through the origin and the output is proportional to the input: doubling doubles . With that fails, since is not . In linear algebra only this proportional kind, , counts as linear; with 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).