# one to one and onto problem

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??

-
Your are right in that is not onto, and your reasoning is right, for any $n\in\mathbb{N}$, $2n-1$ is always an odd number. You are also right about the function being one-to-one, and the way you prove it is correct. :) – Heberto del Rio Jun 5 '13 at 17:10
One question mark per question is enough, in general. Two questions marks don't make it more question-y. :) – Thomas Andrews Jun 5 '13 at 17:12
LOL thank you!! – amie Jun 5 '13 at 17:20

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.

-
One-to-a thumbs-up! :-) – Amzoti Jun 6 '13 at 0:47

You are correct, if you set $f(m) = f(n)$ then you can simplify that equation to $n = m$, and this is the definition of one-to-one.

Conversely you have observed that $f(n)$ is always odd. This is because $2n$ is even therefore $2n - 1$ is odd. Thus for any even number, say two, it is never the case that $f(n) = 2$ and this contradicts the definition on onto.

-

You need to check your definitions. A function is 1-1 iff whenever $f(b) = f(a)$, then $a=b$. Thus, your method of determining whether or not you have a 1-1 function is correct. Also, to check whether or not a function is onto, you pick an arbitrary element $c$ in the codomain, and see whether you can find an element $d$ in the domain such that $f(d) = c.$ For example, can you find an $n \in \mathbb{N}$ such that $f(n) = 1?$ Can you think of problematic ones?

-
i understood until you mentioned pick an arbitrary element C in the codomain, but then i got lost. could you give me an example? – amie Jun 5 '13 at 17:24
Lets say that you have a function $f$ that maps elements from the domain $\mathbb{Z}$ to codomain $\mathbb{Z}$. Suppose your function is $f(n) = 2n$. Thus, you take an element in $\mathbb{Z}$ and your function gives you another element, which is also in $\mathbb{Z}$. Is it onto? Let $p \in \mathbb{Z}$ be the element you pick in the codomain. Can you find an element $s$ such that $f(s) = p?$ Only the value $s = \frac{p}{2}$ will work here since $f(s) = f(\frac{p}{2}) = 2(\frac{s}{2}) = p$. But wait, $\frac{p}{2} \not \in \mathbb{Z}$, so $f$ is not onto. I hope that makes it clear. – Wortel Jun 5 '13 at 17:49