# What is the horizontal line test?

In January of this year, we have discussed about the vertical line test. We have learned that if a vertical line intersect a graph more than once, then that graph is not a function. In this post, we learn about the horizontal line test and its relation to inverse functions.

Suppose we have a function $f$. Then, we input $x$ and call the output $f(x)$. If we do things backward, suppose we have the number $y$ which is in the range of $f$. What value should we input to $f$ to get $y$? Let’s have a more specific example.

Suppose we have the function $f(x) = x^2$. And we choose the number $y = 9$ which is in the range of $f$. What number should we input in $f$ to get $9$? Well, we will have two numbers, those are $3$ and $-3$.

On the other hand, suppose we have the function $g(x) = x^3$. And we choose the number $y = 8$. What number should we input in $g$ to get $8$? We only have one and only one number which is equal to $2$. Now this is true for any $y$ in $g$ since there is only one cube root of any number.

Now if there is one and only one value of $x$ which satisfies $f(x) = y$ for each $y$, then we can define a new function which reverses the transformation. Given the output $y$, there is one and only one input $x$ that results to $y$. This function is called the inverse function.

Notice from the graph of $f$ below the representation of the values of $x$. Graphically, $y = 9$ is a horizontal line, and the inputs $x = 3$ and $x = -3$ are the values $x$ at the intersection of the graph and the horizontal line. In fact, if you put a horizontal line at any part of the graph except at $y = 0$, there are always 2 intersections. As we have learned in functions, for every input, there is exactly one output and hence reversing $f(x) = x^2$ will have two outputs. Thus, it cannot qualify as a function and therefore it has no inverse function.

However, if we examine the graph of $g(x) = x^3$, a horizontal line can only intersect it at one point regardless of where you place it. Therefore, $g$ has an inverse function.

From the discussion above, we can conclude that we can use horizontal lines to test whether a function has an inverse or none. That is, if every horizontal line intersects the function at most once, then the function has an inverse; otherwise, it has no inverse function. This method is called the horizontal line test.