Horizontal Line Test

In this lesson, you will learn

  • what the horizontal line test is
  • how to use horizontal lines to check if a function is one-to-one
  • why two crossing points mean two x-values share the same y-value
  • the difference between the horizontal line test and the vertical line test

What Is the Horizontal Line Test?

Definition

In mathematics, one can use the horizontal line test in order to determine if a function is one-to-one or injective.

The image below shows what a horizontal line test is supposed to look like.

The green line is the line that we use to do the test. It is basically a horizontal line that can cross or intersect a graph in at least 1 point.

In the image below, the line intersects the graph in two points and these points are (−1, −1) and (2, −1).

Study the image carefully!

A U-shaped red graph. A green horizontal line at y = −1 crosses it at two points, (−1, −1) and (2, −1).

Horizontal Line Test and One-to-One Function

Rule

If a horizontal line intersects the graph in more than one point, then the graph is not one-to-one.

Therefore, the graph above is not one-to-one since the line intersects the graph in two points.

See below another horizontal line test that intersects the graph in only 1 point.

An S-shaped red graph that keeps rising. Two green horizontal lines each cross it at only one point.

Here we draw two lines to emphasize the fact that no matter how many horizontal lines you draw, they will always cut or intersect this graph in only 1 point.

Since every horizontal line will always cut the graph in only 1 point, we say that the graph immediately above is one-to-one.

Worked example: Is y = x2 one-to-one?
  1. Draw the horizontal line y = 9.
  2. Find the points on the graph with y = 9: x2 = 9, so x = 3 or x = −3.
  3. The horizontal line intersects the graph in two points, (3, 9) and (−3, 9).
  4. Two different x-values, 3 and −3, are mapped to the same y-value, 9.

y = x2 is not one-to-one.

Common mistake

Stopping after one horizontal line. One line that crosses the graph once doesn't prove anything; draw many horizontal lines. A single line that crosses twice is enough to show the graph is not one-to-one.

The points (−4, 5) and (1, 5) are both on the graph of a function. Is the function one-to-one?

Show answer

No. The horizontal line y = 5 crosses the graph at both points, so −4 and 1 are mapped to the same y-value.

What Is the Difference Between a Horizontal Line Test and a Vertical Line Test?

The first graph we drew above is not one-to-one because the horizontal line crossed the two points (−1, −1) and (2, −1). As you can see here, two different x-values, −1 and 2, are mapped to the same y-value, −1.

Remember
  • When you do a horizontal line test, each x-value in the domain should be mapped to a different y-value in the range every time.
  • On the other hand, when you do a vertical line test, each x-value in the domain should be mapped to only one y-value in the range.

Which test tells you if a graph is a function, and which tells you if a function is one-to-one?

Show answer

The vertical line test checks for a function; the horizontal line test checks for one-to-one. A one-to-one function must pass both tests.

Summary

  • The horizontal line test shows if a function is one-to-one (injective).
  • If a horizontal line intersects the graph in more than one point, the function is not one-to-one.
  • If every horizontal line intersects the graph in at most 1 point, the function is one-to-one.
  • Two crossing points mean two different x-values are mapped to the same y-value.
  • The vertical line test checks for a function; the horizontal line test checks for one-to-one.

Test Yourself: Interactive 10-Question Quiz

Now check what you learned. Every answer is explained, and each time you play you get new questions.

Question 1 of 10Score: 0