Vertical Line Test

The Vertical Line Test is the geometric realization of the fundamental definition of a function.

As you progress through your STEM track, you will find that the shift from seeing a “drawing” to seeing a “mapping” is critical for higher-level calculus.

Definition of the Vertical Line Test

The Vertical Line Test is a visual method used to determine if a relation is a function.

The Rule: A curve in the xy-plane represents a function if and only if no vertical line intersects the curve at more than one point.

If even one vertical line crosses the graph at two or more points, the relation fails the test and is not considered a function.

The Logic: Why It Works

The mathematical definition of a function f(x) requires that for every input x, there is exactly one output y.

  • A vertical line represents a constant x-value (for example, the vertical line x = 3).
  • If a vertical line hits a curve twice — say at (3, 2) and (3, 5) — this means the input x=3 has produced two different outputs (y=2 and y=5).
  • This “multi-valued” behaviour violates the definition of a function, meaning that if the graph of two sets of values does not pass the vertical line test, it is not a function.

Vertical Line Test vs. Horizontal Line Test

At a university level, you must distinguish between these two tests as they tell you different things about the mathematical “mapping”:

If a function passes the Horizontal Line Test, it means that every y-value is reached by only one x-value. This is necessary to prove that a function has an Inverse (the ability to “undo” the function and go backwards from y to x).

Edge Cases: Piecewise and Discrete Functions

In your advanced studies, you will encounter graphs that look “broken”. These are either Piecewise-Defined Functions or Discrete Functions.

  • Discrete Points — If a graph is just a set of dots, you still apply the test. If two dots align vertically, it’s not a function.
  • Piecewise Functions — You might see a graph where a line ends with an “open circle” (point not included) and another begins directly above it with a “closed circle” (point included). Because the vertical line only technically “hits” the closed circle, it passes the test.

Line Tests In STEM

In programming and data structures, this is the logic behind a Key-Value Pair or a Map.

  • * In a JavaScript Object or Map, a “key” (the input x) can only point to one “value” (the output y).
  • * If you try to assign a new value to an existing key, you don’t get two values; you overwrite the old one.
  • * Coding a “one-to-many” relationship requires a different structure (like an array of values), precisely because it would fail the “Vertical Line Test” of standard functional programming.
Notes

Resources
  1. Gemini AI. Prompt. Accessed 17 Jan 2026.
  2. https://youtu.be/DrEXTC6mIO8?si=Mb5Hm2v9YlCQ0kbP