\documentclass[10pt]{article}
\usepackage{amsmath,amsfonts}

\newcommand{\x}{\boldsymbol{x}}
\renewcommand{\a}{\boldsymbol{a}}
\renewcommand{\b}{\boldsymbol{b}}
\renewcommand{\c}{\boldsymbol{c}}
\newcommand{\e}{\boldsymbol{e}}

\newcommand{\R}{\mathbb{R}}

\renewcommand{\theenumi}{\roman{enumi}}
\renewcommand{\labelenumi}{(\theenumi)}

\begin{document}
\title{The Matrix Inverse}
\author{Marcel Oliver}
\date{Finite Mathematics, Spring 2020}
\maketitle

\section{Properties of the Matrix Inverse}

Given a matrix $A\in M(n\times n)$, its inverse $A^{-1}$ is the unique
matrix with the property
\[
  AA^{-1}=I=A^{-1}A \,.
\]
Recall the following identities:
\begin{enumerate}
\item $(A^{-1})^{-1}=A$
\item $(A^T)^{-1}=(A^{-1})^T$
\item $(AB)^{-1}=B^{-1}A^{-1}$
\end{enumerate}
Moreover, if $A$ is invertible then the solution to the system of linear
equations $A \x = \b$ can be written
\[
  \x = A^{-1}\b \,.
\]
This observation tells us how we can compute the matrix inverse once
we know how to solve linear equations.  We begin by writing $\b$ as a
linear combination of the standard unit vectors $\e_1,\dots,\e_n$,
\[
  \b = b_1 \e_1 + \dots + b_n \e_n \,.
\]
Then
\begin{align*}
  \x & = A^{-1} \, \bigl( b_1 \e_1 + \dots + b_n \e_n \bigr) \\
     & = b_1 A^{-1} \e_1 + \dots + b_n A^{-1} \e_n \\
     & =
     \begin{pmatrix}
       \vert &  & \vert \\
       A^{-1} \e_1 & \cdots & A^{-1} \e_n \\
       \vert &  & \vert
     \end{pmatrix} \, \b \,.
\end{align*}
Notice that the vectors $\x_1=A^{-1} \e_1, \dots \x_n=A^{-1} \e_n$ are
the columns of $A^{-1}$.  At the same time, we see that these vectors
are the solutions to the $n$ linear equations
\[
  A \x_1 = \e_1 \,, \quad \cdots, \quad A \x_n = \e_n \,.
\]
To find $A^{-1}$, we therefore have to simultaneously solve $n$
inhomogeneous linear equations, which is the essence of the following
procedure.

\section{Computing the inverse}

\subsection*{Form the augmented matrix}

Write the matrix $A$ to the left, and the identity matrix to the
right.  For example, when
\begin{equation*}
  A = 
  \begin{pmatrix}
  0 & \tfrac12 & -\tfrac12 \\
  1 & 0 & 1 \\
  2 & \tfrac12 & 1
  \end{pmatrix} \,,
\end{equation*}
write 
\begin{equation*}
  M = \left(
  \begin{matrix}
  0 & \tfrac12 & -\tfrac12 \\
  1 & 0 & 1 \\
  2 & \tfrac12 & 1
  \end{matrix}
  \right.\left|\left.
  \begin{matrix}
  1 & 0 & 0 \\
  0 & 1 & 0 \\
  0 & 0 & 1
  \end{matrix}
  \right)\right. \,.
\end{equation*}

\subsection*{Reduce to row-echelon form}

Use elementary row transformations on the augmented matrix to bring
the left-hand matrix into row echelon form.
\begin{itemize}
\item If you can obtain the identity matrix in the left-hand block,
the matrix is invertible and the final right-hand block is $A^{-1}$.
\item If you obtain a row of zeros in the left-hand block, i.e.\ if
$\operatorname{rank}A<n$, then $A$ is not invertible.
\end{itemize}
Let's work out the example:
\begin{align*}
  & \left(
  \begin{matrix}
  0 & \tfrac12 & -\tfrac12 \\
  1 & 0 & 1 \\
  2 & \tfrac12 & 1
  \end{matrix}
  \right.\left|\left.
  \begin{matrix}
  1 & 0 & 0 \\
  0 & 1 & 0 \\
  0 & 0 & 1
  \end{matrix}
  \right)\right. 
  \xrightarrow{\text{reorder rows}}
  \left(
  \begin{matrix}
  1 & 0 & 1 \\
  2 & \tfrac12 & 1 \\
  0 & \tfrac12 & -\tfrac12 
  \end{matrix}
  \right.\left|\left.
  \begin{matrix}
  0 & 1 & 0 \\
  0 & 0 & 1 \\
  1 & 0 & 0
  \end{matrix}
  \right)\right. 
  \xrightarrow{\text{R2}-2\,\text{R1}\to\text{R2}} \\
  & \left(
  \begin{matrix}
  1 & 0 & 1 \\
  0 & \tfrac12 & -1 \\
  0 & \tfrac12 & -\tfrac12 
  \end{matrix}
  \right.\left|\left.
  \begin{matrix}
  0 & 1 & 0 \\
  0 & -2 & 1 \\
  1 & 0 & 0
  \end{matrix}
  \right)\right.
  \xrightarrow{\text{R3}-\text{R2}\to\text{R3}}
  \left(
  \begin{matrix}
  1 & 0 & 1 \\
  0 & \tfrac12 & -1 \\
  0 & 0 & \tfrac12 
  \end{matrix}
  \right.\left|\left.
  \begin{matrix}
  0 & 1 & 0 \\
  0 & -2 & 1 \\
  1 & 2 & -1
  \end{matrix}
  \right)\right.  
  \xrightarrow{\substack{2\,\text{R2}\to\text{R2} \\
  2\,\text{R3}\to\text{R3}}} \\
  & \left(
  \begin{matrix}
  1 & 0 & 1 \\
  0 & 1 & -2 \\
  0 & 0 & 1
  \end{matrix}
  \right.\left|\left.
  \begin{matrix}
  0 & 1 & 0 \\
  0 & -4 & 2 \\
  2 & 4 & -2
  \end{matrix}
  \right)\right. 
  \xrightarrow{\substack{\text{R1}-\text{R3}\to\text{R1}\\
  \text{R2}+2\,\text{R3}\to\text{R2}}}
  \left(
  \begin{matrix}
  1 & 0 & 0 \\
  0 & 1 & 0 \\
  0 & 0 & 1
  \end{matrix}
  \right.\left|\left.
  \begin{matrix}
  -2 & -3 & 2 \\
  4 & 4 & -2 \\
  2 & 4 & -2
  \end{matrix}
  \right)\right. 
\end{align*}


\subsection*{Check your solution}

We see that
\[
  A^{-1} = 
  \begin{pmatrix}
  -2 & -3 & 2 \\
  4 & 4 & -2 \\
  2 & 4 & -2
  \end{pmatrix}
\]
and it is easy to check that
\[
  A A^{-1} =
  \begin{pmatrix}
  0 & \tfrac12 & -\tfrac12 \\
  1 & 0 & 1 \\
  2 & \tfrac12 & 1
  \end{pmatrix}
  \begin{pmatrix}
  -2 & -3 & 2 \\
  4 & 4 & -2 \\
  2 & 4 & -2
  \end{pmatrix} =
  \begin{pmatrix}
  1 & 0 & 0 \\
  0 & 1 & 0 \\
  0 & 0 & 1
  \end{pmatrix}
  = I \,.
\]

\end{document}
