$f: A \to B$ is invertible if and only if bijective

elementary-set-theorysolution-verification

I seem to have misplaced an old textbook that contains the standard proof of this fact. I was hoping someone could critique the proof I've written.

A function $f: A \to B$ is bijective if and only if it is invertible.

Suppose $f$ is bijective. Since $f$ is surjective, for all $b \in B$, there exists $a \in A$ such that $f(a) = b$. Since $f$ is injective, fixing one $b \in B$, its preimage is unique. Define the map $g(b) = a$. This is a total function since every $b \in B$ is included in the image of $f$ (by surjectivity). Furthermore, for any $a \in A$ whose image under $f$ is some $b \in B$, we have:
\begin{align*}
(g \circ f)(a) = g(f(a)) = g (b) = a.
\end{align*}

Since $a$ was arbitrary,
\begin{align*}
g \circ f = \text{id}_A.
\end{align*}

Similarly, for arbitrary $b \in B$ with unique preimage $a \in A$, we have:
\begin{align*}
(f \circ g)(b) = f(g(b)) = f(a) = b.
\end{align*}

Since $b$ was arbitrary,
\begin{align*}
(f \circ g) = \text{id}_B.
\end{align*}

Hence, $g = f^{-1}$, so $f$ is invertible.

Now, suppose that $f$ is invertible. That is, there exists an inverse $f^{-1} : B \to A$ such that $f \circ f^{-1} = \text{id}_B$ and $f^{-1} \circ f = \text{id}_A$. We will prove that $f$ is injective and surjective.

To establish the latter, let $b \in B$. Since $f^{-1}$ is a total function on $B$, there exists a unique $a \in A$ such that $f^{-1} (b) = a$. Applying $f$ on the left gives
$$f(f^{-1} (b)) = f(a).$$
By the definition of composition,
$$(f \circ f^{-1})(b) = f(a).$$
But $f \circ f^{-1} = \text{id}_B$:
$$\text{id}_B (b) = f(a)$$
By definition,
$$b = f(a)$$
Hence, there exists $a \in A$ such that $f(a) = b$, so $f$ is surjective.

Now, we show that $f$ is injective. Let $a_1, a_2 \in A$, and suppose that $f(a_1) = f(a_2)$. Applying $f^{-1}$ on the left gives
$$f^{-1}(f(a_1)) = f^{-1} f(a_2).$$
By the definition of composition,
$$(f^{-1} \circ f)(a_1) = (f^{-1} \circ f)(a_2)$$
But $f^{-1} \circ f = \text{id}_A$:
$$\text{id}_A (a_1) = \text{id}_A (a_2).$$
By definition,
$$a_1 = a_2.$$
Hence, $f$ is injective.

Since $f$ is injective and surjective, $f$ is bijective.

Best Answer

It's fine, but a bit verbose to my taste, the ideas are there though.

Condensed version: Suppose $f: A \to B$ is bijective. Define $g: B \to A$ by $g(b)$ is the unique (by 1-1 ness) element of $A$ such that $f(g(b))=b$. Then $f \circ g= 1_B$ is true by definition and $(g \circ f)(a) = g(f(a)) = a$ because $a$ is the unique element mapping to $f(a)$. So $g \circ f=1_A$.

Having such a $g$ (aka $f^{-1}$) obeying

$$g \circ f=1_A \land f \circ g= 1_B$$

$f$ is bijective: $f(a)=f(a')$ implies

$$a=1_A(a)=(g \circ f)(a) = (g(f(a))=g(f(a'))= (g \circ f)(a') = 1_A(a')=a'$$

showing injectivity of $f$, and if $b \in B$, $$f(g(b))=((f \circ g)(b)=1_B(b)=) b$$ so $b$ is a value of $f$ and $f$ is surjective. We could omit the $1_A,1_B$ and definition of composition as being too obvious as well.