Skip to content

Why does the horizontal line test tell you a function has an inverse

A function passes the horizontal line test when every horizontal line intersects its graph at most once, which means each output value comes from exactly one input; therefore the function is one‑to‑one and has an inverse. If a horizontal line meets the graph more than once, two different x‑values share the same y‑value, so an inverse would assign one y to multiple x, which is impossible. Thus the test is a quick visual criterion for invertibility.

Algebra · Functions


The horizontal line test checks whether a graph is one‑to‑one. A horizontal line represents a constant output value y. If that line touches the graph in more than one point, the same y is produced by at least two distinct x‑values, violating the definition of a function’s inverse. When no horizontal line hits the graph twice, each y corresponds to a single x, guaranteeing that an inverse function exists.

Why a passing test guarantees an inverse

An inverse function, denoted f⁻¹, must satisfy f⁻¹(f(x))=x for every x in the domain. This requirement forces f to be injective: no two inputs may share an output. The horizontal line test is precisely a visual test for injectivity because a horizontal line fixes the output and reveals how many inputs map to it. If the test is passed, injectivity holds, and the inverse can be constructed by swapping x and y coordinates.

Key consequences of passing the horizontal line test:

  • Each y‑value has at most one pre‑image
  • The function is invertible on its entire domain
  • The inverse function will also be a function

How to use the test to find an inverse:

  1. 1Draw or examine the graph of f(x)
  2. 2Verify that no horizontal line crosses the graph twice
  3. 3Swap x and y in the equation and solve for y to obtain f⁻¹(x)

Example of a function that passes versus one that fails:

FunctionPass/Fail
f(x)=2x+3Pass
g(x)=x²Fail (horizontal line y=4 meets at x=2 and x=-2)

Worked example: f(x)=3x-5 passes the test because its graph is a straight line with slope 3. To find f⁻¹, swap x and y: x=3y-5, then solve for y: 3y = x+5, so y = (x+5)/3. The inverse is f⁻¹(x) = (x+5)/3, and indeed f⁻¹(f(2)) = ( (3·2-5)+5 )/3 = 2, confirming the inverse works. If we tried the same steps with g(x)=x², solving x = y² gives y = ±x\sqrt{x}, which is not a single‑valued function unless we restrict the domain to x≥0 or x≤0, illustrating why the test matters.

Check yourself

What does a horizontal line intersecting a graph twice imply about the function’s invertibility?

Get this as a lesson built for you

Describe what you are studying and Lernex writes the lesson and the questions around it. Free, and it takes about a minute.

Try it

No account needed to try it.

What people ask next