Let $B$ be a countable set and let $f$ be a surjective function ($f:A\to B$), then $A$ is also countable

Question: Given a countable set $B$ and a function $f:A\to B$ which is surjective, then $A$ is also countable.

I think it's a false affirmation, but I have no idea of a counter example I can use here.

I basically know that: every subset $X \subseteq N$ is a countable set. And the corollary: given a countable set $A$ and a function $f:A\to B$ which is surjective on $B$, then $B$ is also countable.


Solution 1:

Take $f:\Bbb R \to \Bbb N$ defined as

$$f(x) = \begin{cases} x \text{ if } x \in \Bbb N\\ 1 \text{ if } x \not\in \Bbb N \end{cases}$$

Edit: I remembered that there's no concensus on the use of "countable". I've assumed it meant "countable infinite", that is, the same size of $\Bbb N$. But it's also used to denote "finite or of the size of $\Bbb N$", in which case a simpler example would be $f:\Bbb R \to \{0\}$ given by $f(x)=0$ for all $x$.