Give an example of a function from N to N that is (a) one-to-one but not noto. (b) onto but not one-to-one. © both onto and and one-to-one (d) neither one-toone nor noto
Let’s start with writing down definitions:
One-to-one function: (or injective function) is function for which every element in the range of function corresponds to exactly one element from the domain.
Onto function: (or surjective function) is function for which every element in the codomain has at least one element from the domain that is mapped to it. In other words, codomain and range are the same set.
We are given set of natural numbers N, so:
Consider function f(n)=2⋅n. This function maps every element from the domain to element that is twice the original. Clearly, each element from the domain is mapped to different element in the codomain so the function is one-to-one. On the other hand, there are no elements in the domain that would map to odd numbers, so function is not onto.
Consider function f (1) = 1,f (2) = 1 and f (n) = n−1, for each n≥3. This function maps 1 and 2 to 1 and maps each number $n$ greater or equal to 3 to $n-1$. Clearly, function is not one-to-one but it is onto.
Function that is both onto and one-to-one is f(n)=n.
As an example of function that is neither one-to-one nor onto is constant function, f (n) = 1. This function maps each number to 1.