Skip to main content

How to Find the Slope of a Line — Formula and Examples

Grade: 8–9 | Topic: Algebra

What You Will Learn

By the end of this page, you will be able to calculate the slope of a line from two points using the slope formula, interpret what positive, negative, zero, and undefined slopes mean visually, and use slope in the slope-intercept equation y=mx+by = mx + b.

Theory

What Is Slope?

Slope measures how steep a line is and which direction it goes. It tells you: for every 1 unit you move to the right along the x-axis, how many units does the line go up or down?

Slope is often described as rise over run:

m=riserun=vertical changehorizontal changem = \frac{\text{rise}}{\text{run}} = \frac{\text{vertical change}}{\text{horizontal change}}

The Slope Formula

Given two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) on a line:

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

The order matters — use the same point as "point 1" for both the numerator and denominator. Swapping both is fine; swapping only one gives the wrong sign.

Types of Slope

SlopeLine goes...Example
Positive (m>0m > 0)Uphill left to rightm=2m = 2
Negative (m<0m < 0)Downhill left to rightm=3m = -3
Zero (m=0m = 0)Perfectly horizontaly=4y = 4
UndefinedPerfectly verticalx=1x = -1

A vertical line has undefined slope because the denominator x2x1=0x_2 - x_1 = 0, and division by zero is undefined.

Slope in y=mx+by = mx + b

In the slope-intercept form y=mx+by = mx + b:

  • mm is the slope
  • bb is the y-intercept (where the line crosses the y-axis)

You can read the slope directly from the equation without calculating.

Worked Examples

Example 1: Slope from Two Points

Problem: Find the slope of the line passing through (2,3)(2, 3) and (6,11)(6, 11).

Step 1: Label the points: (x1,y1)=(2,3)(x_1, y_1) = (2, 3) and (x2,y2)=(6,11)(x_2, y_2) = (6, 11).

Step 2: Apply the slope formula. m=y2y1x2x1=11362=84=2m = \frac{y_2 - y_1}{x_2 - x_1} = \frac{11 - 3}{6 - 2} = \frac{8}{4} = 2

Answer: The slope is m=2\mathbf{m = 2} (for every 1 unit right, the line goes 2 units up).


Example 2: Negative Slope

Problem: Find the slope of the line through (1,5)(-1, 5) and (3,3)(3, -3).

Step 1: Apply the formula. m=353(1)=84=2m = \frac{-3 - 5}{3 - (-1)} = \frac{-8}{4} = -2

Answer: The slope is m=2\mathbf{m = -2} (the line goes downhill).


Example 3: Reading Slope from an Equation

Problem: What is the slope of y=34x+7y = -\dfrac{3}{4}x + 7?

Step 1: Identify mm in y=mx+by = mx + b.

The coefficient of xx is 34-\dfrac{3}{4}.

Answer: Slope =34= \mathbf{-\dfrac{3}{4}} (the line falls 3 units for every 4 units to the right).


Example 4: Slope from a Table of Values

Problem: The table shows values of xx and yy for a linear relationship.

xx0246
yy15913

Find the slope.

Step 1: Pick any two points, e.g. (0,1)(0, 1) and (2,5)(2, 5).

m=5120=42=2m = \frac{5 - 1}{2 - 0} = \frac{4}{2} = 2

Step 2: Verify with another pair: (4,9)(4, 9) and (6,13)(6, 13). m=13964=42=2m = \frac{13 - 9}{6 - 4} = \frac{4}{2} = 2 \checkmark

Answer: Slope =2= \mathbf{2}

Common Mistakes

Mistake 1: Subtracting x-values and y-values in the Wrong Order

m=x2x1y2y1m = \frac{x_2 - x_1}{y_2 - y_1} (run over rise)

m=y2y1x2x1m = \frac{y_2 - y_1}{x_2 - x_1} (rise over run). It is always the yy difference on top.

Mistake 2: Mixing Up Which Point is "Point 1"

m=y2y1x1x2m = \frac{y_2 - y_1}{x_1 - x_2} (used x1x2x_1 - x_2 instead of x2x1x_2 - x_1).

✅ Be consistent — subtract in the same order top and bottom. You can use either point as point 1, but you must use the same order for both the numerator and denominator.

Mistake 3: Calling a Horizontal Line "Undefined"

❌ The line y=5y = 5 has undefined slope.

y=5y = 5 is horizontal — slope = 0 (not undefined). A vertical line like x=3x = 3 has undefined slope.

Practice Problems

Try these on your own before checking the answers:

  1. Find the slope through (1,4)(1, 4) and (5,12)(5, 12).
  2. Find the slope through (3,7)(3, 7) and (3,2)(3, -2).
  3. Find the slope through (2,6)(-2, 6) and (4,6)(4, 6).
  4. What is the slope of y=5x3y = 5x - 3?
  5. A ramp rises 1.2 metres over a horizontal distance of 4 metres. What is its slope?
Click to see answers
  1. m=12451=84=2m = \frac{12 - 4}{5 - 1} = \frac{8}{4} = \mathbf{2}
  2. m=2733=90m = \frac{-2 - 7}{3 - 3} = \frac{-9}{0} = undefined (vertical line)
  3. m=664(2)=06=0m = \frac{6 - 6}{4 - (-2)} = \frac{0}{6} = \mathbf{0} (horizontal line)
  4. Slope =5= \mathbf{5} (coefficient of xx)
  5. m=1.24=0.3m = \frac{1.2}{4} = \mathbf{0.3}

Summary

  • Slope formula: m=y2y1x2x1m = \dfrac{y_2 - y_1}{x_2 - x_1} — always yy on top (rise), xx on bottom (run).
  • Positive slope = uphill; negative slope = downhill; zero = horizontal; undefined = vertical.
  • In y=mx+by = mx + b, the slope mm can be read directly from the equation.
  • Always subtract in a consistent order — same point as "point 1" for both numerator and denominator.

Need help with slope?

Take a photo of your math problem and MathPal will solve it step by step.

Open MathPal