Definitions
To understand the vertical & horizontal line test let’s look at a number of definitions and examples.
Vertical Line Test, Horizontal Line Test, One-to-one Function
If no two different points in a graph have the same first coordinate, this means that vertical lines cross the graph at most once. This is known as the vertical line test. Graphs that pass the vertical line test are graphs of functions.
If no two different points in a graph have the same second coordinate, this means that horizontal lines cross the graph at most once. This is known as the horizontal line test. Functions whose graphs pass the horizontal line test are called one-to-one.
Graphs that pass both the vertical line and horizontal line tests are one-to-one functions. These are exactly those functions whose inverse relation is also a function. One-to-one functions have an inverse. 1
![]() | ![]() | ![]() | ![]() |
Function, not one-to-one | Not a function | One-to-one function | One-to-one function |
Vertical Line Test
The vertical line test is a graphical method of determining whether a curve in the plane represents the graph of a function by visually examining the number of intersections of the curve with vertical lines.
The motivation for the vertical line test is as follows: A relation B”> is a function precisely when each element
is matched to at most one value
and, as a result, any vertical line in the plane can intersect the graph of a function at most once. Therefore, the vertical line test concludes that a curve in the plane represents the graph of a function if and only if no vertical line intersects it more than once.2
The horizontal line test, which tests if any horizontal line intersects a graph at more than one point, can have three different results when applied to functions: 2
- If no horizontal line intersects the function in more than one point, the function is one-to-one (or injective).
- If every horizontal line intersects the function in at least one point, it is onto (or surjective).
- If every horizontal line intersects the function in exactly one point, it is one-to-one and onto (or bijective).

Determining if a Graph Represents a Function
The big idea here lies in the definition of a function: each input (or x value) may have only one output (or y value). Based on this, we use what’s called the vertical line test to determine if a graph represents a function or not. This test helps us identify from the graph of a function if there’s anywhere that a single input may have two outputs.
Definition: If a vertical line drawn anywhere on the graph of a relation only intersects the graph at one point, then that graph represents a function. If a vertical line can intersect the graph at two or more points, then the graph does not represent a function.
This graph is a little strange. Most places we draw a vertical line, it’s easy to see that the line only intersects the graph at one point. Drawing a line at x=0x=0, it’s not quite so clear. However, the graph does not appear to ever exist there, so there is nowhere for a vertical line to intersect. Therefore, the graph passes the vertical line test and represents a function!3

How to determine the value of a function f(x) using a graph
- Go to the point on the x axis corresponding to the input for the function.
- Move up or down until you hit the graph.
- The y value at that point on the graph is the value for f(x) .
How to use the vertical line test to determine if a graph represents a function
- Look for places where a vertical line can be drawn on the graph that might hit the graph in more than one place.
- If it is possible to draw a vertical line that hits the graph in two or more places, the graph does NOT represent a function.
- If any vertical line drawn hits the graph in only one place, the graph does represent a function.
How to determine domain and range of a function using a graph
- To determine the domain, look at the values along the x axis that the graph reaches.
- To determine the range, look at the values along the y axis that the graph reaches.
References
1 “Index: Vertical And Horizontal Line Tests”. 2022. hardycalculus.com. http://hardycalculus.com/calcindex/IE_verticalline.htm.
2 “Vertical Line Test — From Wolfram MathWorld”. 2022. mathworld.wolfram.com. https://mathworld.wolfram.com/VerticalLineTest.html.
3 “2.3: Understanding Graphs Of Functions”. 2022. Mathematics LibreTexts. https://math.libretexts.org/Courses/Kansas_State_University/Your_Guide_to_Intermediate_Algebra/02%3A_Introduction_to_Functions_and_Graphing/2.03%3A_Understanding_Graphs_of_Functions.
Additional Reading
“Bijection, Injection And Surjection – Wikipedia”. 2022. en.wikipedia.org. https://en.wikipedia.org/wiki/Bijection,_injection_and_surjection.
Estela, Mike. 2022. “Vertical Line Test – chilimath”. chilimath. https://www.chilimath.com/lessons/intermediate-algebra/vertical-line-test/.
“Horizontal Line Test – Wikipedia”. 2022. en.wikipedia.org. https://en.wikipedia.org/wiki/Horizontal_line_test.
“Identify Functions Using Graphs | College Algebra”. 2022. courses.lumenlearning.com. https://courses.lumenlearning.com/waymakercollegealgebra/chapter/identify-functions-using-graphs/.
Nichols, Robert. “What Is A Vertical And Horizontal Line Test?” 2022. Quora. https://qr.ae/pvSXj7.
A vertical line test is a test to see if the graph of a relation represents a function. If you can at any location draw a vertical line that touches the graph in more than one location, then the relation is not a function. However if no vertical line exists that will intersect the graph in more than one location, then the relation is a function.
A horizontal line test is when you draw a horizontal line, if any horizontal line touches the relation in more than one location, the relation is not invertible. That is, the inverse would not be a function. However if no horizontal line exists that would touch in more than one location an inverse function does exist.
Any relation that passes both the horizontal and vertical line tests is said to be one-to-one.

“Vertical Line Test: Definition, Simple Steps – Calculus How To”. 2021. Calculus How To. https://www.calculushowto.com/vertical-line-test/.
“Vertical Line Test – Definition, Uses, Examples”. 2022. CUEMATH. https://www.cuemath.com/algebra/vertical-line-test/.
“Vertical Line Test – Wikipedia”. 2022. en.wikipedia.org. https://en.wikipedia.org/wiki/Vertical_line_test.
Videos
What is the vertical line test? And how do we use it? Sometimes we have a graph of a relation or curve, and we want to figure out if it is a function or not. One way to do this is to use the vertical line test. The vertical line test is a quick visual way of checking if an element in the domain of a function relates to more than one element in the range. If not, then the relation will pass the test and is a function. The vertical line test tells us that if any vertical line intersects our relation more than once, then the relation is not a function, because it must have a domain element related to more than one range element. We go over some examples of the vertical line test, and explain it in detail in today’s math video lesson!
This math video focuses on functions. It explains how to tell if a relation is a function given a set of ordered pairs or a data table. In addition, it explains how to use the vertical line test to determine if a graph or curve is a function based on if it touches the line at two or more points. Finally, this video discusses the domain and range of functions briefly.
The featured image on this page is from the YouTube video “What is the Vertical Line Test? (and How to Use It) | Functions and Relations”. 2022. youtube.com. https://www.youtube.com/watch?v=ZqYaevf1YiA.