What is the Vertical Line Test?
The vertical line test is an easy way to see if you have a function by looking at a graph.
Note: If you don’t know what a function is, you may want to read the function definition first.
The basic idea:
Draw a few vertical lines spread out on your graph.
- If each line crosses the graph just once, the graph passes the vertical line test. It is a function.
- If a vertical line can cross a graph more than once, then the graph does not pass the vertical line test. It is not a 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 (see the semicircle picture below), it just can’t hit it multiple times.
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.
Different rules apply to semicircles. 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.
Note that on the right, the ruler would completely miss the graph if it were placed in the first or fourth quadrants (i.e. to the right of the y-axis). That’s not however, what causes it to not be a function. The important part is the ruler crosses the graph twice; we really don’t care about blank space.
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.
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.
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 horizontal 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.
Perform the horizontal line test 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.
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 appeared 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.”
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.
Buchman, A. & Zimmerman, R. (1970). Eleventh Year Mathematics. Retrieved September 24, 2017 from: http://files.eric.ed.gov/fulltext/ED046731.pdf
Burnett, D. (2005). Advance Organizer for Calculus (based on the Larson textbook). Retrieved September 24, 2017 from: http://people.uleth.ca/~d.burnett/2006Mathematics/200511Nov/Math20051112.htm
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.
Need help with a homework or test question? With Chegg Study, you can get step-by-step solutions to your questions from an expert in the field. If you rather get 1:1 study help, Chegg Tutors offers 30 minutes of free tutoring to new users, so you can try them out before committing to a subscription.
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? Need to post a correction? Please post a comment on our Facebook page.