Undefined Slope: Definition, Equation & Examples
Undefined Slope: Definition, Equation & Examples
TL;DR
An undefined slope is the slope of a vertical line, where every point shares the same x-coordinate, so the slope formula divides by zero. This article covers why a vertical line's slope is undefined, the equation x = a, the graph, how undefined slope differs from zero slope, and six worked examples.
What Is an Undefined Slope?
An undefined slope is the slope of a vertical line, a line that runs straight up and down, parallel to the y-axis. On such a line, every point has the same x-coordinate while the y-coordinate is free to change. As you trace the line, you move only up or down, never left or right.
The slope of any line measures steepness as rise over run, the change in y divided by the change in x. For a vertical line the run, the change in x, is zero. Dividing by zero has no answer in mathematics, so the slope has no value at all. We do not call it "infinite" or "zero"; we call it precisely undefined, because the operation that would produce it is not allowed. (For the general slope idea, see Slope of a Line.)
Why Is the Slope of a Vertical Line Undefined?
This is the question at the centre of the topic, and the slope formula answers it in one line. For any two points (x1,y1) and (x2,y2):
m = \frac{y_2 - y_1}{x_2 - x_1}.
On a vertical line, both points share the same x-coordinate, so x1=x2 and the denominator becomes:
x2−x1=0.
That leaves: m = \frac{y_2 - y_1}{0}.
Division by zero is undefined: there is no number that, multiplied by 0, gives a non-zero numerator. So the slope simply does not exist as a value. The geometry says the same thing in plain words: the line is infinitely steep, climbing without moving sideways at all, and "infinitely steep" is not a number you can write down. That is why a vertical line's slope is undefined, not large, not infinite, just undefined.
The Equation of a Line With Undefined Slope
Because a vertical line holds its x-coordinate constant, its equation names that fixed value and nothing else:
x=a,
where a is the constant x-value the line sits at. There is no y in the equation, because the line accepts every y-value, so y never needs to be specified. A few examples make the pattern clear:
- x=3 passes through every point with x-coordinate 3, such as (3,0), (3,5), and (3,−2).
- x=−4 is the vertical line four units left of the y-axis.
- x=0 is the y-axis itself, a special vertical line.
Notice a vertical line cannot be written in slope-intercept form y=mx+b, because there is no value of m to put in; the slope is undefined. The form x=a is the only way to write it.
What Does an Undefined Slope Look Like on a Graph?
The graph is the easiest part to recognise once you know the rule: a line with undefined slope is always a straight vertical line. To draw x=a:
- Mark the constant x-value on the x-axis (say, a=2, so mark (2,0)).
- Draw a straight line through that mark running straight up and down, parallel to the y-axis.
- Every point you cross, such as (2,−3), (2,1), and (2,4), shares the x-coordinate 2, which confirms the line is vertical.
If a line on a graph rises straight up with no sideways lean, its slope is undefined. Any lean at all, however slight, gives a defined (very large) slope instead.
Undefined Slope vs Zero Slope
This is the comparison that causes the most trouble, so it is worth pinning down. The two are opposites, not two names for the same thing.
| Feature | Zero slope | Undefined slope |
|---|---|---|
| Type of line | horizontal | vertical |
| Equation | y=b | x=a |
| Slope value | m=0 | no value (undefined) |
| What stays constant | y-coordinate | x-coordinate |
| Slope formula gives | \frac{0}{non-zero}=0 | \frac{non-zero}{0}=undefined |
| Angle with x-axis | 0° | 90° |
The whole distinction lives in which part of the fraction is zero. A horizontal line has a zero numerator (rise =0), and zero divided by a real number is just 0, a perfectly good slope. A vertical line has a zero denominator (run =0), and dividing by zero is not allowed, so the slope is undefined. The pairing to memorise: zero on top is flat (slope 0); zero on the bottom is vertical (undefined).
Examples of Undefined Slope
With the definition, the division-by-zero reason, and the equation in place, here is the concept doing real work. The problems build from naming a line up to telling undefined from zero slope.
Example 1 - What is the slope of the line x=5?
It is a vertical line, every point has x-coordinate 5, so the slope is undefined.
Final answer: undefined.
Example 2 - Find the slope of the line through (2,−5) and (2,−3)
A common first move is to compute \frac{-3 - (-5)}{2 - 2} = \frac{2}{0} and then record the slope as 0, reading the zero in the denominator as if the whole fraction were zero. Check that reading: \frac{2}{0} is not 0. Zero comes from \frac{0}{non-zero}; a zero on top. A zero on the bottom means the division cannot be done at all.
Done correctly: m=\frac{-3 - (-5)}{2 - 2} = \frac{2}{0}, which is undefined. The two points share x-coordinate 2, so the line is vertical with undefined slope.
Example 3 - Write the equation of the vertical line passing through (7,−1)
A vertical line holds its x-coordinate constant, and here that value is 7. The equation is x=7.
Final answer: x=7.
Example 4 - A line passes through (−4,2) and (−4,9). Find its slope and equation.
Both points have x-coordinate −4, so the line is vertical: equation x=−4. Slope check: m=\frac{9−2}{−4−(−4)} = \frac{7}{0}, which is undefined, confirming the vertical line.
Final answer: equation x=−4; slope undefined.
Example 5 - Can the line x=6 be written in slope-intercept form?
No. Slope-intercept form needs a slope value for m, but a vertical line's slope is undefined, so there is no m to use. The line can only be written as x=6.
Final answer: no, only x=6.
Example 6 - A line through (3,4) and (8,4) is claimed to have undefined slope. Is that right?
Check the coordinates: the y-values match (4 and 4), not the x-values. So this is a horizontal line, with m=\frac{4−4}{8−3} = \frac{0}{5} = 0. The slope is 0, not undefined.
Final answer: no; the slope is 0 (horizontal line).
Where Undefined Slope Shows Up
A vertical line, and its undefined slope, is the picture for "no horizontal change at all," which turns up the moment one quantity is fixed while another varies freely.
- Instant change. On a graph of any quantity over time, a vertical segment would mean a value jumping between two readings in zero time, which is why true vertical lines flag idealised, instantaneous changes rather than real continuous processes.
- Boundaries and limits. A vertical line on a chart often marks a fixed cutoff, a deadline date, a price ceiling, a temperature threshold, where one axis is pinned and the other runs free.
- Surveying and construction. A plumb line hanging from a weight is a physical vertical line; its undefined slope is exactly why builders use it as the reference for "perfectly upright."
- Function tests. The vertical-line test uses these lines to check whether a graph is a function at all: if any vertical line hits a curve more than once, one input has two outputs, and it is not a function.
The coordinate framework that lets us write a vertical line as x=a and reason about its slope traces back to René Descartes and his 1637 union of algebra and geometry, the same system behind every graph you plot.
Where Students Trip Up on Undefined Slope
Mistake 1: Calling an undefined slope "zero"
Where it slips in: The slope calculation gives \frac{2}{0}, and the student records the slope as 0.
Don't do this: Read a zero in the denominator as if the whole fraction equals zero.
The correct way: \frac{2}{0} is undefined, not 0. Zero slope comes from \frac{0}{non-zero}. The pairing: zero on top is flat; zero on the bottom is vertical and undefined.
Mistake 2: Writing the equation as y=a instead of x=a
Where it slips in: Asked for a vertical line at x=5, a student writes y=5.
Don't do this: Reach for y out of habit.
The correct way: A vertical line keeps x constant, so it is x=5. The missing variable names the direction: no y means vertical; no x means horizontal.
Mistake 3: Saying a vertical line has "no slope" and stopping there
Where it slips in: A student reports "no slope" and treats it as the same as a slope of 0.
Don't do this: Blur "undefined slope" together with "slope of zero."
The correct way: "Undefined slope" and "slope of zero" describe opposite lines, vertical and horizontal. Saying a vertical line has "no defined slope value" is fine, but it must never be confused with the flat line whose slope is the number 0.
Key Takeaways
- An undefined slope belongs to a vertical line; its equation is x=a, with no y in it.
- The slope is undefined because all points share an x-coordinate, so rise over run divides by zero.
- Undefined slope (vertical, run =0) is the opposite of zero slope (horizontal, rise =0).
- A vertical line cannot be written in slope-intercept form, since there is no slope value to use.
- Reading the slope fraction aloud, "non-zero over zero," makes "undefined" clear.
Frequently Asked Questions
What is an undefined slope?
The slope of a vertical line. Every point on the line shares one x-coordinate, so the run is zero and the slope formula divides by zero, which has no value.
What is the equation of a line with undefined slope?
x=a, where a is the constant x-value. Examples include x=3, x=−4, and x=0 (the y-axis). It cannot be written as y=mx+b.
Is a zero slope the same as an undefined slope?
No. A zero slope is a horizontal line (y=b), where the rise is zero so the slope is the number 0. An undefined slope is a vertical line (x=a), where the run is zero so the slope has no value.
Do you have an undefined slope when a line is parallel to the y-axis?
Yes. A line parallel to the y-axis is vertical, so all its points share an x-coordinate and its slope is undefined.
Why is the slope of a vertical line undefined and not infinite?
Because the slope formula divides by zero, and division by zero produces no number, not even infinity. "Infinitely steep" describes the picture, but the value itself is undefined rather than equal to any number, including ∞.