Menu

Slope-Intercept Form

y = mx + b is the most useful way to write a line, because each of the two numbers does exactly one visible thing. Move them and watch which.

By Nethanel Bar, Co-founder & CEO

Last updated

There are several ways to write the equation of the same straight line, and y = mx + b is the one worth being fluent in. Not because it is more correct, but because you can see it: the two numbers in it correspond to the two things you would notice about a line if someone drew one for you — how steep it is, and where it sits.

Move the sliders. Watch what each one changes and, more importantly, what it leaves alone.

Slope m1
Intercept b1
y = x + 1rise / run1/1crosses y at(0, 1)

Move m and the line tilts around the dot. Move b and the whole line slides up or down.

m is the tilt, b is the height

Drag b first. The line slides straight up and down and keeps its steepness exactly. That is because b is the value of y when x is 0 — put 0 into y = mx + b and the first term vanishes, leaving y = b. So b is the height at which the line crosses the y-axis, which is what "y-intercept" means. It is the dot in the figure.

Now drag m. The line pivots around that dot and never leaves it, because changing m cannot change the value at x = 0.

The dashed staircase in the figure is what m means. Starting at the intercept, go one step right and m tells you how far up (or down) you land: m = rise/run. With m = 2 you go one right and two up; with m = 1/2 you go one right and half up. Set m negative and the staircase goes downwards — which is the whole content of "negative slope means downhill".

Set m to 0 and the x term disappears entirely: a flat line at height b.

Reading it off a graph

Because m and b act independently, you can go backwards. Given a line:

  1. Find where it crosses the y-axis. That number is b.
  2. From that crossing, count one across and see how far up or down you have to go to be back on the line. That is m.

Here is a line to read:

Graph-6-5-4-3-2-112345-6-5-4-3-2-112345xyy = 2x - 1
It crosses the y-axis at -1, and one step right takes you two up. So m = 2 and b = -1.

If counting gives you an awkward number, count further: going two across and finding you have risen three means m = 3/2. Slope is a fraction, and leaving it as one is more accurate than rounding it — this is why the slider above reports 1/2 and never 0.5.

Rearranging into the form

Most equations do not arrive in slope-intercept form. Getting them there is two moves: get y alone, then tidy what is left.

Read the last line: y = -2/3x+2. So this line goes downhill at two-thirds and crosses the y-axis at 2 — neither of which was visible in the original. That is the entire reason the rearrangement is worth doing.

Notice that the fraction stays a fraction. -2/3 as a decimal is -0.6666..., which is not the slope; it is a rounding of it. On a line drawn from that number, the error grows the further you go.

Try one

Rearrange this one yourself. Write as many lines as you need — each one gets checked.

Once that is quick, the same two moves handle every line you will be given, including the ones with fractions in awkward places.

Common questions

What is slope-intercept form?
It is a line written as y = mx + b, where m is the slope and b is the y-intercept. Its advantage over other ways of writing the same line is that both numbers can be read straight off: you do not have to calculate anything to know how steep the line is or where it crosses the y-axis.
What do m and b actually do?
m controls the tilt and b controls the height. Changing m rotates the line about the point where it crosses the y-axis; changing b slides the whole line up or down without changing its steepness. Because they act independently, you can read a graph in either direction — from the equation to the picture, or from the picture to the equation.
How do I convert an equation into slope-intercept form?
Get y by itself on one side, then tidy the other side. Move every term that is not y across, then divide by whatever is multiplying y. The result is y = (something)x + (something), and those two somethings are m and b.
What does a negative slope look like?
It goes downhill from left to right. A positive slope rises as you move right, a negative one falls, and a slope of zero is a flat horizontal line at height b. The sign of m is the single most useful thing to check first, because it rules out half the possible answers immediately.
Why can a vertical line not be written as y = mx + b?
Because a vertical line has the same x for every y, so it is not a rule for turning x into y at all — and its slope would be a division by zero. Vertical lines are written x = c instead. This is the one case slope-intercept form cannot cover, which is why standard form still exists.

Now do it yourself, properly

Reading someone else's working is not the same as being able to do it. The Coddy math course puts you on a board that checks every move you make, so you find out where you actually stand.

Start the math course

Related ideas

Coddy programming languages illustration

Learn math with Coddy

GET STARTED