Formula

Slope formula

Also written: gradient formula · rise over run · slope between two points

m=y2y1x2x1m = \frac{y_2 - y_1}{x_2 - x_1}

The slope formula gives the steepness of the line through two points: the change in y divided by the change in x.

What each part means

mm
the slope
(x1,y1)(x_1, y_1)
the first point
(x2,y2)(x_2, y_2)
the second point

When to use it

You know two points on a line and need its steepness, or a rate of change from two readings of the same quantity.

Reading it

The yy-values go on top and the xx-values on the bottom — rise over run, in that order.

Either point can be first, as long as you are consistent. Both differences must start from the same point, or the sign comes out backwards.

y2y1x2x1andy1y2x1x2\frac{y_2 - y_1}{x_2 - x_1} \qquad\text{and}\qquad \frac{y_1 - y_2}{x_1 - x_2}

Both give the same slope. Mixing them does not.

Why the formula does not depend on which two points you pick

Take any two points on the same straight line. The right triangles formed by their rise and run are similar, because the line makes the same angle with the horizontal everywhere along its length.

Similar triangles have proportional sides, so the ratio of rise to run is the same for every pair of points. That constant ratio is what the number mm names — see rate of change for the algebra.

Worked examples

Find the slope through (1,2)(1, 2) and (4,11)(4, 11).

m=11241=93=3m = \frac{11 - 2}{4 - 1} = \frac{9}{3} = 3

Find the slope through (2,5)(-2, 5) and (3,5)(3, -5).

m=553(2)=105=2m = \frac{-5 - 5}{3 - (-2)} = \frac{-10}{5} = -2

Negative, so the line falls left to right.

Two special cases

SituationDenominatorSlope
horizontal linenon-zero00
vertical linezeroundefined

A vertical line has no slope at all, because dividing by zero is not defined. That is the one line slope-intercept form cannot describe.

Lessons that teach this

Related