Mathwords logoMathwords

Injection (Injective Function) — Definition, Formula & Examples

An injection (or injective function) is a function where no two different inputs produce the same output. If f(a)=f(b)f(a) = f(b), then it must be the case that a=ba = b.

A function f:ABf: A \to B is injective (one-to-one) if and only if for all a1,a2Aa_1, a_2 \in A, f(a1)=f(a2)f(a_1) = f(a_2) implies a1=a2a_1 = a_2. Equivalently, a1a2a_1 \neq a_2 implies f(a1)f(a2)f(a_1) \neq f(a_2).

Key Formula

f(a1)=f(a2)    a1=a2f(a_1) = f(a_2) \implies a_1 = a_2
Where:
  • ff = A function from set A to set B
  • a1,a2a_1, a_2 = Arbitrary elements in the domain A

How It Works

To prove a function is injective, assume f(a)=f(b)f(a) = f(b) for arbitrary elements aa and bb in the domain, then show algebraically that a=ba = b. To disprove injectivity, find a single counterexample: two distinct inputs that map to the same output. Graphically, a function from R\mathbb{R} to R\mathbb{R} is injective if and only if it passes the horizontal line test — every horizontal line intersects the graph at most once.

Worked Example

Problem: Prove that f(x)=3x+5f(x) = 3x + 5 is injective over R\mathbb{R}.
Assume equal outputs: Suppose f(a)=f(b)f(a) = f(b) for some a,bRa, b \in \mathbb{R}.
3a+5=3b+53a + 5 = 3b + 5
Solve for the inputs: Subtract 5 from both sides, then divide by 3.
3a=3b    a=b3a = 3b \implies a = b
Conclude: Since f(a)=f(b)f(a) = f(b) forces a=ba = b, the function satisfies the definition of injectivity.
Answer: f(x)=3x+5f(x) = 3x + 5 is injective because equal outputs always imply equal inputs.

Why It Matters

Injectivity is essential for defining inverse functions — a function has a left inverse precisely when it is injective. In discrete math courses, counting the number of injections from one finite set to another yields the permutation formula P(n,k)P(n, k). Cryptographic hash functions and database key constraints also rely on injectivity to guarantee that distinct inputs remain distinguishable.

Common Mistakes

Mistake: Confusing injective (one-to-one) with surjective (onto).
Correction: Injective means no two inputs share an output. Surjective means every element in the codomain is hit by at least one input. A function can be one without the other.