**The Vertical and Horizontal Line Tests**

We defined a function as a relation between two sets, called the domain and range, such that each element in the domain corresponds to exactly one element in the range. In other words, for each x-value, there is exactly one y-value. In using this definition, we can use a very simple test to determine whether the graph of a relation happens to also be the graph of a function.

**Vertical line test**

The vertical line test is used to determine whether a graph is the graph of a function. Essentially, the test amounts to answering this question: is it possible to draw a vertical line that intersects the graph in two or more places? If so, then the graph is not the graph of a function. If it is not possible, then the graph is the graph of a function. Why does this test work?
A graph would fail to be a function if for any input x, there existed more than one y-value corresponding to it. Take, for example, the equation x^{2}+y^{2}=13. Note that the points (2, 3) and (2, -3) both satisfy the equation. So we have a situation in which one x-value (namely, when x = 2) corresponds to two different y-values (namely, 3 and -3). The point (2, -3) is directly below (2, 3) on the coordinate plane; in other words, the points (2, -3) and (2, 3) lie on the same vertical line with equation x = 2. So if a vertical line hits a graph in more than one place, it is the same as having the same x-value paired up with two different y-values, and the graph is not that of a function.

(Note that under this criterion, a circle is not the graph of a function)

Sometimes, we are interested in knowing whether the inverse of a function is also a function. There is another kind of test that answers this question efficiently.

**Horizontal line test**

The horizontal line test is used to determine if a function has an inverse that is also a function. We seek to answer this question: is it possible to draw a horizontal line that intersects the graph in two or more places? If so, then the graph is not the graph of a function whose inverse is also a function. We also say that if a graph passes the horizontal line test – in other words, if it is not possible to draw a horizontal line that intersects the graph in two ore more places – then the graph is one-to-one, another way of saying that its inverse is a function. Why does this test work? Let’s take the example f(x) = x^{2}, shown below. The graph of this equation is a parabola that passes through the origin and opens upward. It is certainly a function, and it does pass the vertical line test. Note that the points (2, 4) and
(-2, 4) are on this graph. When we define inverse functions, one way to think of it is that for each (x, y) on the graph of f(x), the point (y, x) will be on the inverse relation. In order for that inverse relation to be a function, then, for each y on the graph of f(x), there should be exactly one x that goes with it. This is what we mean by a function that is one-to-one. For f(x) = x^{2}, if (2, 4) and (-2, 4) are on the graph, then (4, 2) and (4, -2) are on the graph of the inverse relation of f(x). (Note that we just interchanged x and y). But the points (4, 2) and (4, -2) are points that lie on the same vertical line. They cannot both be on the graph of a function. So because a horizontal line can pass through the graph of f(x) = x^{2} in more than one point, then f(x) does not have an inverse that is also a function.

__Example 1__

Does this graph pass the vertical or horizontal line test?

__Solution__

It passes the vertical line test, but not the horizontal, and so it is the graph of a function, but it does not have an inverse that is also a function.

__Example 2__

Does this graph pass the vertical or horizontal line test?

__Solution__

It passes both the vertical and horizontal line tests, and so it is the graph of a function that also has an inverse that is a function.

__Example 3__

Does this graph pass the vertical or horizontal line test?

__Solution__

It passes both the vertical and horizontal line tests, and so it is the graph of a function that has an inverse which is also a function.

__Example 4__

Does this graph pass the vertical or horizontal line test?

__Solution__

It passes the vertical line test, but not the horizontal line test. Therefore, it is the graph of a function, but this function does not have an inverse that is also a function.

__Example 5__

Does this graph pass the vertical or horizontal line test?

__Solution__

It does not pass the vertical line test, so it is not the graph of a function. Since it is not the graph of a function, there is no need to apply the horizontal line test.