# Prove of injection

When we prove that a mapping $f: X \rightarrow Y$ is one-to-one (injective), we normally show that $\forall a, b \in X$, if $f(a) = f(b)$ holds, then $a=b$. Alternatively, by contrapositive, we could show $\forall a, b \in X$, $a \neq b$ implies $f(a) \neq f(b)$.

May I ask that is it correct to show that $\forall a, b \in X$, if $a=b$ holds, then $f(a) = f(b)$? If it is wrong, could you give me a counterexample? Thanks

• $a=b\implies f(a)=f(b)$ is one of the definitiory properties of "being a function". In fact, it is kind of the thing that justifies writing "$f(a)$" in the first place. So, no, you are indeed wrong. – user228113 Mar 1 '17 at 23:15
• counter example: just take any constant function $f:\mathbb{N} \to \mathbb{N}$, it is not injective but your argument works – Saravanan Mar 1 '17 at 23:22

The given condition "$a = b \implies f(a) = f(b)$ holds for all $a, b \in X$" is technically correct, but it is not used meaningfully to show injectivity.
For example, consider the sets $X = \{-1,1\}, Y = \{1\}$ and the function $f: X \to Y$ that maps $X$ to $Y$ with $f(x) = x^2$. Then for any $x \in X$, we have $f(x) = 1$ and clearly the condition $a = b \implies f(a) = f(b)$ holds for all $a, b \in X$. And yet this map is clearly not injective.
• Is there an example that a correspondence $f : X \rightarrow Y$ is injective, but this correspondence does not satisfy the condition that " $a = b$ implies $f(a) = f(b)$"? – Paradiesvogel Mar 2 '17 at 0:59