[Math] Functions $\mathbb{N} \to \mathbb{N}$ that are injective but not surjective, and vice versa

elementary-set-theoryexamples-counterexamplesfunctions

Suppose that $A$ and $B$ are sets each containing the same finite number of elements and $f: A \to B$.

a. Prove that $f$ is injective if and only if it is surjective.

b. Give an example of an injective function from $\Bbb N \to \Bbb N$ that is not surjective. Does this contradict (a)?

c. Give an example of a surjective function from $\Bbb N \to \Bbb N$ that is not injective. Does this contradict (a)?

My attempts

b. $f(x)= \frac{x}{2}$

c. $f(x) = x -1$

I don't get if it contradict part a.

Best Answer

It may be that the downvotes are because your work does not even exhibit that you understand the concepts of injective and surjective, the definitions of which you may well be expected to use in your answers for b) and c).

Both of your answers are dead-wrong: the function listed in b) is NOT from $\Bbb N \to \Bbb N$ (it has the wrong co-domain). For example, $f(1) = \frac{1}{2}$ is NOT a natural number.

The function you give in c) IS surjective, but it also is injective, To see this, suppose:

$f(x) = f(y) \implies x - 1 = y - 1 \implies (x - 1) + 1 = (y - 1) + 1 \implies x = y$.

(EDIT: as pointed out in the comments, $f$ is not even a function from $\Bbb N \to \Bbb N$, as one can see by noting $f(0) = -1 \not\in \Bbb N$).

I suggest you try some function $f$ for b) that "skips" values in $\Bbb N$, you want "gaps" in the co-domain. For c), you might try using the floor function, somehow.

a) is the most important question, here though. Finiteness is key, that's what b) and c) are supposed to convince you of. Start by assuming $f$ is surjective. What happens if you assume (by way of contradiction), that $f$ is not injective? (hint: compare the cardinalities of the range, and the domain).