Show that $A$ is countable if and only if $A=\emptyset$ or there exists a surjective function $\mathbb N\rightarrow A$. Show that $A$ is countable if and only if $A=\emptyset$ or there exists a surjective function $\mathbb N\rightarrow A$.
I am having some trouble with this. This is what I have so far. Can someone verify it or help lead me to the correct path? Thank you.
Proof:
In the first direction, if $A=\emptyset$, then it is clear. If not, let there be a function $f:A\rightarrow \mathbb{N}\quad f(x)=2x$. Then $f$ is bijective, so it has an inverse: $g:\mathbb{N}\rightarrow A\quad g(x)=\frac{1}{2}x$.
$f\circ g=2(\frac{1}{2}x)=x=id_\mathbb{N}$ and $g\circ f=\frac{1}{2}(2x)=x=id_A$, so $g$
is bijective. Thus, $A\sim\mathbb{N}$, so $A$ is countable.
In the second direction, if $A$ is countable, then $A$ is equinumerous to $\mathbb{N}$ so there exists a bijective function from $A$ to $\mathbb{N}$.
Definition: A set is countable if it is finite, $\emptyset$ or equinumerous to $\mathbb{N}$
 A: The left to right implication is the easiest :
Let $A$ be countable.


*

*if $A = \emptyset$, we are done

*if $A$ is finite, say $A = \{a_0, \dots, a_k\}$ then the following map is a surjection $f : \mathbb{N} \mapsto A$ :
$$f : n \mapsto 
\left\{ \begin{array}{ll} a_n & \textrm{if } n \leqslant k \\
a_0 & \textrm{otherwise} \end{array} \right. $$

*finally, if $A$ is equinumerous with $\mathbb{N}$ then you have a bijection $f : \mathbb{N} \mapsto A$, which is hence a surjection.


The right to left implication is the hard part :
If $A=\emptyset$ or $A$ is finite we are done. So let's assume that $A$ is infinite and we have a surjective function $f : \mathbb{N} \mapsto A$. We need to find a bijection $g : \mathbb{N} \mapsto A$.
By induction, for each $n \in \mathbb{N}$, we construct the family of functions  $(g_n)_{n\in \mathbb{N}}$ satisfying :  


*

*for each $n$, $g_n$ is an injective function $\{0, \dots n\} \mapsto A$.

*for each $m \leqslant n$, $g_n$ extends $g_m$, ie $\forall k \leqslant m$, $g_n(k) = g_m(k)$.

*for each  $k \leqslant n$ , $f(k) \in \operatorname{Im}(g_n)$
If we can do that we are done since $g : n \mapsto g_n(n)$ is a bijection from $\mathbb{N}$ to $A$.
induction start We let $g_0 : \{ 0 \} \mapsto A$ be defined by $g_0(0) := f(0)$. 
Induction step Let $n \in \mathbb{N}$ Suppose we have already constructed $g_0, \dots, g_n$ satisfying points 1. 2. and 3. above.
 As $A$ is infinite, $g_n$ can't be a surjection (for otherwise $A$ would be finite), hence the set $X_n := \{k \in \mathbb{N} \ | \ f(k) \notin \operatorname{Im}(g_n) \}$ isn't empty. This allows us to define $g_{n + 1}(n + 1):= f(\min X_n)$.
For $k \leqslant n$, one sets $g_{n + 1}(k) := g_n(k)$.
Clearly, $g_{n+1}$ is injective and extends $g_m$ for $m \leqslant n + 1$. Let's check point 3. :
let $k \leqslant n + 1$ , then


*

*if $k \leqslant n$ we are done since $f(k) \in \operatorname{Im}(g_n) \subseteq \operatorname{Im}(g_{n+1})$.

*if $k = n+1$ then either $f(k) \in \operatorname{Im}(g_n)$ and we are done or we have $n + 1 \in X_n$, and since $0, \dots n, \notin X_n$ we have $n+1 = \min X_n$ hence $a= g_{n+1}(n+1)$.

A: For any element $a$ in $A$ consider the set $\phi(a) = \{n|f(n)=a \}$ where $f$ is your surjection.Now $\phi(a)$ is non-empty for all $a$ in $A$ so,we define $g(x)= \min.\phi(x)$ ,now it is easy to check that $g$ is bijection from $A$ to a subset of natural numbers.(Note that min. exists by Well Ordering Principle)
