Sub topic 4
Reading Direction from Slope: Positive, Negative, Zero, Undefined
Prerequisites and goals
This chapter assumes you can plot points on the coordinate plane, work with signed numbers and fractions, and read slope as rise over run. By the end you should be able to look at a slope, or at two points, and say what the line does without drawing it. You will also be able to explain why a vertical line has no slope.
The core idea: the sign of the slope tells you the direction of the line when you read the graph from left to right.
Reading left to right
Slope is defined as rise over run, which is the change in y divided by the change in x:
m = (change in y) / (change in x)
The direction you read matters. Always read a graph from left to right, so that x increases. With that convention, the change in x (the run) is positive. The sign of the slope then depends only on the change in y (the rise):
- If y goes up as x increases, the rise is positive, so the slope is positive.
- If y goes down as x increases, the rise is negative, so the slope is negative.
- If y does not change, the rise is 0, so the slope is 0.
- If x does not change, the run is 0, so the slope is undefined.
The order of the checks matters. You test the change in x first, because a zero there makes the division impossible, and then you look at the change in y.
The four cases in detail
Positive slope
A line with a positive slope rises from left to right. Moving right by 1 unit moves you up by m units.
Take the line through (0, 1) and (2, 5). The change in y is 5 − 1 = 4 and the change in x is 2 − 0 = 2, so m = 4/2 = 2. Each step right of 1 goes up 2.
Negative slope
A line with a negative slope falls from left to right. Moving right by 1 unit moves you down by |m| units.
Take the line through (0, 5) and (4, 1). The change in y is 1 − 5 = −4 and the change in x is 4 − 0 = 4, so m = −4/4 = −1. Each step right of 1 goes down 1.
Zero slope
A line with zero slope is horizontal. Every point on it has the same y-value, so the rise is always 0. The equation of such a line has the form y = c, where c is a constant. For example, y = 3 passes through (−2, 3), (0, 3), and (5, 3).
Computing the slope from (−2, 3) and (5, 3) gives (3 − 3) / (5 − (−2)) = 0/7 = 0.
Zero slope is a real number. It means "no vertical change". It does not mean "no slope" or "undefined".
Undefined slope
A line with an undefined slope is vertical. Every point on it has the same x-value, so the run is always 0. The equation of such a line has the form x = c. For example, x = 4 passes through (4, −1), (4, 0), and (4, 6).
Computing the slope from (4, −1) and (4, 6) gives (6 − (−1)) / (4 − 4) = 7/0. Division by zero has no value, so the slope is undefined.
Summary table
| Slope | Line type | Left-to-right behavior | Equation form | Example points |
|---|---|---|---|---|
| m > 0 | Rising | Goes up | y = mx + b | (0, 1), (2, 5) |
| m < 0 | Falling | Goes down | y = mx + b | (0, 5), (4, 1) |
| m = 0 | Horizontal | Stays level | y = c | (−2, 3), (5, 3) |
| undefined | Vertical | No left-to-right movement | x = c | (4, −1), (4, 6) |
Steepness and the size of the slope
The sign gives the direction. The absolute value |m| gives the steepness. A larger |m| means a steeper line.
- Slopes 3 and −3 are equally steep, but 3 rises and −3 falls.
- A slope of 1/2 is gentle. A slope of 5 is steep.
- A slope of −0.1 falls slowly. A slope of −10 falls quickly.
As |m| grows very large, the line approaches vertical. The slope of an exactly vertical line is not a huge number. It is undefined, because no finite number describes "infinitely steep".
Why the order of the points does not matter
You can label the two points either way and get the same slope, as long as you stay consistent. Using (x1, y1) = (0, 5) and (x2, y2) = (4, 1) gives (1 − 5) / (4 − 0) = −1. Swapping them gives (5 − 1) / (0 − 4) = 4 / (−4) = −1.
Swapping the points flips the sign of both the numerator and the denominator, so the quotient is unchanged. The error to avoid is mixing the order, for example subtracting y1 from y2 on top but x2 from x1 on the bottom. That gives the wrong sign, and so the wrong direction.
Classifying a line with code
The function below computes the slope from two points and then reports the direction. It uses Fraction so that results are exact. It checks for equal x-values first, matching the flowchart.
from fractions import Fraction
def classify(x1, y1, x2, y2):
if x1 == x2 and y1 == y2:
raise ValueError("Two identical points do not determine a line")
if x1 == x2:
return None, "vertical (undefined slope)"
m = Fraction(y2 - y1, x2 - x1)
if m > 0:
return m, "rising"
if m < 0:
return m, "falling"
return m, "horizontal (zero slope)"
tests = [
(0, 1, 2, 5),
(0, 5, 4, 1),
(-2, 3, 5, 3),
(4, -1, 4, 6),
]
for pts in tests:
m, kind = classify(*pts)
print(pts, "->", m, kind)Running it prints:
(0, 1, 2, 5) -> 2 rising
(0, 5, 4, 1) -> -1 falling
(-2, 3, 5, 3) -> 0 horizontal (zero slope)
(4, -1, 4, 6) -> None vertical (undefined slope)The function returns None for a vertical line instead of a number, because no number is correct. It also rejects two identical points. A single point lies on infinitely many lines, so the direction cannot be determined.
Reading direction from an equation
When an equation is in the form y = mx + b, the number multiplying x is the slope, so its sign tells you the direction immediately.
| Equation | m | Direction |
|---|---|---|
| y = 3x − 2 | 3 | Rising |
| y = −x + 4 | −1 | Falling |
| y = −(2/5)x | −2/5 | Falling, gently |
| y = 7 | 0 | Horizontal |
| x = −3 | none | Vertical |
Two details trip people up:
- In y = −x + 4, the coefficient of x is −1, not 1. A bare minus sign in front of x means a coefficient of −1.
- In y = 7, there is no x term, so the coefficient of x is 0. This is why the slope is 0.
The equation x = −3 cannot be written as y = mx + b, because no value of m produces a vertical line. That is the algebraic version of the undefined slope.
Where the minus sign can hide
With fractions, a negative slope can be written in several equal ways:
- −2/3
- (−2)/3
- 2/(−3)
All three equal the same number, and all three describe a falling line. The slope 2/3 with a minus sign elsewhere in the formula can cause confusion, so check the sign of the final value only.
For example, take the points (1, 4) and (−2, 6). The change in y is 6 − 4 = 2 and the change in x is −2 − 1 = −3. The slope is 2/(−3) = −2/3. The line is falling, even though the rise on its own is positive. This is the reason you need both differences before judging the direction.
Common errors
- Reading right to left. Walking the graph from right to left reverses what you see. Always read left to right.
- Confusing 0 with undefined. Horizontal means 0. Vertical means undefined.
- Subtracting in mixed order. Use the same point first in both the numerator and denominator.
- Judging direction from the rise alone. A positive rise with a negative run gives a negative slope.
- Treating a large slope as "undefined". A slope of 1000 is defined and the line is steep but not vertical.
- Calling the slope of x = c "infinite". The accepted statement is that it is undefined.
Exercises
Exercise
Without graphing, state whether the line through (3, −2) and (7, −10) rises, falls, is horizontal, or is vertical. Give the slope.
Show answer
The change in y is −10 − (−2) = −8 and the change in x is 7 − 3 = 4. The slope is −8/4 = −2. Because the slope is negative, the line falls from left to right.
Exercise
A line passes through (−5, 6) and (−5, −1). What is its slope, and what is its equation?
Show answer
Both points have x = −5, so the change in x is 0 and the slope is undefined (division by zero). The line is vertical, and its equation is x = −5.
Exercise
Two students find the slope through (2, 9) and (6, 9). One answers "0" and the other answers "undefined". Who is correct, and why?
Show answer
The first student is correct. The change in y is 9 − 9 = 0 and the change in x is 6 − 2 = 4, so the slope is 0/4 = 0. The line is horizontal, y = 9. Undefined slope only happens when the change in x is 0.
Exercise
Classify each line by direction: (a) y = −4x + 1, (b) y = 0.5x − 6, (c) y = −2, (d) x = 8.
Show answer
(a) The slope is −4, so the line falls steeply. (b) The slope is 0.5, so the line rises gently. (c) The slope is 0, so the line is horizontal. (d) The slope is undefined, so the line is vertical.