[Math] Determine if $y = x^2$ is injective

functions

I realize that $y=x^2$ is not injective. It is not one-to-one ($1$ and $-1$ both map to 1, for example).

However, in class it was stated that a function is injective if $f(x) = f(y)$ implies $x = y$.

Or if $x$ doesn't equal $y$, then this implies that $f(x)$ doesn't equal $f(y)$.

This is where I'm confused. (Or maybe tired.) For $x = 2$, $y = 4$. So, $f(x) = 4$, but $f(y) = 2$ ($\sqrt{y} = x$). Therefore, $x$ and $y$ are not equal, so it's not injective.

However, according to the contrapositive, $x$ doesn't equal $y$ implies that $f(x)$ doesn't equal $f(y)$. This fits.

Do both the contrapositive and the contrapositive of the contrapositive have to be true for it to be injective? Or am I doing something stupid?

Best Answer

The statement in class is correct, and you example of $x=1, y=-1$ proves the function is not injective because you have $f(x)=f(y)$ but $x \neq y$. The contrapositive fails as well because you have $x \neq y$ but $f(x)=f(y)$ The statement and its contrapositive are logically equivalent, so you only need to check one of them.