I'd would like to know that, because I don't want to prove a function is onto if I don't have to. If the answer is no, is there any particular case where it is true?
$\endgroup$ 33 Answers
$\begingroup$The function $f:\Bbb N\to\Bbb N:n\mapsto 2n$ is one-to-one but not onto, and there are many other easy examples. An even simpler one is $g:\Bbb N\to\Bbb N:n\mapsto n+1$.
About the only simple situation in which a one-to-one function $f:A\to B$ is necessarily onto is when $A$ and $B$ are finite sets of the same cardinality.
$\endgroup$ 0 $\begingroup$The answer is no in general, although it does depend on the specific situation. The exponential function is one-to-one but it is not onto if we consider the co-domain to be $\mathbb{R}$. It is onto if we further restrict the co-domain to $\mathbb{R}^+$.
One prominent case in which one-to-one implies onto (and vice versa) is for linear mappings between finite dimensional vector spaces. If we have a linear mapping between spaces of equal dimension, then the mapping is one-to-one if and only if it is onto.
$\endgroup$ 2 $\begingroup$The function $f: \{0\} \rightarrow \mathbb{R}$ defined by $f(x) = x$ is one-to-one but not onto. (Don't be afraid to be creative with your domains and codomains!)
For a less "gimmicky" example, $f: \mathbb{R}^+ \rightarrow \mathbb{R}$ defined by $f(x) = x^2$ is one-to-one but not onto (the square of a real number is never negative).
$\endgroup$ 2