Horizontal Line Test — Definition, Graph & Examples
Horizontal Line Test
A test use to determine if a function is one-to-one. If a horizontal line intersects a function's graph more than once, then the function is not one-to-one.
Note: The function y = f(x) is a function if it passes the vertical line test. It is a one-to-one function if it passes both the vertical line test and the horizontal line test.

Key Formula
A function f is one-to-one if and only if:f(a)=f(b)⟹a=b
Where:
- f = The function being tested
- a,b = Any two values in the domain of f
Worked Example
Problem: Use the Horizontal Line Test to determine whether f(x) = 2x + 3 is one-to-one.
Step 1: Draw or imagine horizontal lines of the form y = c for various constants c. For example, try y = 5.
y=5
Step 2: Find where the horizontal line meets the graph by solving 2x + 3 = 5.
2x+3=5⟹2x=2⟹x=1
Step 3: There is exactly one solution, so the line y = 5 intersects the graph at only one point: (1, 5).
Step 4: Repeat the reasoning for any arbitrary horizontal line y = c. Solving 2x + 3 = c always gives exactly one solution.
2x+3=c⟹x=2c−3
Step 5: Since every horizontal line intersects the graph at most once, f(x) = 2x + 3 passes the Horizontal Line Test.
Answer: f(x) = 2x + 3 is one-to-one because it passes the Horizontal Line Test.
Another Example
This example shows a function that fails the test, unlike the first example. It also illustrates that you only need to find one horizontal line with multiple intersections to conclude the function is not one-to-one.
Problem: Use the Horizontal Line Test to determine whether g(x) = x² is one-to-one.
Step 1: Consider the horizontal line y = 4 and find where it intersects the graph of g(x) = x².
x2=4
Step 2: Solve the equation. There are two solutions.
x=2orx=−2
Step 3: The horizontal line y = 4 crosses the parabola at two points: (2, 4) and (−2, 4).
Step 4: Because at least one horizontal line intersects the graph more than once, the function fails the Horizontal Line Test.
Answer: g(x) = x² is NOT one-to-one because the horizontal line y = 4 hits the graph at both x = 2 and x = −2.
Frequently Asked Questions
What is the difference between the Horizontal Line Test and the Vertical Line Test?
The Vertical Line Test checks whether a graph represents a function at all: every vertical line must hit the graph at most once. The Horizontal Line Test goes further — it checks whether a function is one-to-one by requiring every horizontal line to hit the graph at most once. A relation must pass the Vertical Line Test before you even apply the Horizontal Line Test.
Why does the Horizontal Line Test matter for inverse functions?
A function has an inverse function (not just an inverse relation) only when it is one-to-one. The Horizontal Line Test tells you exactly that. If a function fails the test, you must restrict its domain before you can define an inverse — for example, restricting x² to x ≥ 0 so that its inverse √x is a valid function.
Can a function pass the Horizontal Line Test but fail the Vertical Line Test?
No. If a graph fails the Vertical Line Test, it is not a function at all, so the Horizontal Line Test does not apply. You always check the Vertical Line Test first. Only graphs that are already functions can be tested for the one-to-one property using horizontal lines.
Horizontal Line Test vs. Vertical Line Test
| Horizontal Line Test | Vertical Line Test | |
|---|---|---|
| What it determines | Whether a function is one-to-one | Whether a graph represents a function |
| Direction of test lines | Horizontal lines (y = c) | Vertical lines (x = c) |
| Passing condition | Every horizontal line intersects the graph at most once | Every vertical line intersects the graph at most once |
| When to use | When checking if an inverse function exists | When checking if a relation is a function |
| Example that fails | y = x² (parabola opens up, symmetric about y-axis) | x = y² (parabola opens right, not a function) |
Why It Matters
The Horizontal Line Test appears frequently in precalculus and calculus when you need to determine whether a function has an inverse. You will use it to decide if you must restrict the domain of functions like x², sin(x), or cos(x) before finding their inverses. Understanding this test is also essential for topics like bijections in discrete mathematics and transformations in algebra.
Common Mistakes
Mistake: Confusing the Horizontal Line Test with the Vertical Line Test and using horizontal lines to check if something is a function.
Correction: The Vertical Line Test determines if a graph is a function. The Horizontal Line Test determines if a function is one-to-one. They answer different questions — always be clear about which question you are trying to answer.
Mistake: Thinking that a function must fail the test at every horizontal line to be not one-to-one.
Correction: You only need one horizontal line that intersects the graph at two or more points. A single counterexample is enough to prove the function is not one-to-one.
Related Terms
- Function — Must be a function before applying the test
- One-to-One Function — The property this test detects
- Vertical Line Test — Companion test that checks if a graph is a function
- Horizontal — Direction of the lines used in the test
- Line — The geometric object swept across the graph
- Graph of an Equation or Inequality — The visual representation being tested
