The vertical line test is a quick way to determine if a given relationship is a function. In this lesson, you’ll learn more about functions and how the vertical line test can be used to recognize a function.

## The Function Machine

In mathematics, a **function** is a relationship between a set of inputs and their corresponding outputs. An easier way to think of it is that a function is a machine that when you put something in it, it follows a certain set of rules to create a unique product. An example might be a fictional knitting machine. When a particular color of yarn is added, the machine does its thing and produces a specific item of clothing. Each color that is put in the machine can only produce one product. So, if red yarn added to the machine produces a sweater today, it cannot produce a hat tomorrow. It will always produce a sweater. That is what makes it a function.

## Mathematical Functions

With mathematical functions, the concept is the same, but not always as obvious. For every function, there is an input and output. A simple function would be: 2*x* – 7 = *y*. So, for every number that you can think of to substitute for *x*, you will get a unique value for *y*. Often these are written as a table of values.

There are some mathematical equations that are not functions. This is because there is not one unique output for every input. An example of this type of equation would be *x* = *y*^2. If the input (or *x* value) is 4, then the output (*y* value) could be 2 or -2.

Unfortunately, it can be difficult to determine if an equation is a function just by looking at it, especially with more complex equations. You could just plug in some numbers to test it, but with this method you would have to test every number to be sure. And nobody wants to spend that much time on one problem.

## The Vertical Line Test

Fortunately, there is an easier way. The **vertical line test** is a simple method for determining if an equation is indeed a function. The vertical line test is performed by sketching a graph of the equation or by using a calculator to draw it for you. Then, take a vertical line, like a ruler, and pass it over the graph. If the graph crosses the vertical line in only one place at every point, then the equation is a function. If the graph touches the vertical line at more than one point, then it is not a function.

This works because of the definition of a function. For every input (*x*), there is only one output (*y*). So, if the graph touches a vertical line in more than one place, there is more than one *y*-value corresponding to a single *x*-value.

## Examples

Consider the function 2*y* + *x* = 2

Take a vertical line and move it from the left to the right. The vertical line of the paper only crosses the graph in one place along the entire graph. Therefore, 2*y* + *x* = 2 is a function.

Now look at this graph of *x* = *y*^2

If you again take a vertical line and move it from left to right, for every place on the graph, the line intersects in two places. This is not a function.

## Lesson Summary

**Functions** are specific to mathematical equations that have a unique *y* value (output) for every *x* value (input). It can be difficult to look at an equation and determine whether it is a function or not. However, as long as you can graph the equation, you can use the **vertical line test** to determine if it is a function. The vertical line test is performed by taking a vertical line and passing it across the graph. If it intersects the graph in more than one place, then the equation is not a function. If the vertical line crosses the graph only once along each point, then it is a function. This test is a helpful mathematical tool that is easy to remember and needs no special tools to perform.