I'm trying to come up with example functions that are $N \rightarrow N$ for each category:
- One-to-one but not onto.
- Onto but not one-to-one.
- Nether one-to-one nor onto.
- Both one-to-one and onto.
Here's what I've got:
- $f(n) = 2n$, because it's a linear function.
- $f(n) = n-1$, This only works when n is $\geq$ 2, but I'm thinking that's good enough?
- $f(n) = 0$, maybe this is a stretch but because y is always outside of $N$ I'm sure this is neither one-to-one or onto.
- $f(n) = n$, here x=y which matches both definitions.
So, I'm posting because I'm unsure of what I've got. Especially with 1 and 2. Here are the definitions I've got:
Onto: For every $y \in Y$ at least one $x \in X$ such that $f(x) = y$
One-to-one: For any $y \in Y$ there is at MOST one $x$ such that $f(x) = y$
This means that in order for a function to be onto there can be an x with two y's but it's not required. If it doesn't, doesn't that automatically make it also one-to-one?