One-to-One Functions and the Horizontal Line Test

A function has an inverse only if it is one-to-one. How to check with the horizontal line test or algebraically, plus how restricting the domain fixes it.

A function must be one-to-one to have an inverse. The horizontal line test is the fastest check: draw a horizontal line across the graph. If it touches more than one point at any y-value, the function fails and has no inverse. OpenStax Precalculus 2e defines the one-to-one condition in Section 3.7: for every a and b in the domain, f(a) = f(b) implies a = b. Two different inputs producing the same output means the function is not injective and cannot be inverted. Start with the graph test before you attempt algebra.

One-To-One Function Defined

A one-to-one function, also called an injective function, never sends two distinct domain values to the same output. For f(x) = 2x + 3, each x produces a unique y. For f(x) = x², f(2) = 4 and f(-2) = 4. Two inputs share an output, so x² is not one-to-one. OpenStax Precalculus 2e Section 3.7 gives the formal test: if f(a) = f(b) then a = b must follow. Work that check before moving to the graph. The inverse f⁻¹ exists only when the original function passes this condition.

Horizontal Line Test

Draw any horizontal line across the graph. If that line crosses the curve at more than one point, the function fails. f(x) = x³ passes: every horizontal line meets the cubic exactly once. f(x) = |x| fails: the V-shape catches a horizontal line at y = 2 on both the left and right branches. OpenStax Precalculus 2e Section 3.7 uses this test as the visual equivalent of the one-to-one definition. A fail means you must restrict the function's domain before an inverse can exist. The vertical line test checks whether a graph is a function; do not mix the two tests.

Algebraic Test: F(A) = F(B) Implies A = B

Set f(a) = f(b) and solve for a and b. If the only solution is a = b, the function is one-to-one and injective. For f(x) = 2x + 3: 2a + 3 = 2b + 3 simplifies to 2a = 2b, then a = b. Pass. For f(x) = x²: a² = b² gives a = ±b, not a = b alone. Fail. This algebraic method works on functions whose graphs are not helpful, such as piecewise definitions. OpenStax Precalculus 2e Section 3.7 presents this as the formal one-to-one check. Use it whenever the horizontal line test is ambiguous.

Monotonic Functions And Invertibility

Every strictly monotonic function is one-to-one. If a function is always increasing or always decreasing on its entire domain, it passes the horizontal line test automatically. f(x) = eˣ is strictly increasing, so it has an inverse, ln(x). f(x) = 1/x is strictly decreasing on each branch, but its domain is split; it is one-to-one on each piece and is a self-inverse because f⁻¹(x) = 1/x works for all nonzero x. Non-monotonic functions, like x², change direction and fail the one-to-one test unless you restrict the domain. Check monotonicity first using the derivative sign or by plotting points.

Making A Function One-To-One By Restricting The Domain

When a function fails the horizontal line test, restrict its domain to a region where it is monotonic. For f(x) = x², choose [0, ∞) and the function becomes one-to-one. The inverse is √x, defined only for x ≥ 0. For the general quadratic ax² + bx + c, complete the square to find the vertex, then restrict to one side of that turning point. The inverse of a quadratic function requires this step. Inverse trigonometric functions follow the same logic: arcsin(x) restricts sin(x) to [-π/2, π/2]; arccos(x) uses [0, π]; arctan(x) uses (-π/2, π/2). OpenStax Precalculus 2e Section 5.3 gives these principal value ranges. The domain of the inverse equals the range of the original, so the restriction interval directly determines where f⁻¹ lives.

Worked Examples: Pass Or Fail The Horizontal Line Test

Example 1: f(x) = 2x + 3

The graph is a straight line with slope 2. Any horizontal line y = c meets it at exactly one point. Passes. Inverse is (x - 3)/2. Verify: f(f⁻¹(x)) = 2[(x - 3)/2] + 3 = x.

Example 2: f(x) = x² - 4

The parabola opens upward with vertex at (0, -4). A horizontal line at y = 0 crosses at x = -2 and x = 2. Fails. Restrict to [0, ∞) or (-∞, 0]; each branch is one-to-one. Without restriction, no inverse exists.

Example 3: f(x) = eˣ

Strictly increasing. Every horizontal line y > 0 touches the curve once. Passes. Inverse is ln(x), domain x > 0.

Example 4: f(x) = sin(x)

Periodic, repeats every 2π. Horizontal line at y = 0.5 hits infinitely many points. Fails.OpenStax Precalculus 2e Section 5.3 confirms this principal value.

When The Algebraic Method Fails The Student

Most learners stop after switching x and y, thinking the job is done. Switching is only the first step. You must then solve for y. For f(x) = (ax + b)/(cx + d), the inverse is another rational function, often a self-inverse, but the switch-and-solve process must carry through to the end. For f(x) = x² + 2x + 1, rewrite as (x + 1)², complete the square, then restrict. The inverse domain and range follow from the original's range: if f has range [0, ∞), then f⁻¹ has domain [0, ∞). Write that down before you try to graph the inverse.

Common Confusion: F⁻¹(X) Versus 1/F(X)

The superscript -1 in f⁻¹(x) means the inverse, not the reciprocal. 1/f(x) is the multiplicative reciprocal. For f(x) = 2x + 3, f⁻¹(x) = (x - 3)/2, while 1/f(x) = 1/(2x + 3). These are not the same. OpenStax Precalculus 2e Section 3.7 uses f⁻¹ notation exclusively for the inverse. The horizontal line test decides whether f⁻¹ exists; it says nothing about whether 1/f(x) is defined.

Pass or Fail: Four Functions Compared
FunctionOne-to-One StatusDomain Restriction NeededInverse Example
f(x) = 2x + 3YesNonef⁻¹(x) = (x - 3)/2
f(x) = x²No[0, ∞) or (-∞, 0]f⁻¹(x) = √x on [0, ∞)
f(x) = eˣYesNonef⁻¹(x) = ln(x)
f(x) = sin(x)No[-π/2, π/2]f⁻¹(x) = arcsin(x)

The Principal Value Trap In Inverse Trig

arcsin(x) and arccos(x) look similar but have different ranges: arcsin outputs between -π/2 and π/2, arccos outputs between 0 and π. OpenStax Precalculus 2e Section 5.3 fixes these ranges. Take arcsin(0.5): you get π/6, not 5π/6, because 5π/6 is outside arcsin's range. arctan(x) accepts all real inputs and outputs between -π/2 and π/2, exclusive. When you decide whether a function has an inverse, check the principal value range. A function that passes the horizontal line test on its restricted domain will have a clean inverse with no ambiguity.

When The Calculator Does Not Help

Most online inverse calculators skip the domain restriction step. They output an expression for f⁻¹ without telling you that the original is not one-to-one. For f(x) = x², a calculator might return √x as the inverse, but it will not warn you that this only works on [0, ∞). The step-by-step solver often omits the switch-x-and-y step for rational functions. Do not trust the tool to tell you whether the function is invertible. Apply the horizontal line test yourself first.

Common Questions

What is the horizontal line test?

Draw a horizontal line across the graph. If it hits the curve at more than one point, the function is not one-to-one and has no inverse.

How do I tell if a function is one-to-one without graphing?

Use the algebraic test: set f(a) = f(b) and solve. If the only solution is a = b, the function is injective and one-to-one.

Why does x² fail the horizontal line test?

f(2) = 4 and f(-2) = 4. A horizontal line at y = 4 crosses the parabola at two points. Two inputs share one output, so x² is not one-to-one.

How do I fix a function that fails the test?

Restrict the domain to an interval where the function is strictly increasing or decreasing. For x², use [0, ∞). The inverse then exists on that piece.