# Explanation on $1-1$ functions and onto functions

$f : \Bbb{Z} \to \Bbb{Z}$ (integers), $f(n) = 3n + 2$ is $1-1$

$f : \Bbb{R} \to \Bbb{R}$ (real number), $f(x) = 2x - 3$ is onto

can someone explain $1-1$ and onto functions? I don't really understand the idea behind $1-1$ and onto

-
If a function is injective, we can define an inverse function from its image back to the domain. If it is onto, its image is the codomain, so having both properties is nice for being able to travel effortlessly between the domain and range of a map or function. – Joshua Shane Liberman May 6 '11 at 11:59
@Joshua, if liangteh doesn't understand 1-1 and onto, what are the chances it will help to answer in terms of injective, image, codomain, and other fancy words? – Gerry Myerson May 6 '11 at 12:34
Only that the functions were given as $\mathbb Z \to \mathbb Z$ and $\mathbb R \to \mathbb R$, which implied an understanding of to and from. – Joshua Shane Liberman May 7 '11 at 5:45

Definition: A function $f: A \to B$ is said to be $1-1$, whenever $f(x)=f(y)$, then $x=y$.

So the function which you gave $f: \mathbb{Z} \to \mathbb{Z}$ by $f(n)=3n+2$ is $1-1$ because $f(x)=f(y) \Longrightarrow 3x+2=3y+2$ implies $x=y$.

Definition: A function $f$ with domain $X$ and codomain $Y$ is onto if for every $y \in Y$ there exists at least one $x \in X$ with $f(x) = y$. Check whether that holds, in your example.

Just put $y=2x-3$ and write $x$ is terms of $y$. So you have $x = \frac{y+3}{2}$, which says that $f$ is onto.

Added. The function $f:\mathbb{Z} \to \mathbb{N}$ defined by $f(x)=x^{2}$ is not $1$-$1$ because, $f(x)=f(y)$ doesn't imply $x=y$. That is from $x^{2}=y^{2}$, we don't get $x=y$. We also get $x=-y$. Hence the function defined by $f(x)=x^{2}$ is not $1$-$1$. But if we change the Co - Domain, from $\mathbb{Z}$ to $\mathbb{N}$, then the function $f(x)=x^{2}$ becomes $1$-$1$.

-
@liangteh: I hope this clears your doubts. – user9413 May 6 '11 at 11:59

1-1 is better called injective. Onto is also called surjective. Some people use 1-1 to mean bijective, hence the confusion. The wikipedia pages I've linked to contain definitions and examples. If you have concrete questions, please ask again.

-
I haven't seen that use of bijective, and since the author did not mention bijections, I don't imagine its use led to any confusion. – Joshua Shane Liberman May 6 '11 at 11:56
anyone can give counter example on 1-1 and onto to help me understand better? – optimus May 6 '11 at 12:00
@Joshua, see for instance math.stackexchange.com/questions/7054/… – lhf May 6 '11 at 12:03
@liangteh, Taking an integer and doubling it is not a surjective map, I can't double an integer and get an odd integer. It is injective since for any even integer $2n$, I can divide by two and get a unique integer $n$ that maps to $2n$ under this $doubling$ operation. – Joshua Shane Liberman May 7 '11 at 5:50

For definitions, see the other answers.

Let's start with the opposite of 1 to 1, which is "many to 1". (Not "1 to many" - that would not be a function!) For example: The function $f(x) = x^3 - x$ is "many to 1", since the values $x = -1, \, 0, \, 1$ all are mapped to $y = 0$. A function is "many to 1" if there are values $x_1 \ne x_2$ such that $f(x_1) = f(x_2)$. A function is 1-1 if this is impossible, or with quantifiers $$\forall x_1, \, x_2 \in dom(f) \; x_1 \ne x_2 \Longrightarrow \; f(x_1) \ne f(x_2) \, .$$ You should check that the negation of this statement is precisely what I called informally "many to 1".

A function $f: A \to B$ is onto if all elements of $B$ are "hit" by the function $f$. Put differently, as $a$ attains all possible values in $A$, $f(a)$ attains all possible values in $B$. Differently yet, a function $f$ is onto $B$ if for all $b \in B$ the equation $f(x) = b$ is guaranteed to have a solution $x \in A$. In quantifier notation, $$\forall b \in B \, \exists x \in A \, \ni \, f(x) = a \, .$$ The function $f(x) = x^3 - x$ is onto $\mathbb{R}$ since the equation $x^3 - x = b$ has a solution for all real numbers $b$.

Hope this helps, good luck with your final.

-