Statistics How To

Vertical Line Test in Easy Steps with Examples

Calculus >

The vertical line test is an easy way to see if you have a function by looking at a graph. Any x-value for a function can have — at most — only one y-value. This fact tells you that a vertical line drawn anywhere on the graph will cross a graph one time — or not at all. If a graph meets this requirement, it passes the vertical line test. If any vertical line can cross a graph more than once, then the graph does not pass the vertical line test.


  1. What is a Function?
  2. Vertical Line Test Steps

What is a Function?

A function is a type of equation that has exactly one output (y) for every input (x). If you put a “2” into the equation x2, there’s only one output — 4. Some equations, like x = y2, are not functions, because there are two possibilities for each x-value (one positive and one negative). The “rule” for functions is sometimes described as:

  • Is a function: “many to one“. This is saying if you have multiple x-values that map to one y-value — say, (2,9), (3,9) and (6,9) — then that still qualifies as a function. Put more simply, it’s okay for a function to have multiple coordinate points in a straight line from left to right.
  • Not a function: “one to many“. In other words, let’s say you had one x-value that maps to many y-values. For example, — in coordinate notation — (2,1) and (2,10). If the first number (the x-value) repeats, then you do not have a function. To put that another way, if you have multiple coordinate points in a straight line up and down, then that’s not a function.

Issues with One to Many and Many to One

Although the above guidelines are found in many textbooks, they are deceptively complicated to use, because some graphs that have the “many to one” situation aren’t necessarily going to be functions; There may be other places (i.e. a couple of other coordinate points) that connect vertically, therefor disqualifying it as a function. These “rules” can also be difficult to remember (is it the first number that can repeat? Or the second?). Sometimes, it’s practically impossible to figure it out without some heavy algebra or the use of a computer. That’s because even if you have a few coordinates — or even an equation — you might be missing just a single point (perhaps with a very large x-value) that makes your graph not a function. The vertical line test is a much simpler way to figure out if you have a function.

Why is this important?

In simple terms, you can’t do much with an equation in calculus if it isn’t a function. You could cut up a complex function into smaller, function-like pieces (called piecewise functions), but in essence, calculus only works properly with functions. If you don’t perform a vertical line test before doing some calculus, then your solutions can be misleading or just plain wrong.

Vertical Line Test: Steps

In order to perform a vertical line test, you’ll need to graph the function.

Step 1: Draw the graph.

Step 2: Place a ruler vertically (straight up and down) on your graph. Move the ruler left to right along the length of the graph. Look for any place where the ruler crosses through the equation. If the ruler crosses the graph once, that’s fine. If it crosses it two or more times, then that’s not a function. To put that another way, if any x-value on the graph has more than one y-value (output), then the equation is not a function. Note that the vertical line is allowed to miss the graph, it just can’t hit it multiple times.

vertical line test

Are Circles Functions?

Circles are never functions, because each x-value has two y-values; Place a ruler vertically anywhere on the graph and the graph will cross the ruler twice.

However, semicircles might be functions. If the semicircle’s peak points up (as shown in the left image), it’s a function. If it points to the left or right, then it isn’t a function.

Are Parabolas Functions?

Parabolas follow the same rule as semicircles. Vertical parabolas (where the peak stretches along the y-axis) are functions. However, horizontal parabolas (i.e. one where the peak stretches out along the x-axis) are not functions:

Parabolas and circles both have y2, so this provides a clue: any equation that has y2 has a high chance of not being a function.

Inverse Trig Functions

As a general rule, inverse trig functions are actually not real functions, with one small exception. As an an example, sin is a function (shown in green in the image below). But if you create inverse sin by reflecting the function over the line y = x, you get a vertical wave that isn’t a function because it doesn’t pass the vertical line test. However, if you take a small piece of inverse sin that passes the vertical line test, then that small piece is a function.

This tiny section of inverse sine is a function.

Horizontal Line Test

While the vertical line test tells you if you have a function, the horizontal line test tells you if a function is one-to-one (or not one-to-one). More importantly, it let’s you know if a certain function has an inverse and if that inverse is also a function. It works in a similar way to the vertical line test, only this time you draw horizontal lines. If the lines can hit the graph at most once, then the function is one-to-one. Only one-to-one functions have inverses, so if your line hits the graph multiple times then don’t bother to calculate an inverse — because you won’t find one.

The horizontal line test can get a little tricky for specific function. For example, at first glance sin x should not have an inverse, because it doesn’t pass the horizontal line test. However, if you take a small section, the function does have an inverse. For example, on the interval [–π/2, π/2], y = sin x is one-to-one and therefore has an inverse for that interval.

The horizontal line test should be performed after the vertical line test. That’s because it’s quite possible for an equation to pass the horizontal line test, but not the vertical line test.

Historical Notes

While the word function goes back to Liebniz in 1694 (Burnett, 2005), the idea of a function only being a function if it meets the vertical line test has only come about in recent history. Early calculus authors thought that some graphs were functions, although today they are not considered functions. For example, Thompson, in his seminal work Calculus Made Easy (1914), considers this graph a function. However, it clearly fails the vertical line test:

The original term may have stemmed from the vertical line test in physiology, which was defined as:

“The Vertical Line Test”: In good posture, the long axis of the trunk is a vertical line and the long axis of the neck and head taken togather is also a vertical line. An imaginary line dropped from the front of the ear to the forward part of the foot will parallel the long axes of these segments of the body. In poor posture these axes do not form one continuous vertical line but are broken into several zigzag lines. (Military Training Commission, 1917, p.49)”

One of the earliest algebraic uses of the term can be found in The Florida Program of Curriculum Revision: General Plans and Organization (1931). The mention is brief, and it’s unlikely the idea of a mathematical vertical line test originated here. However, it does suggest the vertical line test might have been used in algebra before 1931.

A few sporadic mentions of the test are found in later texts, such as Mathematics for High School: Intermediate Mathematics: Commentary for Teachers, Volume 1 (1959). In 1970, Buchman and Zimmerman state that “Graphically…a relation is a function if and only if no vertical line meets the graph of the relation at more than one point. This is sometimes called the vertical line test.”


Buchman, A. & Zimmerman, R. (1970). Eleventh Year Mathematics. Retrieved September 24, 2017 from:
Burnett, D. (2005). Advance Organizer for Calculus (based on the Larson textbook). Retrieved September 24, 2017 from:
Military Training Commission, (1917). Bulletin, Issue 631, Part 35: General plan and syllabus for physical training in the elementary and secondary schools of the state of New York. Albany.
Stewart, James (2001). Calculus: Concepts and Contexts (2nd ed.). Pacific Grove: Brooks/Cole. p. 17. ISBN 978-0-534-37718-2.
School Mathematics Study Group (1959). Mathematics for High School: Intermediate Mathematics: Commentary for Teachers, Volume 1. Yale University,.
Thompson, S. & Gardner, M. (1914). Calculus Made Easy, 2nd Edition. The Macmillan Company.


If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.

Comments are now closed for this post. Need help or want to post a correction? Please post a comment on our Facebook page and I'll do my best to help!
Vertical Line Test in Easy Steps with Examples was last modified: October 12th, 2017 by Stephanie Glen