A function is bijective if and only if has an inverse

Theorem
A function is bijective if and only if has an inverse

We'll first prove that if a function is bijective, then has an inverse.
Let $f$ be a bijective function.

Since $f$ is surjective, then an $a$ such that $f(a)=b$ will exist for sure (since the inverse image of a surjective function can not be the empty set).

Since $f$ is injective, then $a$ is unique, so $f^{-1}$ is well defined.

Now let's prove the other implication:
Let $f$: $A \to B$ be a function which has an inverse.

Let's prove $f$ is injective:

Let $a$1, $a$1 $\in$ $A$ and let $f(a$1$)$ = $f(a$2$)$ We must prove that $a$1 = $a$2: $a$1 = $Id$A($a$1) = $(f^{-1} \circ f)(a$1$)$ = $f^{-1} ( f(a$1$))$ = $f^{-1} ( f(a$2$))$ = $(f^{-1} \circ f)(a$2$)$ = $Id$A($a$2) = $a$2 So we proved $a$1=$a$2. Let's prove its surjectivity: Let $b \in B$ $b = Id$A$(b)$ = $(f \circ f^{-1})(b)$ = $f ( f^{-1}(b))$ Since $f^{-1}(b) \in A$ by definition, this proves that $a \in A$ such that $f(a)=b$ exists, thus the surjectivity has been proved.