Undefined Slope
A vertical line has an undefined slope. Slope is the rise divided by the run, and on a vertical line the run is zero. Dividing by zero does not produce a number, so there is no slope to report. Its equation always looks like x = a number.
What an undefined slope means on a line
Slope measures how much a line climbs for each step you take sideways. Take two points, subtract to get the rise and the run, and divide.
slope = (y2 − y1) ÷ (x2 − x1)
On a vertical line every point sits at the same x value. Take a worked example, the points (3, 1) and (3, 5): the rise is 5 − 1 = 4, and the run is 3 − 3 = 0. The division is 4 ÷ 0, and that does not produce a number. The slope is undefined.
This is not a quirk of one example. Any line you can draw straight up and down has the same x value at every height, so the run is always zero and the slope is always undefined. Those lines are exactly the ones written as x = a number: x = 3, x = −7, x = 0. The y-axis itself is one of them.
Why the slope is undefined and not just impossible to work out
It is easy to stop at “you cannot divide by zero”. That is true, but on its own it sounds like a rule someone made up, and it leaves the obvious question unanswered: why not just agree on an answer and move on?
The reason is worth seeing, because it is short. Division is defined as the reverse of multiplication. Saying 4 ÷ 0 = y is the same as saying 0 × y = 4. But zero times anything is zero, so nothing can go in that gap. Wolfram MathWorld puts it as the uniqueness of division breaking down, since the product of zero and any number is the same zero, so the original number cannot be recovered by reversing the multiplication.
There is a neat check on this. Try 0 ÷ 0 and the opposite problem appears: 0 × y = 0 is true for every y, so instead of no answer there are infinitely many. One breaks because nothing fits and the other because everything does. Neither gives you a slope. Two different points on a vertical line cannot produce 0 ÷ 0 anyway, since the rise would have to be zero too, which means you used the same point twice.
So the slope of a vertical line is not a number that is hard to find, or too large to write down. There is no number that belongs there at all. That is what undefined means.
Undefined slope against zero slope, and how to keep them apart
This is the pair people mix up, and it is worth being slow about. A zero slope and an undefined slope are opposites, not variations of the same idea.
| Zero slope | Undefined slope | |
|---|---|---|
| The line | Horizontal, flat | Vertical, straight up |
| Equation | y = a number | x = a number |
| Rise | 0 | Any amount |
| Run | Any amount | 0 |
| The division | 0 ÷ 8 | 8 ÷ 0 |
| The slope | 0, a real answer | Undefined, no answer exists |
The whole difference sits in which number ends up on the bottom. Zero on top is fine: 0 ÷ 8 is 0, a perfectly good slope that says the line does not climb. Zero on the bottom is the problem.
So a horizontal line has a slope and that slope happens to be zero. A vertical line does not have one. Those are different situations, even though both sentences contain the word zero. The flat case has its own quirks worth reading separately, set out under zero slope.
No slope, infinite slope, undefined slope: which is right
Three phrases circulate for the same line, which is a large part of why this topic stays confusing. They are not all equally safe.
- Undefined slope. The standard answer in coordinate geometry, and the one to write in an exam.
- No slope. Means the same thing, but it is a trap phrase. Read quickly it sounds like “a slope of nothing”, which people take as zero, which is the opposite line. Worth understanding when you meet it, and worth avoiding when you write.
- Infinite slope. This one is not simply wrong, and that is the part rarely explained.
Wikipedia’s own article on slope carries both descriptions in the same passage: it says a vertical line has undefined or infinite slope, and that the formula fails for a vertical line, where the slope can be taken as infinite, so the slope of a vertical line is considered undefined. That reads like a contradiction until you know that the two words belong to different settings.
In ordinary coordinate geometry, which is the setting for school work, slopes are real numbers and infinity is not one, so the answer is undefined. In other settings mathematicians deliberately extend the number system by adding a point at infinity, and there a vertical line can be assigned that value. MathWorld notes that in the extended complex plane one can formally write 1 ÷ 0 = infinity, while still holding that zero has no multiplicative inverse.
The practical version: write undefined. Unless you have been told you are working in a system that includes a point at infinity, you are not, and in an ordinary algebra course “infinite slope” may well be marked wrong. The word is not nonsense, it just belongs somewhere else.
Two more phrases belong in the same family. You will see the line itself called an undefined line, and the picture called an undefined graph. The line is perfectly well defined, and you can draw it without any trouble. It is only the slope that has no value, so “a line with an undefined slope” is the accurate way to say it. Vertical slope is the same slip in the other direction: the line is vertical, the slope is undefined.
Reading a slope written as 7 over 0 or 6 over 0
Slopes often arrive as a fraction rather than a finished number, and a fraction with 0 underneath is the same situation wearing different clothes.
If you work out a slope and land on 7/0, or 6/0, or any number over zero, you have found a vertical line and the slope is undefined. There is nothing further to simplify and no need to reach for a calculator, because the zero on the bottom settles it on its own. The number on top does not matter: 1/0 and 900/0 are equally undefined.
Watch the fraction the right way up, though. 0/7 is not the same as 7/0. The first is zero, a horizontal line. The second is undefined, a vertical one. The two answers could not be further apart, and the only difference on the page is which side of the bar the zero sits.
Three ways to spot an undefined slope
You will meet this in three forms, and each has a giveaway that takes a second.
- From a graph. The line runs straight up and down, parallel to the y-axis. If you can rest a ruler vertically along it, the slope is undefined.
- From two points. Compare the x values first. If they match, stop: the run is zero and the slope is undefined. (3, 1) and (3, 5) both sit at x = 3, so there is no need to work out the rise at all.
- From an equation. If it reads x = something with no y anywhere in it, the line is vertical. x = 3 is vertical. y = 3 is horizontal. The letter that appears alone tells you which.
The middle one is worth making a habit. Checking whether the two x values match takes a moment and settles the question before any arithmetic starts, rather than working out the rise, dividing, and then trying to interpret an error.
There is one more place this shows up, and it explains why vertical lines get singled out so often. A graph represents a function only if every x value has a single y value, which is what the vertical line test checks. A vertical line fails that test at once, since one x value carries every y on the line. So a vertical line is not the graph of a function of x, and that comes from the same feature as the undefined slope: x stays fixed while y moves. On a curve the equivalent moment is where the tangent line stands vertical and the derivative dy/dx has no finite value.
Frequently asked questions
Is a slope of 0 an undefined slope?
No, they are opposites. A slope of 0 is a real answer belonging to a horizontal line, and it says the line does not climb at all. An undefined slope belongs to a vertical line and means no number can be given. The confusion comes from both descriptions containing the word zero, but in one case the zero is on top of the fraction and in the other it is underneath.
Is 6 over 0 an undefined slope?
Yes. A nonzero number divided by zero is undefined, so 6/0 is an undefined slope and the line is vertical. The same goes for 7/0 or any other nonzero value over zero. What decides it is the zero on the bottom, provided the top is not zero as well.
Do check you have not written the fraction upside down. 0/6 is zero, which is a horizontal line, and that is the opposite answer.
Is the slope of a vertical line infinity or undefined?
Undefined is the answer to give in coordinate geometry and in any exam. Slopes there are real numbers, and infinity is not a real number.
The reason you see infinity used is that some branches of mathematics extend the number system by adding a point at infinity, and in those settings a vertical line can be given that value. Wikipedia’s slope article reflects both usages in one passage, saying the slope can be taken as infinite and is considered undefined. Unless you have been told you are working in such a system, write undefined.
What is the difference between no slope and zero slope?
“No slope” is another way of saying undefined, so it describes a vertical line. “Zero slope” describes a horizontal one. They point at opposite lines despite sounding similar, which is why “no slope” is a phrase better understood than used. If a question uses it, read it as undefined.
How do you write the equation of a line with an undefined slope?
As x = a number, where the number is the x value every point on the line shares. A vertical line through (3, 1) is x = 3, and so is a vertical line through (3, 1000). The y coordinate does not enter the equation.
You cannot use y = mx + b for it, because that form needs a value for m and there is not one. This is the one line the slope intercept form cannot describe, and it is worth remembering when a question asks for an equation and the form will not accommodate it.
Point slope form, y − y1 = m(x − x1), fails for the same reason, since it also asks for a value of m. Standard form does work. Written as Ax + By = C with A = 1, B = 0 and C = 3, the equation is 1x + 0y = 3, and the y term drops out to leave x = 3. So the honest answer is that one of the three forms can carry a vertical line, and it is the one students reach for last.
Can a line with an undefined slope be graphed?
Yes, and this is worth separating out. The line is easy to draw: mark the x value on the horizontal axis and rule a line straight up and down through it. For x = −2, find −2 and draw vertically.
Undefined describes the slope, not the line. The line is perfectly real and perfectly drawable. It is only the number measuring its steepness that does not exist.
Is a vertical line a function?
Not as a function of x. A function of x gives one y value for each x value, and a vertical line such as x = 3 holds every y value at that one x. That is what the vertical line test checks, and here the test line lies right on top of the graph and meets it at every point on it.
This connects to the slope. The derivative dy/dx is the slope of the curve, so on a vertical line it has no finite value either. Both facts come from the same feature: x stays fixed while y moves.
What happens if I put an undefined slope into a calculator?
It depends on the tool, and the variation itself causes confusion. Some report undefined, some show an error, some print a symbol for infinity, and spreadsheets typically return a division error such as #DIV/0!.
All of these are describing the same thing: the run came out at zero. Read any of them as a vertical line rather than as the tool having failed.