Consinder the function
$$f\colon\mathbb N\to \mathbb N\text{ via }f(n)=2n-1.$$
Is function one to one? Is function onto?
First of all, I think it is one to one
because when i put
- $n=1$, I get $2(1)-1=1$
- $n=2$, I get $2(2)-1=3$
- $n=3$, I get $2(3)-1=5$
- $n=4$, I get $2(4)-1=7$
I get all odd numbers. I dont get even numbers. Therefore, this function is NOT onto. Am I right??
What if I get $1,2,3,4,5,6,7,8,9,\ldots$ whole numbers, then wouldn't the function be onto??
The reason function is one to one is because by using the definition, if $f(n_1)=f(n_2)$ then $n_1=n_2$. So $2n_1-1=2n_2-1 \Rightarrow n_1=n_2$, therfore it is one to one. That's how I think and I would like to know if I'm understanding the definition of one to one correctly.
Can anyone guide me right??
Best Answer
Yes, you're understanding the definition of one-to-one fine. And you're correct that the given function is one-to-one. You also use the correct method at the end to show this: Since whenever $f(n_1) = f(n_2)$, you've shown it must then be the case that $n_1 = n_2$, and so you've demonstrated that the function satisfies the definition of a one-to-one function.
You're also correct that the function is not onto (in this case, not onto $\mathbb N$), and you're correct for the right reason! For any even number $m \in \mathbb N$, there does not exist an $n \in \mathbb N$ such that $f(n) = m$. E.g., we know that $10 \in \mathbb N$, but there is no $n \in \mathbb N$ such that $f(n) = 2n - 1 = 10,$, since otherwise, supposing there is an $n$ such that $2n - 1 = 10 \iff 2n = 9 \iff n = 4.5$. But $4.5 \notin \mathbb N$!, contradiction. Hence the function is not onto.