The slope formula gives the slope of a line from two points:

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

Use it when you know two points on the same line and want the line's steepness, or rate of change. In plain language, slope is rise over run: change in yy divided by change in xx.

This works only when x2x1x_2 \ne x_1. If the two points have the same xx-value, the line is vertical, so the denominator is 00 and the slope is undefined.

If m>0m > 0, the line rises from left to right. If m<0m < 0, it falls. If m=0m = 0, the line is horizontal.

What the slope formula means

The numerator y2y1y_2 - y_1 is the vertical change, also called the rise. The denominator x2x1x_2 - x_1 is the horizontal change, also called the run.

That is why the slope formula and rise over run are the same idea. The formula is just the coordinate version of that ratio.

Worked example: find slope from two points

Find the slope of the line through (2,3)(2, 3) and (5,9)(5, 9). Label the first point as (x1,y1)(x_1, y_1) and the second as (x2,y2)(x_2, y_2).

Start with the formula:

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

Substitute the coordinates in the same order:

m=9352=63=2m = \frac{9 - 3}{5 - 2} = \frac{6}{3} = 2

So the slope is 22. That means whenever xx increases by 11, yy increases by 22.

You can see the same result as rise over run. From (2,3)(2, 3) to (5,9)(5, 9), the rise is 66 and the run is 33, so

riserun=63=2\frac{\text{rise}}{\text{run}} = \frac{6}{3} = 2

From slope formula to slope-intercept form

Once you know the slope, you can use slope-intercept form

y=mx+by = mx + b

to write the equation of the line, as long as the line is not vertical.

Using the example above, m=2m = 2. Substitute one point, such as (2,3)(2, 3):

3=2(2)+b3 = 2(2) + b 3=4+b3 = 4 + b b=1b = -1

So the line is

y=2x1y = 2x - 1

The connection is practical: the slope formula gives you mm, and slope-intercept form uses that slope to write the full equation.

Common mistakes with the slope formula

One common mistake is subtracting the yy-values in one order and the xx-values in the opposite order. If you use y2y1y_2 - y_1, you must also use x2x1x_2 - x_1.

Another mistake is saying a vertical line has slope 00. A horizontal line has slope 00. A vertical line has undefined slope because the denominator becomes 00.

A third mistake is ignoring the sign. A negative slope means the line goes down as xx increases.

When to use the slope formula

Use the slope formula when you know two points on a line and want its rate of change. This comes up in algebra, coordinate geometry, graphing, and any linear relationship where equal changes in xx produce a constant change in yy.

If the graph is not a straight line, the slope between two points is only the slope of the secant line between those points. It is not one constant slope for the whole graph.

Try a similar problem

Try your own version with the points (1,2)(1, -2) and (4,7)(4, 7). Find the slope first, then use one point to write the equation in slope-intercept form. If you want another case right after this, continue with How To Find Slope or Slope Intercept Form.

Need help with a problem?

Upload your question and get a verified, step-by-step solution in seconds.

Open GPAI Solver →