# Proving injectivity/surjectivity of a function (having a couple as argument) in $\mathbb{Q}^{2}$

I know how to prove if a single variable function is injective or surjective but I've been quite confused by an exercise where i need to determine if:

$f :\mathbb{Q}^{2} \to\mathbb{Q}^{2}$
$f(x,y) = (x+y, x-y)$

is injective and/or subjective.

Is it possible to say that this function is not injective because:
$Let \;x_{1} = \frac{1}{2} and \;y_{1} = \frac{0}{2}, f(x_{1},y_{1}) = \frac{1}{2}$
$Let \;x_{2} = \frac{1}{2} and \;y_{2} = \frac{0}{4}, f(x_{2},y_{2}) = \frac{1}{2}$
$f(x_{1},y_{2}) = f(x_{2},y_{2}) \land (x_{1}, y{1}) \neq(x_{2}, y{2})$

Also, I assume this function would be surjective but how to prove with couples?

Anyone could point me in the right direction? Thanks!

-
When you write $f(x_1, y_1) = 1/2$ you're implicitly assuming that the codomain of the function is one dimensional, whereas the codomain is actually two dimensional. The map is in fact both injective and surjective. A hint: the question is the same as that of whether given rational $a$ and $b$ there exist a unique pair of rational $x$ and $y$ such that $a = x + y$ and $b = x - y$. –  Jonah Sinick Oct 31 '12 at 5:37

• Injectivity: Suppose that $f(x_0,y_0)=f(x_1,y_1)$. Then $$\langle x_0+y_0,x_0-y_0\rangle=\langle x_1+y_1,x_1-y_1\rangle\;,$$ so $x_0+y_0=x_1+y_1$ and $x_0-y_0=x_1-y_1$. Add these two equations, and you find that $2x_0=2x_1$, which implies that $x_0=x_1$. Substitute that into either of the equations, and you find that $y_0=y_1$. Thus, $\langle x_0,y_0\rangle=\langle x_1,y_1\rangle$, and $f$ is injective.
• Surjectivity: Let $\langle a,b\rangle\in\Bbb Q^2$; we want to fine $\langle x,y\rangle\in\Bbb Q^2$ such that $f(x,y)=\langle a,b\rangle$. Since $f(x,y)=\langle x+y,x-y\rangle$, this means that we want to solve the system \left\{\begin{align*}&x+y=a\\&x-y=b\;.\end{align*}\right. This can be done by your favorite technique for solving linear systems; this one is simple enough that I’d just add the equations to get $2x=a+b$ and subtract the second from the first to get $2y=a-b$, giving me the solution $\langle x,y\rangle=\left\langle\frac12(a+b),\frac12(a-b)\right\rangle$. And this is in $\Bbb Q^2$: $a$ and $b$ are rational, so $\frac12(a+b)$ and $\frac12(a-b)$ are both rational.
Your attempt to show that $f$ is not injective fails because $\frac02$ and $\frac04$ are the same number: both of your pairs are simply $\left\langle\frac12,0\right\rangle$, so of course $f$ sends them to the same place. Don’t confuse distinct representations with distinct numbers.