# Determine if $y = x^2$ is injective

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?

• You want to find value of $x,y$ such that $f(x)=f(y)$. Then you have already shown that it is not injective by counterexample.
– lEm
Sep 9, 2016 at 2:48
• The meaning of "$y$" changes throughout the text you've written. $f$ has not really been defined, and it gets consistently used with two different meanings in the second and third paragraph. If you want my opinion, you'll have a hard time reconciling what your book says with whatever you're trying to say, since your book and you use two different notations.
– user228113
Sep 9, 2016 at 2:58
• It is however true that the function $$g : [0,\infty)\to [0,\infty)$$$$g(h)=h^2$$ is bijective. Its inverse function is called $\sqrt{\bullet}$.
– user228113
Sep 9, 2016 at 2:59
• Okay, so "y" is simply another point, so if y = -1, that means that (-1)^2 = 1, so f(y) = 1. It's the same as f(x1), f(x2). Right? Sep 9, 2016 at 3:11
• You consistently write sentences where $f(2)=2^2$ is immediately followed by $f(4)=\sqrt4$.
– user228113
Sep 9, 2016 at 3:17

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.

Thats right. As you say $$-1,1$$ both map on $$1$$ under the function of $$x^2$$. This means that $$f$$ cant be injective. The definition you had in class pretty much does the same. If you have two values like $$x=-1$$ and $$y=1$$ with property of $$f(x) = f(y) = 1$$ them $$f$$ cant be injective because two different values are mapping onto the same value.

If you take general unknown $$x$$ and $$y$$ and say that theyre having the property of $$f(x) = f(y)$$ then it has to follow that $$x = y$$. This means that the general unknown $$x,y$$ you have picked are actually the same. So you did not find any two values with the same value under $$f$$. This means that $$f$$ is injective.

The other definition is just the other way around. Like $$A \Rightarrow B$$ is equal to $$\neg B \Rightarrow \neg A$$.

It does not matter which way you are going. Both will work. After time you will get a feeling which one works the best to prove.

Let me take an example. Lets show that $$f(x) = x^3$$ is injective.

We take general $$x,y \in \mathbb{R}$$. For them we say that $$f(x) = f(y)$$. Then we know what $$f$$ does to them and we will get $$x^3 = y^3$$. Applying the third-root will give us $$x=y$$. That means that $$f(x) = x^3$$ is injective.

The same argument wont work with $$f(x)=x^2$$. You have to careful applying the square root ok both sides. What you did is $$\sqrt{y} = x$$ but that not enough. You also get $$\sqrt{y} = - x$$. For example $$\sqrt{y = 1} = \pm 1$$ which makes perfectly sense because both $$x = -1$$ and $$x = 1$$ are mapping onto $$y = 1$$. This is where you might messed up something.

to prove that if $f(x)=x^2$ is injective you have to check that if $x_1=x_2 \Rightarrow f(x_1)=f(x_2)$ but this isn't the case because if $x_1=1$ and $x_2=-1 \Rightarrow f(x_1)=f(x_2)$ yet $x_1 \neq x_2$, making $f(x)$ not injective.

• First sentence: "no". You need to prove that $f(x_1)=f(x_2)\implies x_1=x_2$
– user228113
Sep 9, 2016 at 3:36

I think that the syntax of the definition from your class is the point of confusion. The class definition depends on functions being defined as $$f(x)=(\text{expression of }x)$$ rather than as $$y=(\text{expression of }x).$$ Consequently, the "$$y$$" in "$$f(y)$$" is just some dummy variable that gets input into $$f$$ and is unrelated to $$x$$. So, for your example, $$f(x)=x^2$$, $$f(x)= 4$$ for $$x=2$$ and $$f(y)=f(4)=16$$ for $$y=4$$. Again, note that $$y$$ is unrelated to $$x$$.

Finally, in order to show that $$f(x)=x^2$$ isn't injective, you can start with the definition or with its contrapositive, as you stated:

• Starting with the definition, $$f(-2)=f(2)\:\text{ but }-2\:\text{ isn't equal to }2.$$
• Starting with the contrapositive, let's consider $$x=2$$ and $$y=-2$$: then $$x\neq y\:\text{ but }\:f(x)=f(y)=4.$$
• Some books, professors usually keep referring 'y' as the output of the function i.e. y=f(x), the op may have become confused with that. But yeah for sure 'y' is any dummy point. Aug 16, 2022 at 14:24