What Is the Horizontal Line Test?

Before this, knowWhat Is the Vertical Line Test?

Illustrated · 2 min

Horizontal Line Test

Similar to the vertical line test, we also have a horizontal line test.

If we have a function, we can use the horizontal line test to tell if the function is one-to-one. One-to-one means that for every specific input, the function has a specific output. This also means the function's inverse is also a function.

The process is the same as the vertical line test. We draw horizontal lines and see how many places they intersect our graph. If its at, at most, one point, then our function is one-to-one and we know its inverse is a function.

One-to-one Function

Suppose we want to know if the following function is one-to-one: f(x)=(x+1)3−2f(x)=(x+1)^3-2 First, we graph the function. This is a cubic function.

Graph of y = (x + 1)^3 - 2.

Made using Desmos

Then, we draw some horizontal lines through it and see where they intersect.

Our function passes the horizontal line test.

Made using Desmos

Each of our lines only intersect the graph at, at most, one point. Therefore, we know this function is one-to-one.

This means the function's inverse is also a function. Let's find the inverse and see.

To find the inverse, we swap the xx and yy variables and solve for yy again. y=(x+1)3−2x=(y+1)3−2x+2=(y+1)3x+23=y+1x+23−1=y\begin{align} y&=(x+1)^3-2\\ x&=(y+1)^3-2\\ x+2&=(y+1)^3\\ \sqrt[3]{x+2}&=y+1\\ \sqrt[3]{x+2}-1&=y \end{align} Here is our inverse function. If we graph this and apply the vertical line test, we will see it passes and is a function.

To get to this inverse function, you may want to review the Addition and Subtraction Property of Equality, the Multiplication and Division Property of Equality, cube roots,

Inverse function: f(x) = (x + 2)^(1/3) - 1.

The inverse y=x+23−1y=\sqrt[3]{x+2}-1 passes the vertical line test so it's a function.

Made using Desmos

Not a One-to-one Function

Let's look at an example that doesn't pass the horizontal line test. f(x)=x2−1f(x)=x^2-1

Start by graphing the function.

Graph of y = x^2 - 1.

Made using Desmos

Next, draw horizontal lines through it.

Our graph failing the horizontal line test.

Made using Desmos

While one of our horizontal lines goes through only one point, the others we draw will go through two. This means our function is not one-to-one. Our function fails the horizontal line test.

If we graph its inverse, it will not be a function and won't pass the vertical line test.

Let's take a look. Again, we swap the xx and yy variables and solve for yy. y=x2−1x=y2−1x+1=y2±x+1=y\begin{align} y&=x^2-1\\ x&=y^2-1\\ x+1&=y^2\\ \pm\sqrt{x+1}&=y \end{align}

Inverse: y = +/- sqrt(x + 1).

The inverse y=±x+1y=\pm\sqrt{x+1} doesn't pass the vertical line test so it's not a function.

Made using Desmos

Even this graph isn't a function, it is still a relation!

Illustrated · 1 min

Introduction

How would you tell? First, in order for the original function to actually be a function, it cannot have two values of f(x)f(x) for any xx. (This can be explained by applying the Vertical Line Test.) The same goes for the inverse function, assuming it is a function.

If there is a point (x,f(x))(x, f(x)) on the graph of f(x)f(x), then the graph of the inverse function must contain (f(x),x)(f(x), x). In order for the inverse to be a function, there must be one xx for every f(x)f(x). Combing these two, we have that

For the inverse of a function to be a function, the function must have one value of f(x)f(x) for every xx and vice versa.

What does this mean? The function must strictly have one value of xx for each f(x)f(x). This means that all values of xx must be strictly paired with another value of f(x)f(x), or the function must be one-to-one. Let's look at an example:

Graph of y=x^2

Graphed with Desmos

You should know by now that this is the function f(x)=x2f(x)=x^2. It is a function because for every xx there is only one value of f(x)f(x). The inverse function of f(x)=x2f(x)=x^2 is not a function, however, because there are two values of xx that give 11, for example:

Graph of y=x^2 and y=1

Graphed with Desmos

We must restrict the domain so that the function is one to one. Let's try x≥0x\ge0:

Graph of y=x^2, x >0 and y=sqrt(x)

Graphed with Desmos

Now, the function is one-to-one, and we've graphed its inverse function f−1(x)=xf^{-1}(x)=\sqrt{x}.

Video · + 1 min read

(Videos) Finding the Inverse of a Function or Show that One Does Not Exist

by PatrickJMT

Here's a video by patrickJMT going over some examples on how to find the inverse algebraically.

> It is important to note that not all functions have an inverse. Only functions that are one-to-one ( pass the horizontal line test ) have an inverse.

The steps are simple:

  1. Replace f(x)f(x) with yy.
  2. Switch xx's and yy's.
  3. Solve for yy.
  4. Replace yy with f−1(x)f^{-1}(x)

The first example he looks at is: f(x)=x+4−3f(x)=\sqrt{x+4}-3

Step 1 is to replace f(x)f(x) with yy. This is simple enough. y=x+4−3y=\sqrt{x+4}-3

Step 2 is to switch xx's and yy's. Also simple enough. x=y+4−3x=\sqrt{y+4}-3

Step 3 is to solve for yy. This will be the hardest of the steps but shouldn't be too bad. x=y+4−3x+3=y+4(x+3)2=y+4x2+6x+9=y+4x2+6x+5=y\begin{align} x&=\sqrt{y+4}-3\\ x+3&=\sqrt{y+4}\\ (x+3)^2&=y+4\\ x^2+6x+9&=y+4\\ x^2+6x+5&=y \end{align}

Step 4 is to replace yy with f−1(x)f^{-1}(x). This is also simple. The result is the inverse of our function above. f−1(x)=x2+6x+5\boxed{f^{-1}(x)=x^2+6x+5}

The next function that Patrick looks at is: y=5x−32x+1y=\frac{5x-3}{2x+1}

Let's combine all the steps. Switch the yy and xx's. Solve for yy. Replace with f−1(x)f^{-1}(x). y=5x−32x+1x=5y−32y+1x(2y+1)=5y−32xy+x=5y−32xy+x−5y=−32xy−5y=−x−3y(2x−5)=−x−3y=−−x−32x−5y=x+35−2x\begin{align} y&=\frac{5x-3}{2x+1}\\ x&=\frac{5y-3}{2y+1}\\ x(2y+1)&=5y-3\\ 2xy+x&=5y-3\\ 2xy+x-5y&=-3\\ 2xy-5y&=-x-3\\ y(2x-5)&=-x-3\\ y&=-\frac{-x-3}{2x-5}\\ y&=\frac{x+3}{5-2x} \end{align}

Below are more videos with more examples if you need more practice.

Video · + 1 min read

(Video) The Horizontal Line Test

by ThinkwellVids

Here's a video by ThinkwellVids explaining the horizontal line test and what its used for.

Summary\large{\text{Summary}}

The horizontal line test is used to see if a graph's inverse is a function. Where the vertical line test tells you if the graph is a function, the horizontal deals with the inverse.

We can apply the horizontal line test by drawing a horizontal line across our graph. If it touches two or more points then we say it fails the horizontal line test and its inverse is not a function.

Linear Functions

Let's look at the standard linear function, f(x)=xf(x)=x.

Graph of y = x.

Made using Desmos

Can you tell if it passes the horizontal line test? Well let's draw some of the lines and see!

The graph passing the horizontal line test.

Made using Desmos

If we draw some horizontal lines we see they only touch one point. So we know this graph's inverse is a function. We also say this graph is one-to-one.

A graph is one-to-one if every unique xx goes to one unique yy value.

Quadratic Functions

Let's look at the standard quadratic function, f(x)=x2f(x)=x^2.

Graph of y = x^2.

Made using Desmos

Because this is a function, we know it passes the vertical line text. Does it pass the horizontal line test?

The graph fails the horizontal line test.

Made using Desmos

If we draw a horizontal line we see it goes through two points. So this function does not pass the horizontal line test. This means this function's inverse is not a function.

We can see this by graphing the inverse x=y2x=y^2 and using the vertical line test.

The inverse x = y^2, failing the vertical line test.

Notice the inverse does not pass the vertical line test, making it not a function.

Made using Desmos

Illustrated · 1 min

The Horizontal Line Test

Recall that the vertical line test is a good way to tell whether a graph is a function. Once you know that you are looking at a function, you can use the horizontal line test to determine if it is a one-to-one function.

How does the horizontal line test work? Imagine that you were to draw a bunch of horizontal lines, each of which intersects the graph of your function at least once. (In other words, these horizontal lines span the range of the function.)

If every single one of those horizontal lines intersects the function graph exactly once, then the function is one-to-one. However, if any of those lines intersects the function graph more than once, the function is not one-to-one.

Horizontal Line Test: If every horizontal line intersecting the graph of the function does so exactly once, then the function is one-to-one. If any horizontal line intersecting the graph of the function does so more than once, then the function isn't one to one. Pictures of 2 graphs. The first is a graph of y=x, which is one-to-one, and the example horizontal line through it intersects the function once. The second is a graph of y=x^2, which is not one-to-one, and the example horizontal line through it intersects the function twice.

Image source: By Caroline Kulczycky

Graphs courtesy of Desmos

Remember, you cannot always just draw one horizontal line through the graph and determine whether of not the function is one-to-one. Sure, it worked for the one-to-one y=xy=x and non-one-to-one y=x2y=x^2 in the graphic above, but what about the function y=x3−3x?y=x^3-3x?

A graph of x^3-3x. There is a red horizontal line at y=2.5 and it intersects the graph once. There is a green horizontal line at y=0.5 and it intersects the graph three times.

Image source: By Caroline Kulczycky

Created using Desmos

Take a look. If we had drawn the horizontal red line at y=2.5,y=2.5, we may have been fooled into thinking this function is one-to-one, since it only intersects the graph of the function once. However, remember, for the function to be one to one, every single horizontal line drawn through it must intersect it exactly once. Notice the horizontal green line at y=0.5.y=0.5. This one intersects the graph three times, so the function is actually not one-to-one!

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems