# Onto and One-to-One of a 2 variable function

Pretty easy when its only a function of the form $y = ax + b$, however I'm trying to find if this function:

$f(x,y) = 2x + y$

is onto and one-to-one. Is there a procedure to follow to check this? Thanks!

EDIT: My reasoning.

onto:

$z = 2x + y$

$x = (z-y)/ 2$

$y = z - 2x$

Seeing as both $x$ and $y$ can be represented in "safe" ways (no dividing by zero), I'm assuming that the function is onto.

One-to-One:

$2x_1 + y_1 = 2x_2 + y_2$

$2(x_1-x_2) = (y_2-y_1)$

Therefore if $y_2 = y_1$, $x_2 = x_1$.

I guess my reasoning is wrong :/

-
Yes: check to see if it's onto, then check to see if it's one-to-one. (Note that it's generally easier to check if either of these properties fails, since all you have to do is find some points at which the corresponding definitions don't hold.) – Qiaochu Yuan Mar 9 '11 at 2:01
You'll have to define your function a bit better first before the question even makes sense. Try to write it as $f\colon A\to B \colon x\mapsto f(x)$, for instance, like $f\colon \mathbf R\to \mathbf R \colon x\mapsto ax+b$. – Myself Mar 9 '11 at 2:03
To check if the function is onto, try to solve the equation $2x+y = z$ for arbitrary $z$ (one solution is enough). To check if the function is one-to-one, check if $2x_1+y_1 = 2x_2+y_2$ implies $x_1=x_2$ and $y_1=y_2$. – Yuval Filmus Mar 9 '11 at 2:13
Thanks Yuval Filmus! I've found that it is both 1-1 and onto. – user7983 Mar 9 '11 at 2:25
@Max: Then you've either made some very odd choices for the domain and codomain, or have got it wrong. – Chris Eagle Mar 9 '11 at 2:27

I'm assuming your function has domain all of $\mathbb{R}^2$. For the codomain, some subset of $\mathbb{R}$. But you should state them explicitly, especially when you are trying to figure out if the function is one-to-one and/or onto; those properties depend on the domain the codomain, not just on the formula.

To show the function is onto, given any $z$ you just need to produce a single pair $(x,y)$ that maps to $z$.

Your "argument" does not really work. You are defining $x$ in terms of both $z$ and $y$, and then defining $y$ in terms of both $z$ and $x$; you have a circular definition.

For instance, say I ask you to use your formula to produce a pair $(x,y)$ that maps to $z=1$. You say: "take $x = (z-y)/2 = (1-y)/2$, and then $y=z-2x = 1-2x$. So $x=(1-y)/2$, and $y=1-2x$."

Ehr... okay. But what are $x$ and $y$? If you plug in the value of $x$ into the formula for $y$, you get $y=y$; if you plug in the value of $y$ into the formula for $x$, you get $x=x$. You aren't giving any pair that maps to $1$.

So, instead, given $z$, produce a specific value of $x$ and of $y$ (that depends on $z$, of course, but not on $x$ or $y$) that will map to $z$.

For one-to-one, your reasoning breaks down. Once you get to $2(x_1-x_2) = (y_2-y_1)$, you have no warrant for the assertion that $y_1=y_2$ and $x_1=x_2$. If one of them holds, then the other holds; but what if neither holds? For instance, if $x_1=2$ and $x_2=1$, can you find $y_1$ and $y_2$ that will make the equality true anyway? If so, then you can simply exhibit the pairs $(2,y_1)$ and $(1,y_2)$ to show that the function is not one-to-one, since you can find two distinct pairs that map to the same thing.

-

(I lack the reputation to just comment, so here goes...) Your reasoning about 1-1 is wrong because, while "Therefore if y2 = y1, x2 = x1." may be true, there is no guarantee that y2 = y1!

Notice that f(2, 0) = f(1, 2) = f(0, 4)

-
Wow I can't believe I missed that. Thanks! Just a side note, im guessing this method also works for functions of more than 2 variables? – user7983 Mar 9 '11 at 2:50
You really can't ignore the main point that others have been making, namely that you should explicitly state your domain and co-domain. Yes, we can extend the notion of one-to-one to many variables. – The Chaz 2.0 Mar 9 '11 at 3:00