Finite Sets, Equal Cardinality, Injective $\iff$ Surjective.

If the sets have cardinality $n$ and $f$ is injective, then the image of $f$ must be an $n$ element subset of $B$ and so equal to $B.$ If $f$ is surjective, then the preimage of each element of $B$ contains at least one element, and the preimages are disjoint. So the union of the preimages of the elements of $B$ has at least $n$ elements. Since $A$ has only $n$ elements, each preimage of an element of $B$ can contain only one element of $A.$ so that $f$ is injective.


For the statement "$f$ injective implies $f$ surjective", induct on the cardinality of $A$ and $B$.

You can check $n=0$.

For $n=k+1$, let $f:A\to B$ be injective. $A$ has at least one element $a$. Define $f^-:A\setminus\{a\}\to B\setminus\{f(a)\}$, gotten by forgetting about $a$ and its value $f(a)$. $f^-$ is injective as restricting injections preserves injectivity (check this if you don't know). Then $f^-$ is also surjective by induction hypothesis. Appending back $a$ and $f(a)$ preserves surjectivity so $f$ is surjective.

The other direction is exactly the same; replace injective with surjective everywhere.