Vertical Line — Equation, Slope, and Examples

Vertical Line — Equation, Slope, and Examples

What Is A Vertical Line?

A vertical line is a line on the coordinate plane that runs straight up and down, parallel to the y-axis, in which every point has the same x-coordinate regardless of its y-coordinate. Because it never leans left or right, it crosses the x-axis at exactly one place and never crosses the y-axis at all (unless it is the y-axis).

That single shared x-coordinate is the whole identity of the line. If you know that a line passes through (3,−2) and is vertical, you already know it passes through (3,0), (3,100), and (3,−47). The x-value is fixed; the y-value roams free. Compare that with a horizontal line, where the roles swap — the y-coordinate is fixed and the x-coordinate is free.

What Is The Equation Of A Vertical Line?

The equation of a vertical line is x = a, where a is the constant x-coordinate shared by every point on the line. Here a is a fixed real number — the x-intercept — and y does not appear in the equation at all, because y can be anything.

The variable glossary is short:

So the line one unit right of the y-axis is x=1. The y-axis itself is x=0. A line three units left is x=−3. There is no m and no b here, which is the first sign that this line does not behave like the lines in the slope-intercept form.

Why Is The Slope of A Vertical Line Undefined?

The slope of a vertical line is undefined, and that word is precise — it does not mean "zero" and it does not mean "infinity." It means the slope formula returns an expression with no numerical value.

Slope measures rise over run between two points (x1,y1) and (x2,y2):

m = \frac{y2 - y1}{x2 - x1}

Take any two points on the vertical line x=3, say (3,1) and (3,4).

Substitute the coordinates:

m = \frac{4 - 1}{3 - 3}

Simplify the numerator and the denominator:

m = \frac{3}{0}

Division by zero is undefined.

So m = \frac{3}{0} has no value. The numerator (the rise) is a real change in y, but the denominator (the run) is 0 because both x-coordinates are the same. A fraction with 0 on the bottom is not a number, so we say the slope is undefined. This is the single most important fact about vertical lines, and it follows directly from the definition — same x-coordinate everywhere means zero run, always.

Is the slope of a vertical line zero or undefined?

It is undefined. A slope of zero belongs to a horizontal line, where the rise is 0 and the run is non-zero, giving m=0. The two cases are mirror images, and mixing them up is the most common error here. A flat line has zero slope; an upright line has undefined slope.

What Is The Vertical Line Test?

The vertical line test is a quick visual check for whether a graph represents a function: if any vertical line drawn across the graph touches the curve at more than one point, the graph is not a function. The logic ties straight back to the definition — a vertical line holds x fixed, so two intersection points would mean one x-value mapping to two y-values, which a function is not allowed to do.

This is a small but useful payoff of understanding vertical lines deeply: the same property that makes their slope undefined is the property that makes them the perfect tool for testing functions.

Examples of Vertical Line

Example 1

Write the equation of the vertical line passing through the point (5,9).

A vertical line has the form x=a, where a is the x-coordinate.

The x-coordinate of the given point is 5.

So the equation is x=5.

Example 2

A student is asked for the slope of the line through (−2,4) and (−2,−3). They answer 0. Is that right?

Wrong path first. Seeing the two y-values 4 and −3, the student reasons that the line "goes flat" and writes m=0. Take a moment, though — both points have the same x-coordinate, −2, which means the points stack vertically, not flat.

Run the formula to check:

m=\frac{−3−4}{−2−(−2)}.

The denominator is 0, so the slope is undefined, not 0. The answer of 0 describes a horizontal line; this line is vertical. The fix is to look at the x-coordinates first: when they match, the line is vertical and the slope is undefined before you compute anything.

Example 3

Find the slope of the line x=−8.

The equation x=−8 has the form x=a, so it is a vertical line.

Every vertical line has the same x-coordinate at every point, giving a run of 0.

The slope is undefined.

Example 4

The x-intercept of a vertical line is −113. Write its equation.

The x-intercept is the constant a in x=a.

So the equation is x=−113.

Clearing the fraction gives the equivalent form 3x+11=0, which is the same line written in standard form.

Example 5

Is the line through (7,2) and (7,2.0001) vertical, and what is its slope?

Both points share the x-coordinate 7, so the line is vertical.

The run is 0, no matter how tiny the difference in y looks.

The slope is undefined. A near-zero rise does not rescue a zero run; the run being 0 is what decides the case.

Example 6

A line is parallel to the y-axis and passes through (−4,6). Write its equation and state its relationship to the x-axis.

A line parallel to the y-axis is vertical, so its equation is x=a with a=−4.

The equation is x=−4.

Because it runs straight up and down, it is perpendicular to the x-axis, meeting it at (−4,0) at a right angle, written ∠ of 90°.

Where vertical lines actually matter

Vertical lines look like the most boring object in coordinate geometry until you notice where the "undefined" rule does real work.

The deeper point: "undefined" is not a failure of the math. It is the math telling you, precisely, that this particular line cannot be measured by steepness — and that information is useful.

Where students trip up on vertical lines

Mistake 1: Calling the slope "zero" instead of "undefined"

Where it slips in: The moment two points share an x-coordinate and the student rushes to a number.

Don't do this: Writing m=0 for a line like x=4 because it "doesn't go anywhere."

The correct way: Check the run first. If x2−x1=0, the slope is undefined; a horizontal line (same y-coordinates) is the one with slope 0.

The first instinct on a vertical line is to treat "no movement" as "flat," and that swap between zero and undefined is the single error that shows up most often. Naming which coordinate is shared — x or y — settles it every time, and it is worth slowing down for that one check.

Mistake 2: Writing the equation as y = a

Where it slips in: When students pattern-match to y=mx+b and reach for y out of habit.

Don't do this: Writing y=3 for a line through (3,5) that is meant to be vertical.

The correct way: A vertical line fixes x, so its equation is x=a. The equation y=a describes a horizontal line. The memorizer who learned "lines look like y=…" gets caught here; the cure is to remember that the fixed coordinate names the equation.

Mistake 3: Trying to find a y-intercept

Where it slips in: On a worksheet that asks for the y-intercept of every line in a list.

Don't do this: Forcing a y-intercept for x=2.

The correct way: A vertical line x=a (with a≠0) never crosses the y-axis, so it has no y-intercept. Only the y-axis itself, x=0, touches the y-axis — along its whole length.

Key Takeaways

Answers to Practice Problems

  1. x=6.
  2. undefined (run = 0).
  3. x=−52.