# Onto and everywhere defined for functions having same cardinality

This is not true for infinite sets. Take $A=B=\mathbb{N}, f(n)=2n$. This is everywhere defined and one-to-one but not a bijection. For finite sets it is not true, either. You need onto or (everywhere defined and one-to-one). Otherwise, take $A=B=\{1,2\}, f(1)=f(2)=1.$ Given either onto or everywhere define and one-to-one, let $n=|A|=|B|,$ draw two sets of $n$ dots (like I did in a previous question) and connect them. If it is onto, you have to have $n$ distinct function values, so all $n$ elements must have defined values, and they must all be distinct. If it is everywhere defined and one-to-one, you have $n$ distinct values.