One-to-One Functions

Definition, horizontal line test, algebraic proofs, and worked examples — with graphs

Understanding Functions and Injectivity

A function is a rule that assigns to each element of a set called the domain exactly one element of another set called the codomain; the set of values actually produced is the range.

A function is one-to-one (injective) if no two distinct elements of the domain map to the same element of the range. One-to-one functions are central to the study of inverse functions and to solving certain classes of equations.

Algebraic definition

Let \( x_1 \) and \( x_2 \) be any elements of the domain. A function \( f \) is one-to-one if:

\[ x_1 \ne x_2 \;\Rightarrow\; f(x_1) \ne f(x_2) \]

Equivalently, using the contrapositive — usually far more useful for proofs:

\[ f(x_1) = f(x_2) \;\Rightarrow\; x_1 = x_2 \]

Visualizing One-to-One Functions

The Venn diagram below shows a one-to-one function: no two input values share the same output value.

Venn diagram of a one-to-one function mapping unique inputs to unique outputs
Figure 1. Venn diagram of a one-to-one function.

In contrast, the next diagram shows a function that is not one-to-one: the inputs \(-1\) and \(0\) both map to the same output.

Venn diagram of a function that is not one-to-one where multiple inputs map to a single output
Figure 2. Venn diagram of a function that is not one-to-one.

The Horizontal Line Test

When the graph is available, the horizontal line test gives a quick check: the function is one-to-one if and only if every horizontal line intersects the graph at most once.

Graph of a one-to-one function passing the horizontal line test
Figure 3. Graph of a one-to-one function.

The following graph is not one-to-one: a horizontal line can intersect the curve in more than one place, so distinct inputs share the same output.

Graph of a function failing the horizontal line test
Figure 4. Graph of a function that is not one-to-one.

Examples of One-to-One Functions

Example 1 — Every linear function with nonzero slope is one-to-one

Show algebraically that every linear function \( f(x) = ax + b \) with \( a \ne 0 \) is one-to-one.

Solution:

Assume \( f(x_1) = f(x_2) \):

\[ ax_1 + b = ax_2 + b \] \[ a(x_1 - x_2) = 0 \]

Since the slope \( a \ne 0 \), dividing by \( a \) gives:

\[ x_1 = x_2 \]

Therefore every non-constant linear function is one-to-one.

Example 2 — A quadratic is not one-to-one on its full domain

Show analytically and graphically that \( f(x) = -x^2 + 3 \) is not one-to-one.

Solution:

Assume \( f(x_1) = f(x_2) \):

\[ -x_1^2 + 3 = -x_2^2 + 3 \] \[ -(x_1^2 - x_2^2) = 0 \] \[ -(x_1 - x_2)(x_1 + x_2) = 0 \]

This gives two possibilities:

\[ x_1 = x_2 \quad \text{or} \quad x_1 = -x_2 \]

Equality of outputs does not force \( x_1 = x_2 \) — for example, \( f(2) = f(-2) = -1 \). Hence the function is not one-to-one.

Graph of y = -x² + 3 failing the horizontal line test
Figure 5. Quadratic function failing the horizontal line test.

Example 3 — Common one-to-one functions

Show graphically that \( f(x) = \ln(x) \), \( g(x) = e^x \), and \( h(x) = x^3 \) are one-to-one.

Each graph below intersects any horizontal line at most once, so each function passes the horizontal line test.

Graph of the natural logarithm ln(x) passing the horizontal line test
Figure 6. \( f(x) = \ln(x) \).
Graph of the exponential function e^x passing the horizontal line test
Figure 7. \( g(x) = e^x \).
Graph of the cubic function x³ passing the horizontal line test
Figure 8. \( h(x) = x^3 \).

How One-to-One Functions Are Used

1. Finding inverse functions

A function has an inverse function if and only if it is one-to-one. The inverse of a one-to-one function is itself one-to-one.

2. Solving equations

Because logarithmic and exponential functions are one-to-one, if their outputs are equal, their inputs must be equal — provided both sides are in the domain.

\[ \ln(2x + 3) = \ln(4x - 2) \;\Rightarrow\; 2x + 3 = 4x - 2 \quad (\text{requires } x > \tfrac{1}{2}) \] \[ e^{-x + 2} = e^{3x - 8} \;\Rightarrow\; -x + 2 = 3x - 8 \]

One-to-One at a Glance

Summary of function types and whether they are one-to-one
Function One-to-One? Why
\( ax + b \), \( a \ne 0 \)YesNonzero slope
ConstantNoAll inputs give one output
\( x^2 \) on all realsNo\( f(-1) = f(1) \)
\( x^2 \) on \( x \ge 0 \)YesStrictly increasing
\( x^3 \), \( e^x \), \( \ln x \)YesStrictly monotonic

Frequently Asked Questions

What is a one-to-one function?

A function \( f \) is one-to-one (injective) if every distinct input produces a distinct output. Equivalently, \( f(x_1) = f(x_2) \) implies \( x_1 = x_2 \) for all \( x_1, x_2 \) in the domain.

What is the horizontal line test?

A function is one-to-one if and only if every horizontal line intersects its graph at most once. If any horizontal line crosses the graph two or more times, the function is not one-to-one.

Are all linear functions one-to-one?

Every non-constant linear function \( f(x) = ax + b \) with \( a \neq 0 \) is one-to-one. A constant function (\( a = 0 \)) is not.

Is f(x) = x² a one-to-one function?

No. Because \( f(-1) = f(1) = 1 \), two distinct inputs give the same output. Restricting the domain to \( x \ge 0 \) would make it one-to-one.

Why do only one-to-one functions have inverse functions?

If two distinct inputs \( x_1 \) and \( x_2 \) mapped to the same output \( y \), an inverse would have to map \( y \) back to both \( x_1 \) and \( x_2 \) — which violates the definition of a function. One-to-one functions avoid this, so their inverse is also a function.

How do you prove algebraically that a function is one-to-one?

Assume \( f(x_1) = f(x_2) \) and use algebra to deduce \( x_1 = x_2 \). This contrapositive form is usually the most convenient for a proof.

Further Reading & Practice

Last updated: October 17, 2026