What Is An Injective Function?
An injective function $f: A \to B$ is one where distinct inputs map to distinct outputs. Said the way it's usually proved: if $f(a) = f(b)$, then $a = b$. The everyday name is a one-one function (or "one-to-one"), and the one-to-one function article approaches the same idea through graphs and tables if you want a second angle.
Two equivalent ways to say the same thing:
Forward form: $a \neq b \implies f(a) \neq f(b)$ (different inputs can't collide).
Contrapositive form: $f(a) = f(b) \implies a = b$ (a shared output forces the inputs to be equal).
The contrapositive form is the one you actually use in proofs, because it gives you an equation to solve.
How Do You Prove A Function Is Injective?
A frequent search is how do I prove a function is one-one? There are two standard routes — one algebraic, one graphical.
The algebraic method (works for any function with a formula):
Assume $f(a) = f(b)$.
Write out the equation and simplify.
If every legal simplification forces $a = b$, the function is injective.
The horizontal line test (works when you have a graph): a function is injective exactly when no horizontal line crosses its graph more than once. If any horizontal line hits the curve twice, two different inputs share that output, and one-one fails.
What Is The Difference Between Injective And Surjective?
This disambiguation is the highest-frequency related query, so it gets answered directly. The two properties guard opposite doors:
Injective (one-one): no output is shared. Distinct inputs give distinct outputs. Some outputs may go unused.
Surjective (onto): every output is used. No element of the codomain is left out. Sharing is allowed.
They are independent — a function can be one without the other. $f(x) = e^x$ on $\mathbb{R} \to \mathbb{R}$ is injective (no two inputs share a value) but not surjective (negatives are never outputs). A function that is both is a bijective function, and only those have inverses. For the onto side in full, see the surjective function article.
What Is The Number Of Injective Functions Between Two Finite Sets?
If $A$ has $m$ elements and $B$ has $n$ elements with $n \geq m$, the number of injective functions from $A$ to $B$ is the falling factorial:
$$n \times (n-1) \times (n-2) \times \cdots \times (n - m + 1) = \frac{n!}{(n-m)!}$$
Each symbol: $m$ is the domain size, $n$ the codomain size. The first input has $n$ choices of output, the second has $n-1$ left (one is taken), the third $n-2$, and so on. If $m > n$, the count is 0 — there aren't enough distinct outputs to go around, a direct consequence of the pigeonhole principle.
Examples Of Injective Functions
The six examples below build from a small finite check to a proof and a counting problem, with one deliberate wrong turn.
Example 1
Decide whether $f: {1, 2, 3} \to {p, q, r, s}$ given by $f(1)=p,\ f(2)=q,\ f(3)=r$ is injective.
Compare the three outputs.
$p$, $q$, $r$ are all different.
No two inputs share an output, so the function is injective. (Output $s$ goes unused, which is fine for one-one.)
Example 2
Decide whether $f: \mathbb{R} \to \mathbb{R}$, $f(x) = x^2$, is injective.
The tempting move is to say "$x^2$ is a clean, familiar formula, so it must be one-one."
Test the definition. Suppose $f(a) = f(b)$.
$a^2 = b^2$.
This gives $a = b$ or $a = -b$.
So $f(2) = 4$ and $f(-2) = 4$ — two different inputs, same output.
The function is not injective. The "familiar formula must be one-one" instinct skipped the negative root. The fix is to restrict the domain to $[0, \infty)$, where $a^2 = b^2$ does force $a = b$. The first instinct to drop the negative case is exactly where this one breaks.
Example 3
Prove that $f: \mathbb{R} \to \mathbb{R}$, $f(x) = 5x - 7$, is injective.
Assume $f(a) = f(b)$.
$5a - 7 = 5b - 7$.
$5a = 5b$.
$a = b$.
The equality forces $a = b$, so $f$ is injective.
Example 4
Decide whether $f: \mathbb{R} \to \mathbb{R}$, $f(x) = x^3$, is injective.
Assume $f(a) = f(b)$.
$a^3 = b^3$.
Taking real cube roots, $a = b$ (a real number has exactly one real cube root).
So $f$ is injective — and unlike $x^2$, no negative-root trap appears, because cubing preserves sign.
Example 5
Decide whether $f: \mathbb{R} \to \mathbb{R}$, $f(x) = \dfrac{1}{x+1}$ (domain $x \neq -1$), is injective.
Assume $f(a) = f(b)$.
$\dfrac{1}{a+1} = \dfrac{1}{b+1}$.
Cross-multiplying: $b + 1 = a + 1$.
$a = b$.
So $f$ is injective on its domain.
Example 6
Count the injective functions from a 2-element set to a 4-element set.
Here $m = 2$, $n = 4$.
$$\frac{n!}{(n-m)!} = \frac{4!}{2!} = \frac{24}{2} = 12$$
There are 12 injective functions. (The first input picks any of 4 outputs; the second picks any of the remaining 3, giving $4 \times 3 = 12$.)
Why One-One Matters: "Injectivity Is What Makes Reversal Possible"
Injectivity exists because mathematics needed a way to guarantee a process can be undone without ambiguity.
It is half of invertibility. A function can be reversed only if each output traces back to exactly one input. If two inputs share an output, the reverse map can't decide which one to return. This is the backbone of every inverse function.
It underwrites encoding. Lossless compression, primary keys in a database, and serial numbers all depend on a one-one assignment — distinct items must get distinct codes, or information is lost.
It compares set sizes. An injection from $A$ into $B$ proves $B$ is at least as large as $A$, the tool behind formal arguments about infinite sets.
The destination this opens up is the comparison of infinities. Georg Cantor (1845–1918, Germany) built his entire theory of cardinality on injective and surjective maps, proving the reals cannot be put in one-one correspondence with the integers.
Where Injectivity Slips Away
Three mistakes account for most wrong "is it one-one?" answers.
Mistake 1: Forgetting the negative root
Where it slips in: any even power or absolute-value function.
Don't do this: declare $f(x) = x^2$ injective because the formula looks simple.
The correct way: test $f(a) = f(b)$ fully. $a^2 = b^2$ allows $a = -b$, so $2$ and $-2$ collide. Even functions are never one-one on a domain symmetric about zero. The rusher who solves $a^2 = b^2$ as just $a = b$ misses the second root.
Mistake 2: Confusing one-one with onto
Where it slips in: problems that mention "every output" or "covers the codomain."
Don't do this: call a function not-injective because some output is unused.
The correct way: unused outputs are irrelevant to injectivity — that's a surjectivity concern. Injective asks only whether any output is shared. The second-guesser who keeps checking coverage when the question is about collisions wastes the effort here.
Mistake 3: Treating $f^{-1}$ as a reciprocal
Where it slips in: the moment inverse notation appears.
Don't do this: read $f^{-1}(x)$ as $\dfrac{1}{f(x)}$.
The correct way: $f^{-1}$ is the reverse map, defined only because $f$ is one-one. It has nothing to do with reciprocals. The reciprocal $\dfrac{1}{\sin\theta}$ and the inverse $\sin^{-1}\theta$ get read as the same thing, and that swap is a steady source of wrong answers.
Conclusion
An injective function sends distinct inputs to distinct outputs — no two inputs share an image.
Prove it algebraically (assume $f(a)=f(b)$, force $a=b$) or graphically (the horizontal line test).
Injective and surjective are independent: one forbids collisions, the other demands full coverage.
The number of injective functions from an $m$-set to an $n$-set is $\dfrac{n!}{(n-m)!}$ when $n \geq m$, and $0$ otherwise.
Injectivity is half of what a function needs to be invertible.
To build this with a teacher who teaches the reasoning first, explore Bhanzu's algebra tutor, find help with algebra, or browse math tutoring. Want a live Bhanzu trainer to walk through one-one proofs with your child? Book a free demo class.
Read More
Was this article helpful?
Your feedback helps us write better content