Prove that $A$ and $B$ are invertible and $B=A^{-1}$ Suppose $A$ and $B$ are $n \times n$ matrices.  Assume $AB=I$. Prove that $A$ and $B$ are invertible and that $B=A^{-1}$.

Please let me know whether my proof is correct and if there are any improvements to be made.

Assume $AB=I$.  Then $(AB)A=IA=A$. So, $A(BA)=AI=A$.  Then $BA=I$.  Therefore $AB=BA=I$.  Thus  $A$ and $B$ are invertible.  And by definition $B=A^{-1}$, so $AB=AA^{-1}=I$.

It doesn't seem quite correct.  Thanks in advance for any advice.
Proof #1: (along the lines mentioned in the comments)

As $AB=I$, you know that $A$ is onto as a linear transformation, because $x=Ix=ABx=A(Bx)$ for any $x\in\mathbb{R}^n$. This implies that $A$ is bijective, being a surjective linear transformation in a finite-dimensional space. So there exists $A^{-1}$. Now
$$
A^{-1}=A^{-1}I=A^{-1}AB=B.
$$

Proof #2 (using determinants)

Since $AB=I$, we have
$$
1=\det I=\det AB=\det A\,\det B.
$$
So $\det A\ne0$ and $A$ is invertible, and again we can do 
$$
B=IB=A^{-1}AB=A^{-1}I=A^{-1}.
$$
Suppose $AB = I$.  ($A$ and $B$ are $n \times n$ matrices.)

First note that $R(A) = \mathbb{R}^n$.  (If $y \in \mathbb{R}^n$, then
$y = Ax$, where $x = By$.)

It follows that $N(A) = \{0\}$.

We wish to show that $BAx = x$ for all $x \in \mathbb{R}^n$.
So let $x \in \mathbb{R}^n$, and let $z = BAx$.
Then $Az = A(BAx) = (AB)Ax = Ax$, which implies that
$z = x$ because $N(A) = \{ 0 \}$.  So $BAx = x$.