Example of functions that are onto but not one-to-one I have been preparing for my exam tomorrow and I just can't think of a function that is onto but not one-to-one.
I know an absolute function isn't one-to-one or onto. And an example of a one-to-one function that isn't onto is $f(n)=2n$ where $f:\mathbb{Z}\to\mathbb{Z}$.
Help?
 A: I have to sort $52$ cards by suit and stack them in 4 boxes labeled according to suit: 
$52$-cards $\to$ ($4$ boxes)
$$f: \text{Set of $52$ Cards} \to \{spades,\; clubs, \;diamonds,\; hearts\}$$
A: For an example of a function $f:\Bbb R\to\Bbb R$ which is onto but not one-to-one, consider $$f(x)=x\sin(x).$$
A: For example, $\sin(x)$ from $\mathbb{R}$ to $[-1,1]$, $x^2$ from $\mathbb{R}$ to $\mathbb{R}_+$, or $x^3+5x^2+x+1$ from $\mathbb{R}$ to $\mathbb{R}$.
A: For example: 


*

*$x^{2k}, k\in\mathbb Z$ from $\mathbb R$ to $\mathbb R^+$

A: In order for a function to be onto, but not one-to-one, you can kind of imagine that there would be "more" things in the domain than the range.
A simple example would be $f(x,y)=x$, which takes $\mathbb{R}^2$ to $\mathbb{R}$. It is clearly onto, but since we always ignore $y$, it's also not one-to-one:
$f(2,1)=f(2,2)=f(2,12525235423)=2$.
A: Or you could use this simple example $f:\mathbb{R}\to[0,+\infty)$, $f(x) = |x|$
A: $f(1)=1$, $f(n)=n-1$ for each integer $n\ge 2$.
A: $$\left\{\begin{matrix}
a\\ \;\\ b\end{matrix}\right\}\begin{matrix} \searrow\\\nearrow\end{matrix}\{c\}$$
A: Take any bijection of $\Bbb N$ with $\Bbb{N\times N}$, e.g. $f(n,m)=2^n(2m+1)-1$ and take $g(n)$ to be the projection on the right coordinate of $f^{-1}(n)$.
Easily this is surjective, but every point has an infinite preimage.
