Math

How to Find the Slope of a Line from Two Points

Learn to calculate slope using two points, avoid the most common coordinate mistake, and verify your answer.

· 5 min read

The slope formula

You find slope from two points using one formula: rise over run. Take the difference in y-coordinates and divide by the difference in x-coordinates.

The formula is:

m = (y₂ − y₁) / (x₂ − x₁)

That's it. Every slope problem with two points uses this exact calculation. The letter m stands for slope.

Here's what each part means:

  • y₂ and y₁ are your two y-coordinates
  • x₂ and x₁ are your two x-coordinates
  • The numerator (y₂ − y₁) is the rise
  • The denominator (x₂ − x₁) is the run

The result tells you how steep the line is and which direction it goes.

Label your points first

Before you plug numbers into the formula, label which point is which. Call one point (x₁, y₁) and the other (x₂, y₂). It doesn't matter which you pick as point 1 or point 2, but you must stay consistent.

Example: Find the slope between (3, 7) and (8, 15).

Label them:

  • Point 1: (3, 7) so x₁ = 3 and y₁ = 7
  • Point 2: (8, 15) so x₂ = 8 and y₂ = 15

Write these labels down. Don't try to hold them in your head. Most calculation errors happen because students mix up which number goes where.

You could also label the first point as point 2 and the second as point 1. The slope will be the same either way, as long as you're consistent in the formula.

Calculate rise over run

Now substitute your labeled coordinates into the formula.

Using our example:

m = (y₂ − y₁) / (x₂ − x₁)

m = (15 − 7) / (8 − 3)

m = 8 / 5

The slope is 8/5 or 1.6.

Break it into steps:

  1. Subtract the y-coordinates: 15 − 7 = 8 (this is your rise)
  2. Subtract the x-coordinates: 8 − 3 = 5 (this is your run)
  3. Divide rise by run: 8 ÷ 5 = 1.6

The rise is 8 because the line goes up 8 units. The run is 5 because it goes 5 units to the right. For every 5 units you move horizontally, the line climbs 8 units vertically.

Try another: Find the slope between (−2, 4) and (6, −8).

Label:

  • x₁ = −2, y₁ = 4
  • x₂ = 6, y₂ = −8

Calculate:

m = (−8 − 4) / (6 − (−2))

m = (−12) / (8)

m = −3/2 or −1.5

The negative slope means the line goes down as you move from left to right. For every 2 units right, it drops 3 units.

The mistake everyone makes

The most common error is mixing coordinates from different points. Students take y from one point and x from the other.

Wrong approach with (3, 7) and (8, 15):

m = (15 − 7) / (3 − 8)

This uses y₂ and y₁ correctly but then uses x₁ − x₂ instead of x₂ − x₁. The subtraction order flipped. This gives you −8/5 instead of 8/5. The sign is wrong.

Another version of the same mistake:

m = (7 − 15) / (8 − 3)

Here the student flipped the y-subtraction but kept the x-subtraction in the original order. This also gives −8/5.

The rule: whichever point you call point 2, use both its coordinates in the numerator first position and denominator first position. If you subtract y₁ from y₂, you must also subtract x₁ from x₂. If you subtract y₂ from y₁, you must subtract x₂ from x₁.

Both of these are correct:

  • m = (y₂ − y₁) / (x₂ − x₁)
  • m = (y₁ − y₂) / (x₁ − x₂)

They give the same answer. Mixing the two gives the wrong sign.

Write out your substitution step. Don't skip straight to the arithmetic. That one intermediate line catches most errors before they cost you points.

Sanity check your answer

Once you have a slope, check whether it makes sense.

Check the sign. Plot the two points mentally or on scratch paper. If the line goes up from left to right, the slope must be positive. If it goes down from left to right, the slope must be negative.

In our first example, (3, 7) to (8, 15): the second point is higher and to the right. The line rises. Slope of 8/5 is positive. That checks out.

In the second example, (−2, 4) to (6, −8): the second point is lower even though it's to the right. The line falls. Slope of −1.5 is negative. Correct.

Check the steepness. A slope close to zero is nearly flat. A slope with large absolute value is steep.

If your points are (1, 2) and (10, 3), the line rises only 1 unit over a run of 9 units. You should get a small slope: m = 1/9 ≈ 0.11. If you calculated m = 9, something went wrong.

If your points are (0, 0) and (2, 20), the line is very steep. You should get m = 10. If you got m = 0.1, you probably flipped rise and run.

Check special cases. If both points have the same y-coordinate, the line is horizontal and the slope is zero. If both points have the same x-coordinate, the line is vertical and the slope is undefined (you'd be dividing by zero).

Example: (4, 6) and (9, 6) gives m = (6 − 6) / (9 − 4) = 0 / 5 = 0. Horizontal line, slope zero.

Example: (3, 2) and (3, 8) gives m = (8 − 2) / (3 − 3) = 6 / 0, which is undefined. Vertical line, no slope.

Check your work

Run through this checklist after every slope calculation:

  1. Did you label both coordinates of each point before substituting?
  2. Did you subtract y-coordinates in the same order as x-coordinates?
  3. Is your slope's sign consistent with the direction of the line?
  4. Is the magnitude reasonable given how steep the line looks?

If you're working on a problem set, pick one problem and verify it by finding the equation of the line and plugging in both original points. They should both satisfy the equation. This takes an extra minute but catches errors that would propagate through the rest of the problem.

For quick practice with immediate feedback, try /chat and work through different point pairs until the pattern is automatic. The formula is simple, but accuracy comes from repetition.

Slope is the foundation for linear equations, tangent lines, and rates of change in calculus. Get the two-point formula solid now and everything built on it will be faster.

Try it on your own work.

Each one opens the chat with the question in the box. Change it to yours.

Questions.

Something else? Email hello@nerdly.us

No. You'll get the same slope either way, as long as you subtract both coordinates in the same order. Switching the labels just flips both the numerator and denominator, and the two negatives cancel.

The formula works exactly the same way. Just be careful with the subtraction. Subtracting a negative number means adding: 5 − (−3) = 5 + 3 = 8.

A slope of zero means the line is perfectly horizontal. The y-coordinate stays the same no matter what x is.

Both are correct. Leave it as a fraction if the problem doesn't specify, especially if the numbers divide evenly. Decimals are useful for graphing or comparing steepness quickly.

Stuck on a problem right now?

5 questions a day, free. No account, no card, nothing to install.

Ask a question
Join on TelegramHelp