# Cardinalities of the two sets and the condition of the function in between [duplicate]

So if I have two sets A and B and if |A| = |B| and if function f is a function from A to B and is injective, how can I prove that it is also surjective?

Forgot to mention. A and B are finite sets.

• Think about the map $f:\mathbb N\to\mathbb N$ where $$f(x)=x+1$$It's injective but not surjective. The claim is only true if $|A|<\infty$. – Don Thousand Nov 6 at 5:58
• See this or this. – Don Thousand Nov 6 at 6:00