# Is the function injective and surjective?

I want to check if the function $$f:\mathbb{N}\times\mathbb{R}\rightarrow \mathbb{R}, \ (x,y)\mapsto \frac{3}{2}y-x$$ is injective, surjective, bijective.

I have done the following:

• Let $$(x_1, y_1), (x_2,y_2)\in \mathbb{N}\times\mathbb{R}$$ with $$(x_1, y_1)\neq (x_2,y_2)$$. Then we have that $$x_1\neq x_2$$ or/and $$y_1\neq y_2$$.

Therefore we get $$\begin{equation*}f(x_1, y_1)=\frac{3}{2}y_1-x_1\neq \frac{3}{2}y_2-x_2=f(x_2, y_2)\end{equation*}$$ This means that $$f$$ is injective. Is this correct?

• Let $$z\in \mathbb{R}$$. Let $$z=f(x,y)$$, now we want to calculate $$(x,y)$$. $$\begin{equation*}z=f(x,y)\Rightarrow z=\frac{3}{2}y-x\end{equation*}$$

How do we continue?

• $f(1,\frac23)=f(4,\frac83)$ Commented Feb 6, 2020 at 1:04
• Your argument for injectivity appears to simply assume that the function is injective.
– lulu
Commented Feb 6, 2020 at 1:05
• You say $\frac 32y_1 - x_1 \ne \frac 32 y_2 - x_2$. Why not? Let $y_1 = 4$ and $y_2=2$ then $\frac 32y_1 - x_1 = 6-x_1$ and $\frac 32y_2 - x_2=3 -x_2$. So if $x_1 = 4$ and $x_2 =1$ we do have $\frac 32y_1 - x_1 = \frac 32y_2 - x_2 = 2$. Commented Feb 6, 2020 at 2:07
• $x_1\ne x_2$ and $y_1\ne y_2$ does not mean you can't combine them is ways that will have equal results. In fact, if $\frac 32x_1 - y_1 = \frac 32x_2 -y_2$ then $x_1 =\frac 23 y_1 +\frac 32x_1 -y_2$ which is certainly possible. Commented Feb 6, 2020 at 2:09

The function is not injective, so it cannot be bijective either. However, the function is surjective.

As J.W. Tanner mentioned, $$f(1, 2/3) = f(4, 8/3)$$ implies that the function cannot be injective. Your proof is incorrect since you assume injectivity to start with. In order to show injectivity, you need to start with $$f(x_1, y_1) = f(x_2, y_2)$$ and show that $$x_1 = x_2$$ and $$y_1 = y_2$$ hold.

Now, I claim the function $$f$$ is surjective. In order to show this, we need to show that for every real number $$z$$, there exists a natural number $$x$$ and a real number $$y$$ so that $$f(x, y) = z$$. There are many ways to do this. I will show you one way.

For any real number $$z$$, set $$x = 1$$ and $$y = 2(z + 1)/3$$ so that we have $$x \in \mathbb{N}, y \in \mathbb{R}$$. It follows that

$$f(x, y) = \frac{3}{2} \cdot \frac{2}{3}\left(z + 1\right) - 1 = z.$$

Since this holds for any real number $$z$$, we conclude the function is surjective.

• Ahh ok! I got it!! With the same reasoning we get the following for $f:(\mathbb{N}\setminus \{0\})\times (\mathbb{N}\setminus \{0\})\rightarrow \mathbb{Q}, \ (x,y)\mapsto \frac{x-y}{y}$. Since $f\left (4, 3\right ) = f\left (8, 6\right )$ the function cannot be injective. Let $z\in \mathbb{Q}$. We want to show that there natural numbers different from 0 $x,y$ s.t. $f(x, y) = z$. For a rational $z$, we set $x = z+1$ and $y = 1$. Then $f(x, y) = \frac{z+1-1}{1}=z$. Since this holds for every rational $z$ gilt, the function is surjective. Is that correct? Commented Feb 6, 2020 at 5:39
• Yes, that is correct. @Mary Star Commented Feb 14, 2020 at 3:12

My two cents (mostly to see what other people think of that point of view):

sure the definition of injective is

for every $$x_1$$ and $$x_2$$ in the domain of $$f$$, if $$x_1\neq x_2$$, then $$f(x_1)\neq f(x_2)$$

but I would personally recommend using the contraposition

for every $$x_1$$ and $$x_2$$ in the domain of $$f$$, if $$f(x_1)=f(x_2)$$, then $$x_1=x_2$$

They are logically equivalent, but equalities are easier to handle than non-equalities (not sure how to call the $$\neq$$ symbol). Indeed, if $$a=b$$, then if you perform any operation (that is, a function) on both sides, you obtain a new equality. For example, if $$a=b$$, then $$2a=2b$$, $$\frac{a}{3}=\frac{b}{3}$$, $$\ln(a)=\ln(b)$$, $$\sin(a)=\sin(b)$$, $$a^2=b^2$$,... and more generally $$g(a)=g(b)$$ for any function $$g$$. On the contrary, functions don't preserve non-inequalities in general. For example, if $$a\neq b$$, then you are not guaranteed that $$a^2\neq b^2$$ or $$g(a)\neq g(b)$$ in general. This happens precisely when $$g$$ is injective.

And I believe that any proof that tries to use the first form of the definition will resort to proof by contradiction at some point ("if $$x_1\neq x_2$$, then (...) so $$f(x_1)\neq f(x_2)$$. Indeed, if $$f(x_1)=f(x_2)$$, we would have...(...), so $$x_1=x_2$$"), so it better to start the proof "the right way" from the start.

Back to your problem, $$f(x_1,y_1)=f(x_2,y_1)$$ means that

$$\begin{equation*}\frac{3}{2}y_1-x_1 = \frac{3}{2}y_2-x_2\end{equation*}$$

Written that way (a linear equation), it is intuitive that there are solutions with $$(x_1,y_1)\neq(x_2,y_2)$$, for example $$(x_1,y_2)=(2,1)$$ and $$(x_1,y_2)=(2,\frac{8}{3})$$.

As for the subjectivity, the function is a linear function (*) from a space of dimension two into a space of dimension 1, so intuitively the function is probably subjective. To see it, you can consider partial function, for example, $$g(y)=f(1,y)=\frac{3}{2}y-1$$.

Since $$g$$ is a linear function with nonzero slope, its range is $$\mathbb R$$ so it is surjective. This also hints that $$f$$ is not injective: by using all possibilities for the first variable $$x$$, we are bound to have repetitions of the output.

(*) Not exactly since the first variable is an integer.

• OK!! So if we have $f:(\mathbb{N}\setminus \{0\})\times (\mathbb{N}\setminus \{0\})\rightarrow \mathbb{Q}, \ (x,y)\mapsto \frac{x-y}{y}$ since f(4,3)=f(8,6) the map is not injective. To show the surjectivity we tale x=z+1 and y=1,right? Commented Feb 6, 2020 at 13:32