Undefined Slope: Definition, Equation & Examples

#Geometry
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.
BT
Bhanzu TeamLast updated on September 30, 202610 min read

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)(x_1, y_1) and (x2,y2)(x_2, y_2):

m=y2−y1x2−x1.m = \frac{y_2 - y_1}{x_2 - x_1}.

On a vertical line, both points share the same x-coordinate, so x1=x2x_1 = x_2 and the denominator becomes:

x2−x1=0.x_2 - x_1 = 0.

That leaves:

m=y2−y10.m = \frac{y_2 - y_1}{0}.

Division by zero is undefined: there is no number that, multiplied by 00, 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,x = a,

where aa is the constant x-value the line sits at. There is no yy in the equation, because the line accepts every y-value, so yy never needs to be specified. A few examples make the pattern clear:

  • x=3x = 3 passes through every point with x-coordinate 33, such as (3,0)(3, 0), (3,5)(3, 5), and (3,−2)(3, -2).

  • x=−4x = -4 is the vertical line four units left of the y-axis.

  • x=0x = 0 is the y-axis itself, a special vertical line.

Notice a vertical line cannot be written in slope-intercept form y=mx+by = mx + b, because there is no value of mm to put in; the slope is undefined. The form x=ax = 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=ax = a:

  1. Mark the constant x-value on the x-axis (say, a=2a = 2, so mark (2,0)(2, 0)).

  2. Draw a straight line through that mark running straight up and down, parallel to the y-axis.

  3. Every point you cross, such as (2,−3)(2, -3), (2,1)(2, 1), and (2,4)(2, 4), shares the x-coordinate 22, 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=by = b

x=ax = a

Slope value

m=0m = 0

no value (undefined)

What stays constant

y-coordinate

x-coordinate

Slope formula gives

0non-zero=0\dfrac{0}{\text{non-zero}} = 0

non-zero0\dfrac{\text{non-zero}}{0} = undefined

Angle with x-axis

0∘0^\circ

90∘90^\circ

The whole distinction lives in which part of the fraction is zero. A horizontal line has a zero numerator (rise =0= 0), and zero divided by a real number is just 00, a perfectly good slope. A vertical line has a zero denominator (run =0= 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). A horizontal line's full treatment lives in Horizontal Line.

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=5x = 5?

It is a vertical line, every point has x-coordinate 55, so the slope is undefined.

Final answer: undefined.

Example 2 - Find the slope of the line through (2,−5)(2, -5) and (2,−3)(2, -3)

A common first move is to compute −3−(−5)2−2=20\dfrac{-3 - (-5)}{2 - 2} = \dfrac{2}{0} and then record the slope as 00, reading the zero in the denominator as if the whole fraction were zero. Check that reading: 20\dfrac{2}{0} is not 00. Zero comes from 02\dfrac{0}{2}, a zero on top. A zero on the bottom means the division cannot be done at all.

Done correctly: m=−3−(−5)2−2=20m = \dfrac{-3 - (-5)}{2 - 2} = \dfrac{2}{0}, which is undefined. The two points share x-coordinate 22, so the line is vertical with undefined slope.

Example 3 - Write the equation of the vertical line passing through (7,−1)(7, -1)

A vertical line holds its x-coordinate constant, and here that value is 77. The equation is x=7x = 7.

Final answer: x=7x = 7.

Example 4 - A line passes through (−4,2)(-4, 2) and (−4,9)(-4, 9). Find its slope and equation

Both points have x-coordinate −4-4, so the line is vertical: equation x=−4x = -4. Slope check: m=9−2−4−(−4)=70m = \dfrac{9 - 2}{-4 - (-4)} = \dfrac{7}{0}, which is undefined, confirming the vertical line.

Final answer: equation x=−4x = -4; slope undefined.

Example 5 - Can the line x=6x = 6 be written in slope-intercept form y=mx+by = mx + b?

No. Slope-intercept form needs a slope value for mm, but a vertical line's slope is undefined, so there is no mm to use. The line can only be written as x=6x = 6.

Final answer: no, only x=6x = 6.

Example 6 - A line through (3,4)(3, 4) and (8,4)(8, 4) is claimed to have undefined slope. Is that right?

Check the coordinates: the y-values match (44 and 44), not the x-values. So this is a horizontal line, with m=4−48−3=05=0m = \dfrac{4 - 4}{8 - 3} = \dfrac{0}{5} = 0. The slope is 00, not undefined.

Final answer: no; the slope is 00 (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=ax = 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 20\dfrac{2}{0}, and the student records the slope as 00.

Don't do this: Read a zero in the denominator as if the whole fraction equals zero.

The correct way: 20\dfrac{2}{0} is undefined, not 00. Zero slope comes from 0non-zero\dfrac{0}{\text{non-zero}}. The pairing: zero on top is flat; zero on the bottom is vertical and undefined.

Mistake 2: Writing the equation as y=ay = a instead of x=ax = a

Where it slips in: Asked for a vertical line at x=5x = 5, a student writes y=5y = 5.

Don't do this: Reach for yy out of habit.

The correct way: A vertical line keeps x constant, so it is x=5x = 5. The missing variable names the direction: no yy means vertical; no xx 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 00.

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 00.

Key Takeaways

  • An undefined slope belongs to a vertical line; its equation is x=ax = a, with no yy 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= 0) is the opposite of zero slope (horizontal, rise =0= 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.

Practice These Problems to Solidify Your Understanding

  1. What is the slope of the line x=−2x = -2?

  2. Find the slope of the line through (5,1)(5, 1) and (5,8)(5, 8), then write its equation.

  3. Is the slope of the line through (0,3)(0, 3) and (6,3)(6, 3) undefined or zero?

Answer to Question 1: undefined (vertical line). Answer to Question 2: undefined, since the run is 5−5=05 - 5 = 0; equation x=5x = 5. Answer to Question 3: zero, since the rise is 3−3=03 - 3 = 0 and 06=0\dfrac{0}{6} = 0 (a horizontal line). If Question 2 gave "00," recheck which coordinate stays constant.

Want a live Bhanzu trainer to walk your child through slope and line equations? Book a free demo class — online globally.

Also Read:

Was this article helpful?

Your feedback helps us write better content

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=ax = a, where aa is the constant x-value. Examples include x=3x = 3, x=−4x = -4, and x=0x = 0 (the y-axis). It cannot be written as y=mx+by = mx + b.
Is a zero slope the same as an undefined slope?
No. A zero slope is a horizontal line (y=by = b), where the rise is zero so the slope is the number 00. An undefined slope is a vertical line (x=ax = a), where the run is zero so the slope has no value. The companion topic for the flat case is the Horizontal Line.
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 ∞\infty.
✍️ Written By
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now →