A Function $~$f: X \to Y$~$ is injective if it has the property that whenever $~$f(x) = f(y)$~$, it is the case that $~$x=y$~$. Given an element in the image, it came from applying $~$f$~$ to exactly one element of the domain.
This concept is also commonly called being "one-to-one". That can be a little misleading to someone who does not already know the term, however, because many people's natural interpretation of "one-to-one" (without otherwise having learnt the term) is that every element of the domain is matched up in a one-to-one way with every element of the domain, rather than simply with some element of the domain. That is, a rather natural way of interpreting "one-to-one" is as "bijective" rather than "injective".
Examples
- The function $~$\mathbb{N} \to \mathbb{N}$~$ (where $~$\mathbb{N}$~$ is the set of natural numbers) given by $~$n \mapsto n+5$~$ is injective: since $~$n+5 = m+5$~$ implies $~$n = m$~$. Note that this function is not surjective: there is no natural number $~$k$~$ such that $~$k+5 = 2$~$, for instance, so $~$2$~$ is not in the range of the function.
- The function $~$f: \mathbb{N} \to \mathbb{N}$~$ given by $~$f(n) = 6$~$ for all $~$n$~$ is not injective: since $~$f(1) = f(2)$~$ but $~$1 \not = 2$~$, for instance.
Comments
Joe Zeng
Why is it misleading to call injective "one-to-one"?
Patrick Stevens
I've edited something about that into the text. Basically I think it's to do with the symmetry of the words in "one-to-one": it looks like it should go both ways, as "one thing in the domain hits one thing in the range, and vice versa".