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:
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.
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.
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.
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.
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.
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.
Summary of function types and whether they are one-to-one
Function
One-to-One?
Why
\( ax + b \), \( a \ne 0 \)
Yes
Nonzero slope
Constant
No
All inputs give one output
\( x^2 \) on all reals
No
\( f(-1) = f(1) \)
\( x^2 \) on \( x \ge 0 \)
Yes
Strictly increasing
\( x^3 \), \( e^x \), \( \ln x \)
Yes
Strictly 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.