To prove that $B$ is the inverse of $A$, I recall from some other classes that it is necessary to show both $AB = BA$ and $AB = I$.
Yesterday, in my algebra class, I was totally stunned by my teacher as she said that it is not necessary to prove $AB=BA$ at all with the following proof:
Suppose $$AB = I$$
$$\det (AB) = \det I = 1$$
$$\det A \cdot \det B= 1$$
$$\det A \neq 0 \text{ and } \det B \neq 0$$
$\implies A^{-1}$ exists.
Multiplying $A^{-1}$ from LHS on both sides,
$$A^{-1} \cdot A \cdot B = A^{-1} \cdot I$$
$$B = A^{-1}.$$
Therefore for any $AB = I$, $B$ is the inverse of $A$.
What is wrong with this proof?
Nothing is wrong in the proof, since it is not necessary to prove $AB=BA$
Because $$AB=I \implies AB=BA$$
Let's see how,
Since $$AB=I \implies \det(A) \cdot \det (B) =\det (I)=1$$
$\implies \det(B) \neq 0 \implies $ $B$ has an inverse.
$$AB = I \implies BAB=B$$ (Pre-multiplying by $B$)
$BAB=B \implies BABB^{-1}=BB^{-1}=I $$ (Post-multiplying by $B^{-1}$)
$$BA=I=AB$$