Slope of a Line: Definition, Method and Examples

MathPublished

Understanding the Slope of a Line

Slope measures the steepness and direction of a line on a coordinate graph. It represents the constant rate of change between two variables. For any two distinct points on a nonvertical line, calculate the slope by dividing the vertical change by the horizontal change.

What is slope?

Slope, often called the gradient, describes how fast a value changes compared to another. In algebra, it defines the steepness of a straight line drawn on a coordinate plane.


Because straight lines have a constant rate of change, the slope remains the same everywhere along the line. This predictable steepness is a defining feature of linear equations. The mathematical variable for slope is typically mm.


The slope tells you how many units a line moves up or down for every unit it moves to the right.

Use rise over run

When you have a graph of a line, the easiest method to find its steepness is to use "rise over run".


The rise is the vertical change, meaning how far the line goes up or down. The run is the horizontal change, meaning how far the line moves left or right.

m=RiseRunm = \dfrac{\text{Rise}}{\text{Run}}

To calculate the slope from a graph:

  1. Identify two points where the line crosses the grid intersections exactly.
  2. Count the vertical units between the points to find the rise.
  3. Count the horizontal units between the same points to find the run.
  4. Divide the rise by the run, simplifying the fraction if possible.

A coordinate plane showing a line with a rise of 3 and a run of 4, demonstrating the rise over run method.

This method works for all straight lines, including directly proportional graphs that pass exactly through the origin.

Find slope from two points

If you are given the coordinates of two points, you can calculate the slope algebraically without having to plot points on a graph.


Use the slope formula:

m=y2−y1x2−x1m = \dfrac{y_2 - y_1}{x_2 - x_1}


Here, (x1,y1)(x_1, y_1) are the coordinates of the first point and (x2,y2)(x_2, y_2) are the coordinates of the second point.


When applying the formula, a simple subtraction table helps keep your coordinates aligned:

Point

xx-coordinate

yy-coordinate

Point 2

x2x_2

y2y_2

Point 1

x1x_1

y1y_1

Difference

x2−x1x_2 - x_1(Run)

y2−y1y_2 - y_1 (Rise)

Divide the yy-difference by the xx-difference to find the slope.


A coordinate grid displaying a line passing through the points negative 2 comma 3 and 3 comma negative 2, with dashed lines representing a rise of negative 5 and a run of 5.

Read positive negative and zero slope

You can instantly understand a line's behavior by looking at its direction from left to right.

  • Positive slope: The line goes uphill from left to right. As xx increases, yy increases. The calculated slope will be a positive number.
  • Negative slope: The line goes downhill from left to right. As xx increases, yy decreases. The calculated slope will be a negative number.
  • Zero slope: The line is perfectly horizontal. The yy-value never changes, meaning the rise is 00. Since 00 divided by any non-zero run is 00, horizontal lines always have a slope of 00.

Three small graphs side by side illustrating a positive slope going uphill, a negative slope going downhill, and a zero slope that is perfectly horizontal.

Handle vertical lines

A perfectly vertical line behaves differently from other straight lines on a graph.


For a vertical line, all the points share the exact same xx-coordinate. When you attempt to calculate the horizontal change (the run), the difference between the xx-values is 00.


Because division by zero is mathematically undefined, a vertical line does not have a slope.


Vertical lines have an undefined slope, not a slope of zero.


A coordinate plane showing a perfectly vertical line passing through x equals 2, labeled as having an undefined slope.

Worked examples

Understanding the direction and steepness of lines helps when graphing linear equations. Here are three examples showing different slope calculations.


Example 1: Finding slope from a graph


Question: A line passes through (0,2)(0, 2) and (3,8)(3, 8). What is its slope?


Method:

  1. Let (x1,y1)=(0,2)(x_1, y_1) = (0, 2) and (x2,y2)=(3,8)(x_2, y_2) = (3, 8).
  2. Substitute into the formula: m=y2−y1x2−x1m = \dfrac{y_2 - y_1}{x_2 - x_1}.
  3. Calculate the rise: 8−2=68 - 2 = 6.
  4. Calculate the run: 3−0=33 - 0 = 3.
  5. Divide the rise by the run: m=63m = \dfrac{6}{3}.
  6. Simplify: m=2m = 2.

Answer: The slope of the line is 22.


Check: The slope is positive, and the yy-values increase as xx increases, which confirms a positive rate of change.


Example 2: Calculating a negative fraction


Question: What is the slope of the line connecting (−4,5)(-4, 5) and (1,−2)(1, -2)?

Method:

  1. Label the points: (x1,y1)=(−4,5)(x_1, y_1) = (-4, 5) and (x2,y2)=(1,−2)(x_2, y_2) = (1, -2).
  2. Apply the slope formula: m=−2−51−(−4)m = \dfrac{-2 - 5}{1 - (-4)}.
  3. Subtract the yy-values: −2−5=−7-2 - 5 = -7.
  4. Subtract the xx-values: 1−(−4)=1+4=51 - (-4) = 1 + 4 = 5.
  5. Write as a fraction: m=−75m = \dfrac{-7}{5}.

Answer: The slope is −75-\dfrac{7}{5}.


Check: Reversing the order yields m=5−(−2)−4−1=7−5=−75m = \dfrac{5 - (-2)}{-4 - 1} = \dfrac{7}{-5} = -\dfrac{7}{5}. The answer is correct.


Example 3: Comparing horizontal coordinates


Question: Find the slope of the line containing (6,4)(6, 4) and (−2,4)(-2, 4).


Method:

  1. Label the coordinates: (x1,y1)=(6,4)(x_1, y_1) = (6, 4) and (x2,y2)=(−2,4)(x_2, y_2) = (-2, 4).
  2. Calculate the rise: 4−4=04 - 4 = 0.
  3. Calculate the run: −2−6=−8-2 - 6 = -8.
  4. Divide the rise by the run: m=0−8m = \dfrac{0}{-8}.
  5. Any fraction with zero in the numerator equals zero.

Answer: The slope is 00.


Check: Both yy-coordinates are 44. The line is horizontal, which confirms the slope must be zero.

Common mistakes

  • Flipping rise and run: A frequent mistake is dividing the run by the rise. Always ensure the change in yy is the numerator and the change in xx is the denominator. Remember the phrase "rise before you run."
  • Inconsistent subtraction order: When applying the slope formula, you can choose either point as (x1,y1)(x_1, y_1). However, if you subtract y1y_1 from y2y_2, you must subtract x1x_1 from x2x_2. Mixing the order will result in a slope with the wrong sign.
  • Mishandling negative numbers: Subtracting a negative coordinate requires adding a positive value. Keep careful track of signs when evaluating expressions like 5−(−3)5 - (-3).

Frequently asked questions

Is slope the same as the gradient?

Yes. In mathematics, gradient and slope are two words for the exact same concept. They both measure the steepness and direction of a line using the ratio of vertical change to horizontal change.


Can a slope be a fraction or a decimal?

Yes. Slopes are often written as fractions because the numerator directly represents the rise and the denominator represents the run. Decimal forms are also mathematically correct but can make counting points on a graph harder.


What happens if the denominator is zero?

If the run is zero, the line is perfectly vertical. Division by zero is undefined, so the line has an "undefined slope."

Practice questions

Question

A coordinate grid with a straight line passing through the points at negative 2 comma 0 and 2 comma 2.

What is the slope of the line shown on the coordinate plane?

  • 12\dfrac{1}{2}

  • 22

  • −12-\dfrac{1}{2}

  • −2-2

Answer:

12\dfrac{1}{2}

Question

What is the slope of the line that passes through the points (−3,7)(-3, 7) and (1,−5)(1, -5)?

  • −3-3

  • −13-\dfrac{1}{3}

  • 33

  • 13\dfrac{1}{3}

Answer:

−3-3

Question

Which statement accurately describes a line with a slope of zero?

  • The line is perfectly horizontal and has a constant yy-value.

  • The line is perfectly vertical and has an undefined steepness.

  • The line slants upward from left to right.

  • The line slants downward from left to right.

Answer:

The line is perfectly horizontal and has a constant yy-value.

Question

A vertical data table with three rows of x and y values, showing x values of negative 1, 2, and 5 corresponding to y values of 4, 13, and 22.

What is the constant rate of change (slope) for the linear relationship shown in the table?

  • 33

  • 13\dfrac{1}{3}

  • 99

  • −3-3

Answer:

33

Question

A line has a slope of −34-\dfrac{3}{4} and passes through the points (2,5)(2, 5) and (6,y)(6, y). What is the value of yy?

  • 22

  • 88

  • −2-2

  • 55

Answer:

22