Horizontal Line Test Examples in Math

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Horizontal Line Test.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in Math.

Concept Recap

The horizontal line test is a visual method to determine whether a function is one-to-one (injective). If every horizontal line intersects the function's graph at most once, the function passes the test and has an inverse function on its full domain.

A horizontal line that crosses the graph at two points means those two inputs produce the same output β€” the function is many-to-one and has no inverse without domain restriction.

Read the full concept explanation β†’

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: If no horizontal line hits the graph more than once, the function is one-to-one and invertible.

Common stuck point: The procedure for horizontal line test is the easy part; the trap is using vertical lines instead of horizontal. Asking "Does every horizontal line cross the graph at most once?" first is what keeps a correct-looking calculation from being attached to the wrong concept.

Sense of Study hint: Ask: Does every horizontal line cross the graph at most once?

Worked Examples

Example 1

easy
Use the horizontal line test to determine whether f(x)=2x+5f(x) = 2x + 5 is one-to-one.

Answer

Yes,Β f(x)=2x+5Β isΒ one-to-one.\text{Yes, } f(x) = 2x + 5 \text{ is one-to-one.}

First step

1
The graph of f(x)=2x+5f(x) = 2x + 5 is a straight line with slope 22 (nonzero).

Full solution

  1. 2
    Any horizontal line y=cy = c intersects a non-horizontal line at most once.
  2. 3
    Since every horizontal line crosses the graph at most once, ff passes the horizontal line test and is one-to-one.
The horizontal line test states: a function is one-to-one if and only if no horizontal line intersects its graph more than once. One-to-one functions have inverses. All linear functions with nonzero slope are one-to-one.

Example 2

medium
Does f(x)=∣xβˆ’2∣f(x) = |x - 2| pass the horizontal line test? Explain algebraically.

Example 3

medium
Prove algebraically that f(x)=2x+5f(x) = 2x + 5 is one-to-one.

Example 4

hard
Show that if ff and gg are one-to-one, then f∘gf \circ g is one-to-one.

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

medium
Which of the following functions are one-to-one: (a) f(x)=x3f(x) = x^3, (b) g(x)=x3βˆ’3xg(x) = x^3 - 3x, (c) h(x)=exh(x) = e^x?

Example 2

hard
Prove algebraically that f(x)=xx+1f(x) = \frac{x}{x+1} (for x>βˆ’1x > -1) is one-to-one without graphing.

Example 3

easy
Does f(x)=x2f(x) = x^2 pass the horizontal line test on all reals?

Example 4

easy
Does f(x)=x3f(x) = x^3 pass the horizontal line test?

Example 5

easy
Does f(x)=2x+1f(x) = 2x + 1 pass the horizontal line test?

Example 6

easy
What does the horizontal line test determine about a function?

Example 7

easy
Does the constant function f(x)=3f(x) = 3 pass the horizontal line test?

Example 8

easy
How does the horizontal line test differ from the vertical line test?

Example 9

easy
Does f(x)=exf(x) = e^x pass the horizontal line test?

Example 10

easy
If a graph is shaped like a sideways parabola opening right, does it pass the horizontal line test?

Example 11

medium
Does f(x)=x2f(x) = x^2 restricted to xβ‰₯0x \ge 0 pass the horizontal line test?

Example 12

medium
Does f(x)=x3βˆ’xf(x) = x^3 - x pass the horizontal line test on all reals?

Example 13

medium
Does f(x)=sin⁑xf(x) = \sin x pass the horizontal line test on all reals?

Example 14

medium
A function passes the horizontal line test. What can you conclude about its inverse?

Example 15

medium
Does f(x)=∣x∣f(x) = |x| pass the horizontal line test?

Example 16

medium
Does f(x)=1/xf(x) = 1/x (for x≠0x \ne 0) pass the horizontal line test?

Example 17

medium
A graph passes the vertical line test but fails the horizontal line test. What does this mean?

Example 18

medium
For what values of kk does the horizontal line y=ky=k meet f(x)=x2f(x)=x^2 exactly once?

Example 19

medium
Does f(x)=xf(x) = \sqrt{x} (for xβ‰₯0x \ge 0) pass the horizontal line test?

Example 20

challenge
For f(x)=x2+bx+cf(x) = x^2 + bx + c, explain why it always fails the horizontal line test on all reals.

Example 21

challenge
Show that any strictly increasing function passes the horizontal line test.

Example 22

challenge
Find the largest interval [0,k][0, k] on which f(x)=sin⁑xf(x) = \sin x passes the horizontal line test.

Example 23

easy
Does f(x)=3xβˆ’7f(x) = 3x - 7 pass the horizontal line test?

Example 24

easy
Does f(x)=βˆ’x+4f(x) = -x + 4 pass the horizontal line test?

Example 25

easy
Does f(x)=5f(x) = 5 (a constant function) pass the horizontal line test?

Example 26

easy
Does f(x)=βˆ’x2f(x) = -x^2 pass the horizontal line test on all reals?

Example 27

easy
Does f(x)=ln⁑xf(x) = \ln x (for x>0x > 0) pass the horizontal line test?

Example 28

easy
Does f(x)=tan⁑xf(x) = \tan x on (βˆ’Ο€/2,Ο€/2)(-\pi/2, \pi/2) pass the horizontal line test?

Example 29

medium
Does f(x)=(xβˆ’1)2+3f(x) = (x-1)^2 + 3 pass the horizontal line test on all reals?

Example 30

medium
Does f(x)=(xβˆ’1)2+3f(x) = (x-1)^2 + 3 pass the test on xβ‰₯1x \ge 1?

Example 31

medium
Does f(x)=cos⁑xf(x) = \cos x on [0,Ο€][0, \pi] pass the horizontal line test?

Example 32

medium
For f(x)=x4f(x) = x^4, find the largest interval starting at 0 on which ff passes the horizontal line test.

Example 33

medium
Does f(x)=x3+xf(x) = x^3 + x pass the horizontal line test on all reals?

Example 34

medium
Does f(x)=x3βˆ’3x+1f(x) = x^3 - 3x + 1 pass the horizontal line test on all reals?

Example 35

medium
Does f(x)=1xβˆ’2f(x) = \frac{1}{x-2} pass the horizontal line test on its domain?

Example 36

medium
For f(x)=(x+2)2f(x) = (x+2)^2, find a domain restriction so that ff passes the horizontal line test.

Example 37

medium
How many times does y=2y = 2 cross f(x)=x2+1f(x) = x^2 + 1? Use this to comment on the horizontal line test.

Example 38

hard
For f(x)=exβˆ’eβˆ’xf(x) = e^x - e^{-x}, show ff passes the horizontal line test on all reals.

Example 39

hard
Determine whether f(x)=x+sin⁑xf(x) = x + \sin x passes the horizontal line test on all reals.

Example 40

hard
Find a k>0k > 0 such that f(x)=x3βˆ’kxf(x) = x^3 - kx fails the horizontal line test on all reals.

Example 41

hard
For f(x)=2xβˆ’1x+3f(x) = \frac{2x-1}{x+3}, prove ff is one-to-one on its domain.

Example 42

hard
For f(x)=x2f(x) = x^2 restricted to [βˆ’2,1][-2, 1], does ff pass the horizontal line test?

Example 43

challenge
State and justify: a continuous function on a closed interval that passes the horizontal line test must be strictly monotonic.

Example 44

challenge
For f(x)=sin⁑xf(x) = \sin x, find the largest interval [a,a+Ο€][a, a+\pi] that contains 00 and on which ff passes the horizontal line test.

Background Knowledge

These ideas may be useful before you work through the harder examples.

inverse functionone to one mappingfunction notation