# What exactly is the vertical line test?

A function as we have discussed is a relationship between two sets, where each element in the first set has exactly one corresponding element in the second set. If we think of candy which costs 10 cents each, then we can say that 1 candy costs 10 cents, 2 candies cost 20 cents, 3 candies cost 30 cents, and so on, we can think of this relationship as a function since for each number of candies, there is only one possible price.

If we consider the relation y = 2x, then we can say that it is a function since for every value we place in x, there is one and only one y. For instance, if x = -3, then y = -6 and if x = 9, then y = 18. Take note that in the following discussion, when we discuss about x, we assume that it is in the domain of the function.

The relation h(x) = 8 is also a function because for any value of x, there is one and only one h(x), which in this case equals to 8.

The relation xy2, on the other hand, is NOT a function since for the value  of x there are two possible values of y, the positive and negative. For example, for x = 4, there are two possible values for y, that is, 2 and -2.

Graphs of Functions

We can represent functions using graphs. Now, what do we mean that for every value in x in the domain of the function, there is exactly one and only corresponding value for f(x)?

Suppose we have a graph. If we choose any point from the x-axis and draw a vertical line segment from that point until it reaches the graph, the value of f(x) is the “height” of the graph from the the x-axis. Of course, if that part of the graph is under the x-axis, then we consider the height which the value of f(x) negative. Note that in this discussion, when we say height, we actually mean f(x). From above, we have discussed that for all x, there is one and only one f(x). This means that each part of the graph should only have one height.

Observe the two graphs above. In the first graph, for every x that we choose (we can choose any point on the x-axis under the graph), we see that if we make a vertical line, it will only “hit” the graph once. This means that there is only one height or one f(x).

On the other hand, in the second graph, if we chose any value x value under the graph, then there are two heights or two g(x)’s. As discussed above, this is not a function. Of course, if we can find only one x that has two or more heights, then we are sure that the graph is not a function.

The discussion is the same as if a vertical line hits two points on a graph, then, the graph is not a function.  That is why we call it the vertical line test.

Exercise: Consider the graph below. Is it a function or not? Explain why.

Answer: Although you a vertical line will intersect the graph once until x = 8, after 8, a vertical line will intersect the graph twice. Therefore, it is not a function.