Is $f(x) = x^2$ injective on $\mathbb{N}$?
$f: \mathbb{N} → \mathbb{N}$
A function is injective if and only if distinct elements of its domain map to distinct elements of its range.
That is, if $f(x) = f(y) \Rightarrow x=y$, OR equivalently, if $x≠y \Rightarrow f(x) ≠ f(y) $
$x^2 = y^2 \Rightarrow x = y $
$x≠y \Rightarrow x^2 ≠y^2$
The solution from a collegue is saying $f$ is injective because $f(x) = f(y)$ iff $x^2 = y^2$ iff $x = y$ (roots are defined for any square) iff x = y
I don't understand this solution, can anyone please assist to resolve this proof?
If $x^2=y^2$, then $x^2-y^2=(x-y)(x+y)=0\,$ but $\,(x+y)\neq 0\,$ and so $\,x-y=0.$
Hence, $x=y$.