MathNana Learn with wisdom

Formula · Graphing

The Slope Formula and y = mx + b

Three formulas, one line. Each is the same information arranged for a different question.

5 min read Updated 2026-08-17 Checked by Aziza Smailovic

The slope formula

Given any two points on a line, the slope formula is the difference in y divided by the difference in x:

m from two pointsworked example
  1. m = (y₂ − y₁) ÷ (x₂ − x₁)rise over run

The only rule that matters here is consistency: whichever point you call the second one on top, must also be the second one on the bottom. Reversing one but not the other flips the sign and tilts the line the wrong way.

The three forms of a line

Each form makes one thing obvious and the others less so.

FormWritten asReads off directly
Slope-intercepty = mx + bthe slope and the y-intercept
Point-slopey − y₁ = m(x − x₁)a known point and the slope
StandardAx + By = Cneither, but the intercepts are quick

Slope-intercept is the one to reach for when you want to picture the line or graph it. Point-slope is the fastest route when you already have one point and the slope, because it needs no rearranging at all.

Finding b once you have m

The slope alone does not fix a line — infinitely many parallel lines share it. One point pins it down.

Through (4, 0) with m = −0.5worked example
  1. y = mx + bthe form we want
  2. 0 = −0.5(4) + bsubstitute the known point
  3. 0 = −2 + bevaluate
  4. b = 2, so y = −0.5x + 2the y-intercept

Either point works and both give the same b. Using the second one as a check costs seconds and catches an arithmetic slip in the slope.

Converting between the forms

Standard form to slope-intercept is one rearrangement: isolate y, then divide every term by its coefficient.

2x + 4y = 8worked example
  1. 4y = −2x + 8subtract 2x from both sides
  2. y = −0.5x + 2divide every term by 4

Note that the 8 is divided too, not only the x term. Forgetting it moves the line up or down without changing its direction, which is a wrong answer that still looks right on a rough sketch.

Going the other way, multiply out any fractions and collect x and y on the left: y = −0.5x + 2 becomes x + 2y = 4.

The vocabulary around it

Three terms appear constantly alongside the slope formula and are worth pinning down, because questions use them interchangeably with slope itself.

  • Gradient is the same thing as slope — the common term in British usage. A question asking for the gradient of a linear equation wants m.
  • Undefined is not a value but a statement that the division could not be done. A vertical line has undefined slope because its run is zero.
  • Negative reciprocal is what makes a line perpendicular: flip the fraction and change the sign, so that the two slopes multiply to −1.

Note also that y2 minus y1 on the top is a difference, not a subtraction to be simplified away. When either value is negative, subtracting it adds — from (−2, 5) to (2, −3) the run is 2 − (−2) = 4, not 0.

Related formulas worth having

Three more come from the same two points and appear alongside slope constantly.

WhatFormula
Midpoint((x₁ + x₂)/2, (y₁ + y₂)/2)
Distance√((x₂ − x₁)² + (y₂ − y₁)²)
x-interceptset y = 0 and solve for x

The distance formula is the Pythagorean theorem with the rise and the run as the two legs — the same two differences the slope formula uses, squared instead of divided.

Questions about slope formula

What is the slope formula?

m = (y₂ − y₁)/(x₂ − x₁) — the difference in the y values divided by the difference in the x values, taken in the same order on top and bottom.

Does the order of the points matter?

Only that it is consistent. Swapping both the top and the bottom gives the same answer; swapping one of them flips the sign.

When should I use point-slope form?

When you already have one point and the slope. It needs no rearranging, so it is the quickest route to an equation.

How do I convert standard form to y = mx + b?

Solve for y: move the x term across, then divide every term — including the constant — by the coefficient of y.