\section{Defining the Determinant}
In Theorem~\ref{thm:twodinverse} the inverse of the  $2\times2$ matrix
$\begin{bsmallmatrix*} a & b \\ c & d \end{bsmallmatrix*}$
was found to be
\[\frac{1}{(ad-bc)}\begin{bmatrix*}[r]d&-b\\-c&a\end{bmatrix*}\,.\]
Clearly for this inverse formula to work the number $ad-bc$ must be nonzero. This single number $ad-bc$ which depends on all the entries of the matrix is called its determinant and the goal of this chapter is to generalize the formula to square matrices of arbitrary dimension, determine ways to calculate it, find out its properties and its useful applications.

Let $A$ be an $n\times n$ square matrix. Associated with $A$ there is a number called the \textbf{determinant} of $A$ denoted by $\det{A}$, $\detf{A}$, or $|A|$\,. Note that the vertical bars here \emph{do not} refer to absolute value.

If $A$ is a $1\times1$ matrix, so $A = [a_{11}]$, then $\det A = a_{11}$\,.

If $A$ is a $2\times 2$ matrix, so $A = \begin{bmatrix}
  a_{11} & a_{12} \\ a_{21} & a_{22}
\end{bmatrix}$, then $\det A = a_{11}a_{22} - a_{12}a_{21}$\,.

\begin{example}
  If $A = \begin{bmatrix*}[r]
    -9
  \end{bmatrix*}$, then
  $\det A=|A|=-9$


  If $B = \begin{bmatrix*}[r]
    1&2\\2&-3
  \end{bmatrix*}$, then
  $\det B=|B|= (1)(-3) - (2)(2) = -3 -4 = -7$
\end{example}

To define the determinant of square matrices of arbitrary dimension we will do so recursively in terms of the determinants of the smaller matrices they contain.  This requires the following definition.

\definition{Let $A$ be an $m\times n$ matrix, then the \textbf{submatrix} $A_{ij}$ is obtained from $A$ by deleting the $i\textsuperscript{th}$ row and $j\textsuperscript{th}$ column.}

\begin{example}
  If $A = \begin{bmatrix*}[r]
    2&-1&1\\0&1&2\\3&5&-4
  \end{bmatrix*}$ then
  $A_{12} = \begin{bmatrix*}[r]
    0&2\\3&-4
  \end{bmatrix*}$ and
  $A_{33} = \begin{bmatrix*}[r]
    2&-1\\0&1
  \end{bmatrix*}$\,.
\end{example}

With this notation we note that the determinant of a $2\times2$ matrix $A = \begin{bmatrix}
  a_{11} & a_{12} \\ a_{21} & a_{22}
\end{bmatrix}$ can be written in terms of the determinants of its $1\times1$ submatrices as
 \[\det A = a_{11}a_{22} - a_{12}a_{21}= a_{11}\det A_{11} - a_{12}\det A_{12}\,.\]
This suggests that we can generalize the determinant to a $3\times3$ matrix
\[A = \begin{bmatrix}
  a_{11}&a_{12}&a_{13}\\
  a_{21}&a_{22}&a_{23}\\
  a_{31}&a_{32}&a_{33}
\end{bmatrix}\]
by adding and subtracting alternately the product of each entry in its first row times the determinant of its corresponding submatrix:
\[\det A = a_{11}\det A_{11} - a_{12} \det A_{12} + a_{13}\det A_{13}\,.\]
Since these submatrices are $2\times2$ matrices, this is well-defined.  Proceeding recursively we can now define the determinant for square matrices of any dimension.

\definition{Let $A=[a_{ij}]$ be a square matrix of dimension $n\times n$\,. Associated with $A$ there is a number called the \textbf{determinant of} $\bm{A}$ denoted by $\det{A}$, $\detf{A}$, or $|A|$\,.  If $n=1$ then define $\det A=a_{11}$.\\
For $n>1$ define
\[\det A = a_{11}\det A_{11} - a_{12} \det A_{12} + \ldots + (-1)^{n+1}a_{1n}\det A_{1n}\,,\]
where $A_{ij}$ is the submatrix obtained from $A$ by deleting the  $i\textsuperscript{th}$ row and $j\textsuperscript{th}$ column from $A$\,.}

\begin{example}
  Compute the determinant of $A$ for the given matrices.
  \begin{enumerate}
    \item  $A = \begin{bmatrix*}[r]
      6&-3\\5&9
    \end{bmatrix*}$\\[1em]
    Solution:
    \[\det A = (6)(9)-(-3)(5) = 54+15 = 69\]

    \item $A = \begin{bmatrix*}[r]
      2&4&7\\6&0&3\\1&5&3
    \end{bmatrix*}$\\[1em]
    Solution:
    \begin{align*}
    \det A & = a_{11}\det A_{11} - a_{12}\det A_{12} + a_{13}\det A_{13}\\[.5em]
    & = 2\begin{vmatrix}0&3\\5&3\end{vmatrix}
    - 4\begin{vmatrix}6&3\\1&3\end{vmatrix}
    + 7\begin{vmatrix}6&0\\1&5\end{vmatrix}\\[.5em]
    & = 2(0-15)
    - 4(18-3)
    + 7(30-0)\\
    & = 2(-15)-4(15)+7(30)\\
    & = -30-60+210\\
    & = 120
    \end{align*}

\item $A = \begin{bmatrix*}[r]
  1&~3&0\\-5&2&3\\1&0&-1
\end{bmatrix*}$

Solution:
    \begin{align*}
    \det A & = a_{11}\det A_{11} - a_{12}\det A_{12} + a_{13}\det A_{13}\\[.5em]
    & = 1\begin{vmatrix*}[r]2&3\\0&-1\end{vmatrix*}
    - 3\begin{vmatrix*}[r]-5&3\\1&-1\end{vmatrix*}+\cancel{(0)\det A_{13}}\\[.5em]
    & = 1(-2-0)
    - 3(5-3)\\
    & = 1(-2)-3(2)\\
    & = -2-6\\
    & = -8
    \end{align*}

\item $A = \begin{bmatrix*}[r]
  -1&~2&-3\\ 1&1&2\\0&2&-5
\end{bmatrix*}$

Solution:
\begin{align*}
\det A &=(-1)\begin{vmatrix*}[r]1&2\\2&-5\end{vmatrix*}
-2\begin{vmatrix*}[r]1&2\\0&-5\end{vmatrix*}
+(-3)\begin{vmatrix*}1&1\\0&2\end{vmatrix*} \\
&=(-1)(-5-4)-2(-5-0)-3(2-0)\\
& = 9+10-6\\
& = 13
\end{align*}
  \end{enumerate}
\end{example}

\subsection*{The Rule of Sarrus for $3\times3$ Matrix Determinants}
For a $2\times2$ matrix the determinant  $\begin{vmatrix} a & b\\ c & d\end{vmatrix}=ad-bc$ is easily remembered as the product of the diagonal from left to right minus the product of the diagonal from right to left. For a $3\times3$ matrix a similar pattern emerges if one appends the first two columns of the matrix on the right of the matrix to form a $3\times5$ matrix.
% The following is inspired by discussion here:
% https://tex.stackexchange.com/questions/38169/drawing-multiple-diagonal-arrows-in-a-table
\begin{center}
\begin{tikzpicture}
\matrix[matrix of math nodes,inner sep=1pt,row sep=1em,column sep=1em] (M)
{
    a_{11} & a_{12} & a_{13}  &  a_{11} & a_{12} \\
    a_{21} & a_{22} & a_{23}  & a_{21} & a_{22} \\
    a_{31} & a_{32} & a_{33}  & a_{31} & a_{32} \\
}
;
\draw[red,->] (M-1-1.north west) -- (M-3-3.south east);
\draw[red,->] (M-1-2.north west) -- (M-3-4.south east);
\draw[red,->] (M-1-3.north west) -- (M-3-5.south east);
\draw[blue,->] (M-1-3.north east) -- (M-3-1.south west);
\draw[blue,->] (M-1-4.north east) -- (M-3-2.south west);
\draw[blue,->] (M-1-5.north east) -- (M-3-3.south west);
\draw[black] (M-1-1.north west) -- (M-3-1.south west);
\draw[black] (M-1-3.north east) -- (M-3-3.south east);
\end{tikzpicture}
\end{center}
The determinant of the $3\times3$ matrix is then the sum of the three diagonal products from left to right minus the sum of the three diagonal products from right to left.
This is known as the \textbf{Rule of Sarrus}.  That this is true can be seen by applying the definition of the determinant to a general $3\times3$ matrix to get:
\begin{align*}
\begin{vmatrix*}
  a_{11}&a_{12}&a_{13}\\
  a_{21}&a_{22}&a_{23}\\
  a_{31}&a_{32}&a_{33}
  \end{vmatrix*} & = a_{11}\begin{vmatrix*}
  a_{22}&a_{23}\\
  a_{32}&a_{33}
  \end{vmatrix*}
  -a_{12}\begin{vmatrix*}
  a_{21}&a_{23}\\
  a_{31}&a_{33}
  \end{vmatrix*}
  +a_{13}\begin{vmatrix*}
  a_{21}&a_{22}\\
  a_{31}&a_{32}
  \end{vmatrix*}\\
   & = a_{11}(a_{22}a_{33}-a_{23}a_{32})
  -a_{12}(a_{21}a_{33}-a_{23}a_{31})
  +a_{13}(a_{21}a_{32}-a_{22}a_{31})\\
   & = a_{11}a_{22}a_{33}-a_{11}a_{23}a_{32}
  -a_{12}a_{21}a_{33}+a_{12}a_{23}a_{31}
  +a_{13}a_{21}a_{32}-a_{13}a_{22}a_{31}\\
   & = a_{11}a_{22}a_{33}+a_{12}a_{23}a_{31}+a_{13}a_{21}a_{32}
  -a_{13}a_{22}a_{31}-a_{11}a_{23}a_{32}-a_{12}a_{21}a_{33}
\end{align*}
Note that the Rule of Sarrus applies only to determinants of $3\times3$ matrices. The pattern fails for determinants of matrices of order greater than three.

\begin{example}
Find the determinant of the $3\times3$ matrix using the Rule of Sarrus.
\begin{enumerate}
\item $A = \begin{bmatrix*}[r]-1&2&-3\\1&1&2\\0&2&-5\end{bmatrix*}$

Solution:\\
\begin{center}
\begin{tikzpicture}
\matrix[matrix of math nodes,inner sep=1pt,row sep=1em,column sep=1em] (M)
{
    -1 & 2 & -3  & -1 & 2 \\
    ~~1 & 1 & ~~2  & ~~1 & 1 \\
    ~~0 & 2 & -5  & ~~0 & 2 \\
}
;
\draw[red,->] (M-1-1.north west) -- (M-3-3.south east);
\draw[red,->] (M-1-2.north west) -- (M-3-4.south east);
\draw[red,->] (M-1-3.north west) -- (M-3-5.south east);
\draw[blue,->] (M-1-3.north east) -- (M-3-1.south west);
\draw[blue,->] (M-1-4.north east) -- (M-3-2.south west);
\draw[blue,->] (M-1-5.north east) -- (M-3-3.south west);
\draw[black] (M-1-1.north west) -- (M-3-1.south west);
\draw[black] (M-1-3.north east) -- (M-3-3.south east);
\end{tikzpicture}
\end{center}
\begin{align*}\det A &= (-1)(1)(-5) + (2)(2)(0) + (-3)(1)(2) - (-3)(1)(0) - (-1)(2)(2) - (2)(1)(-5)\\
  &= 5 +0 - 6 + 0 + 4 + 10\\
  & = 13
  \end{align*}  
\item $A = \begin{bmatrix*}[r]0&2&3\\1&4&0\\5&0&6\end{bmatrix*}$

Solution:\\
\begin{center}
\begin{tikzpicture}
\matrix[matrix of math nodes,inner sep=1pt,row sep=1em,column sep=1em] (M)
{
    0 & 2 & 3  & 0 & 2 \\
    1 & 4 & 0  & 1 & 4 \\
    5 & 0 & 6  & 5 & 0 \\
}
;
\draw[red,->] (M-1-1.north west) -- (M-3-3.south east);
\draw[red,->] (M-1-2.north west) -- (M-3-4.south east);
\draw[red,->] (M-1-3.north west) -- (M-3-5.south east);
\draw[blue,->] (M-1-3.north east) -- (M-3-1.south west);
\draw[blue,->] (M-1-4.north east) -- (M-3-2.south west);
\draw[blue,->] (M-1-5.north east) -- (M-3-3.south west);
\draw[black] (M-1-1.north west) -- (M-3-1.south west);
\draw[black] (M-1-3.north east) -- (M-3-3.south east);
\end{tikzpicture}
\end{center}
\begin{align*}\det A &= 0 + 0 + 0 - (3)(4)(5)-0-(2)(1)(6)\\
  & = -60-12 \\
  & = -72
  \end{align*}  
\end{enumerate}
\end{example}

\subsection{Cofactor Expansion}
Consider finding the determinant of the matrix 
\[A = \begin{bmatrix*}[r]
    5&1&2&4\\-1&0&2&3\\1&1&6&1\\1&0&0&-4
  \end{bmatrix*}\,.\]
We have
\[\det A = 5\det A_{11} - 1\det A_{12} + 2\det A_{13} - 4\det A_{14}\]
and the determinants of the submatrices of dimension $3\times3$ would then need to be evaluated.  To compute this requires a fair amount of work.  We wish to study other methods of evaluating determinants.

\definition{Let $A$ be an $n\times n$ square matrix (a matrix of order $n$) and let $A_{ij}$ denote the $(n-1) \times (n-1)$ submatrix obtained from $A$ by deleting the $i\textsuperscript{th}$ row and $j\textsuperscript{th}$ column, then:
\begin{itemize}
  \item The $\bm{i,j}$\textbf{-minor} of $A$, denoted by $\bm{m_{ij}}$, is given by $\boxed{m_{ij}=\det A_{ij}}$.
  \item The $\bm{i,j}$\textbf{-cofactor} of $A$, denoted by $\bm{c_{ij}}$, is given by $\boxed{c_{ij} = (-1)^{i+j}m_{ij} = (-1)^{i+j}\det A_{ij}}$\,.
  \item The \textbf{cofactor matrix of} $\bm{A}$ is the $n\times n$ matrix $C=[c_{ij}]$\,.
\end{itemize}}
Note that since $i+j$ is even if $i$ and $j$ are both even or both odd and $i+j$ is odd if $i$ is even and $j$ is odd, or \emph{vice versa}, it follows that $-1^{i+j}$ has the pattern
\[\begin{bmatrix}+&-&+&-&\cdots\\
-&+&-&+&\cdots\\+&-&+&-&\cdots\\-&+&-&+&\cdots\\
\vdots & \vdots & \vdots & \vdots
\end{bmatrix}\,.\]
\begin{example}\label{example:cofactor}
Find the minors, cofactors, and cofactor matrix of the given matrices.
  \begin{enumerate}
    \item $A = \begin{bmatrix*}[r]
      2&-3&1\\4&0&-2\\3&-1&-3
    \end{bmatrix*}$

Solution:\\
        The matrix has 9 elements, therefore it has 9 minors and 9 cofactors.  The minors are:      
        \[\begin{array}{lll}
          m_{11} = \begin{vmatrix*}[r]
          0&-2\\-1&-3
          \end{vmatrix*}= 0-2= -2 
          &m_{12}= \begin{vmatrix*}[r]
          4&-2\\3&-3
          \end{vmatrix*}= -12 + 6= -6
          &m_{13}= \begin{vmatrix*}[r]
          4&0\\3&-1
          \end{vmatrix*}= -4 + 0= -4\\[1.5em]
          m_{21}= \begin{vmatrix*}[r]
          -3&1\\-1&-3
          \end{vmatrix*}= 9+1= 10
          &m_{22}= \begin{vmatrix*}[r]
          2&1\\3&-3
          \end{vmatrix*}= -6 -3= -9
          &m_{23}= \begin{vmatrix*}[r]
          2&-3\\3&-1
          \end{vmatrix*}= -2 + 9= 7\\[1.5em]
          m_{31}= \begin{vmatrix*}[r]
          -3&1\\0&-2
          \end{vmatrix*}= 6-0= 6
          &m_{32}= \begin{vmatrix*}[r]
          2&1\\4&-2
          \end{vmatrix*}= -4 -4= -8
          &m_{33}= \begin{vmatrix*}[r]
          2&-3\\4&0
          \end{vmatrix*}= 0 + 12= 12\\
          \end{array}\]
 The cofactors additionally have the multiplicative sign factor $-1^{i+j}$ to get
 \[\begin{array}{lll}
            c_{11} = +m_{11}= -2 & c_{12} =-m_{12}= 6 & c_{13} =+m_{13}= -4\\
            c_{21} =-m_{21}= -10 & c_{22} = +m_{22}=-9 & c_{23}=-m_{23}= -7\\
            c_{31} =+m_{31}= 6 & c_{32}=-m_{32}= 8 & c_{33}=+m_{33}= 12
            \end{array}\]
The cofactor matrix of $A$ is therefore
\[C = \begin{bmatrix*}[r]
    -2&6&-4\\-10&-9&-7\\6&8&12
\end{bmatrix*}\,.\]


        \item $A = \begin{bmatrix*}[r]
          1&-3&2\\0&1&3\\-1&-2&5
          \end{bmatrix*}$

Solution:\\
The minors of $A$ are:
\[\begin{array}{lll}
        m_{11} = \begin{vmatrix*}[r]
                 1&3\\-2&5
                 \end{vmatrix*} = 11&
        m_{12} = \begin{vmatrix*}[r]
          0&3\\-1&5
          \end{vmatrix*} = 3&
          m_{13} = \begin{vmatrix*}[r]
          0&1\\-1&-2
          \end{vmatrix*} = 1\\[1.5em]
          m_{21} = \begin{vmatrix*}[r]
          -3&2\\-2&5
          \end{vmatrix*} = -11&
          m_{22} = \begin{vmatrix*}[r]
          1&2\\-1&5
          \end{vmatrix*} = 7&
          m_{23} = \begin{vmatrix*}[r]
          1&-3\\-1&-2
          \end{vmatrix*} = -5\\[1.5em]
          m_{31} = \begin{vmatrix*}[r]
          -3&2\\1&3
          \end{vmatrix*} = -11&
          m_{32} = \begin{vmatrix*}[r]
          1&2\\0&3
          \end{vmatrix*} = 3&
          m_{33} = \begin{vmatrix*}[r]
          1&-3\\0&1
              \end{vmatrix*} = 1
          \end{array}\]
 The cofactors of $A$ are:
 \[\begin{array}{lll}
            c_{11} = +m_{11}= 11 & c_{12} =-m_{12}= -3 & c_{13} =+m_{13}= 1\\
            c_{21} =-m_{21}= 11 & c_{22} = +m_{22}=7 & c_{23}=-m_{23}= 5\\
            c_{31} =+m_{31}=-11 & c_{32}=-m_{32}=-3 & c_{33}=+m_{33}= 1
            \end{array}\]
The cofactor matrix of $A$ is therefore:
            \[C = \begin{bmatrix*}[r]
        11&-3&1\\11&7&5\\-11&-3&1
        \end{bmatrix*}\]
  \end{enumerate}
\end{example}


\theorem{If $A$ is an $n\times n$ matrix then $\det A$ can be evaluated by a \textbf{cofactor expansion} along any row or any column as follows:\\
Along the $i\textsuperscript{th}$ row:
\[\boxed{\det A = a_{i1}c_{i1} + a_{i2}c_{i2} + \ldots + a_{in}c_{in}}\,.\]
Along the $j\textsuperscript{th}$ column:
\[\boxed{\det A = a_{1j}c_{1j} + a_{2j}c_{2j} + \ldots + a_{nj}c_{nj}}\,.\]}

In addition to illustrating a profound property of the determinant, cofactor expansion has practical utility.  When evaluating a determinant we can choose to expand a row or column containing one or more zeros to simplify calculation.

Since a matrix with a zero row or column may always be expanded along it when finding the determinant we have the following corollary of the cofactor expansion theorem.

\textbf{Corollary:} If square matrix $A$ has a zero row or column then $\det A=0$.

\begin{example}
Evaluate the determinant of the given matrix.

  \begin{enumerate}
    \item $A = \begin{bmatrix*}[r]
    2&-3&1\\4&0&-2\\3&-1&-3
    \end{bmatrix*}$\\[.5em]

Solution:\\
Expanding along the second row we have: 
      \begin{align*}
   \det A &= a_{21}c_{21} + \cancel{a_{22}c_{22}} + a_{23}c_{23}\\
   &= 4(-1)^{2+1}m_{21} + (-2)(-1)^{2+3}m_{23}\\
   &= -4m_{21} + 2m_{23}\\
   &= -4 \begin{vmatrix*}[r]
   -3&1\\-1&-3
   \end{vmatrix*} + 2 \begin{vmatrix*}[r]
   2&-3\\3&-1
   \end{vmatrix*}\\
   &= -4[(-3)(-3)-(1)(-1)] + 2[(2)(-1)-(-3)(3)]\\
   &= -40 + 14\\
   &= -26
 \end{align*}

   \item $A = \begin{bmatrix*}[r]
    1&0&1&-7\\9&0&3&-1\\2&0&1&5\\0&0&4&0
    \end{bmatrix*}$\\[.5em]

Solution:\\
Since its second column is all zeros, $\det A=0$\,.

\item $A = \begin{bmatrix*}[r]
 1&-3&2\\0&1&3\\-1&-2&5
 \end{bmatrix*}$\\[.5em]

Solution:\\
Expanding along the first column: 
\begin{align*}
  \det A &= a_{11}c_{11} + \cancel{a_{21}c_{21}} + a_{31}c_{31}\\
  &= 1(-1)^{1+1}m_{11} + (-1)(-1)^{3+1}m_{31}\\
  &= m_{11}-m_{31}\\
  &= \begin{vmatrix*}[r]
  1&3\\-2&5
  \end{vmatrix*} - \begin{vmatrix*}[r]
  -3&2\\1&3
  \end{vmatrix*}\\
  &= 5-(-6)-[(-9)-2]\\
  &= 11 + 11\\
  &= 22\\
\end{align*}


\item $A = \begin{bmatrix*}[r]
5&1&2&4\\-1&0&2&3\\1&1&6&1\\1&0&0&-4
\end{bmatrix*}$~~~~(Our $4\times4$ matrix from before.)\\[.5em]

Solution:\\
Expanding along the fourth row containing two zeros: 
\begin{align*}
  \det A &=(1)(-1)\underbrace{\begin{vmatrix}
  1&2&4\\0&2&3\\1&6&1
  \end{vmatrix}}_{\text{expand 2\textsuperscript{nd} row}} +0 +0 +(-4)(+1)\underbrace{\begin{vmatrix*}[r]
  5&1&2\\-1&0&2\\1&1&6
  \end{vmatrix*}}_{\text{2\textsuperscript{nd} row}}\\
  &=-\left[2(+1)\begin{vmatrix}
  1&4\\1&1
  \end{vmatrix} +3(-1) \begin{vmatrix}
  1&2\\1&6
  \end{vmatrix}~\right]-4\left[(-1)(-1)\begin{vmatrix}
  1&2\\1&6
  \end{vmatrix} +2(-1)\begin{vmatrix}
  5&1\\1&1
  \end{vmatrix}~\right]\\
  &=-[2(1-4)-3(6-2)]-4[(1)(6-2)-2(5-1)]\\
  &=-(-6-12)-4(4-8)\\
  &=18+16\\
  &=34
\end{align*}
\end{enumerate}
\end{example}

\subsection*{Determinants of Triangular Matrices}
\definition{A square matrix is called \textbf{upper triangular} if all the entries below the main diagonal are zero and \textbf{lower triangular} if all entries above the main diagonal are zero.}

Clearly a diagonal matrix is both upper and lower triangular.

\begin{example}
\begin{enumerate}
\item $U = \begin{bmatrix}
1 & 3 & 5\\0& 1&2\\0&0&10
\end{bmatrix}$ is upper triangular.

\item $L = \begin{bmatrix*}[r]
1&0&0&0\\2&0&0&0\\-2&1&5&0\\1&0&1&1
\end{bmatrix*}$ is lower triangular.

\item $D = \begin{bmatrix*}[r]
-2&0&0\\0&3&0\\0&0&10
\end{bmatrix*}$ is a diagonal matrix (and upper and lower triangular).
\end{enumerate}
\end{example}


\theorem{If an $n\times n$ matrix $A$ is upper triangular, lower triangular, or diagonal, then its determinant is the product of its entries on the main diagonal,
\[\boxed{\det A = a_{11}a_{22}\cdots a_{nn}}\,.\]}

\textbf{Proof:}\\
Suppose $A$ is upper triangular given by
\[A = \begin{bmatrix}
a_{11} & a_{12} & \ldots & a_{1n}\\
0&a_{22} & \ldots & a_{2n}\\
\vdots & \vdots &\ddots & \vdots\\
0 &0 &\ldots &a_{nn}
\end{bmatrix}\,.\]
Expanding along its first column we have
\begin{align*}
  \det A &= a_{11}c_{11}\\
  &= a_{11}(-1)^{1+1}m_{11}\\
  &= a_{11} \begin{vmatrix}
  a_{22} & \ldots & a_{2n}\\ \vdots & \ddots & \vdots\\ 0 & \ldots & a_{nn}
  \end{vmatrix}
\end{align*}
The resulting submatrix is still upper triangular and we can expand along its first column :
\begin{align*}
  \det A &= a_{11}a_{22}
\begin{vmatrix}
  a_{33} & \ldots & a_{3n}\\ \vdots & \ddots & \vdots\\ 0 & \ldots & a_{nn}
\end{vmatrix}
\end{align*}
Continuing this process we have $\det A=a_{11}a_{22}\cdots a_{nn}$\,.  A similar argument follows for lower triangular matrices using row expansion.  Finally diagonal matrices are triangular so the theorem follows for them as well.\footnote{A rigorous proof of this theorem using mathematical induction is as follows.  Let $P(n)$ be the proposition that the determinant of an order $n$ upper diagonal matrix is the product of its diagonal elements.  Then $P(1)$ is true since then $A=[a_{11}]$ and $\det A=a_{11}$.  Next suppose $P(n)$ is true.  Then an $(n+1)\times(n+1)$ upper diagonal matrix $A$ can be expanded along its top row to get $\det A=a_{11}\det A_{11}$.  But submatrix $A_{11}$ is of dimension $n$ and is upper triangular so its determinant, since $P(n)$ is true, is the product of its diagonal elements, $\det A_{11}=a_{22}\cdots a_{n+1,n+1}$\,.  Therefore $\det A=a_{11}a_{22}\cdots a_{n+1,n+1}$ and $P(n+1)$ is true.  By mathematical induction the theorem is therefore true for all $n$\,.}

Since an $n\times n$ identity matrix $I$ is diagonal with all main diagonal entries equal to one we have that the product of those entries is also one and we have the following result.

\textbf{Corollary:} If $I$ is an identity matrix, then $\boxed{\det I = 1}$\,.

\begin{example}
Compute the determinant of the given matrix.
\begin{enumerate}
    \item $A = \begin{bmatrix*}[r]
    -1&0&0\\0&3&0\\0&0&-2
    \end{bmatrix*}$ will have a $\det A = (-1)(3)(-2)=6$ as it is a diagonal matrix.

    \item $A = \begin{bmatrix*}[r]
    -1&0&0&0\\3&5&0&0\\2&1&8&0\\-1&1&3&2
    \end{bmatrix*}$ is lower triangular therefore $\det A = (-1)(5)(8)(2) = -80$
  \end{enumerate}
\end{example}

\subsection{Determinant of a Matrix Product}

Determinants have the following remarkable property.

\theorem{\label{thm:detproduct}Let $A$ and $B$ be $n\times n$ matrices then the determinant of their product is the product of their determinants.  In symbols,
\[\boxed{\detf{AB} = \detf{A}\detf{B}}\,.\]}

Note, however that the result is not true of the sum of two matrices.  In general
\[\det (A+B) \neq \det A + \det B\,.\]

\begin{example}
  Let $A=\begin{bmatrix*}[r]-1 & 2 \\ 3 & 1 \end{bmatrix*}$ and $B=\begin{bmatrix*}[r]1 & 4 \\ -2 & 1 \end{bmatrix*}$.  Find $\det A$, $\det B$, $\detf{AB}$ and $\detf{A+B}$\,.

  Solution:\\
  \begin{align*}\det A&=\begin{vmatrix*}[r]-1 & 2 \\ 3 & 1\end{vmatrix*}=-1-6=-7\\
  \det B&=\begin{vmatrix*}[r] 1 & 4 \\ -2 & 1 \end{vmatrix*}=1-(-8)=9\\
  \detf{AB}&=\begin{vmatrix*}[r] -5 & -2 \\ 1 & 13 \end{vmatrix*}=-65-(-2)=-63\\
  \detf{A+B}&=\begin{vmatrix*}[r] 0 & 6 \\ 1 & 2 \end{vmatrix*}=0-6=-6
  \end{align*}
  Note that $\detf{AB}=-63$ equals $(\det A)(\det B)=(-7)(9)=-63$ as predicted by Theorem~\ref{thm:detproduct}, but that $\detf{A+B}=-6$ does not equal $\det A+\det B=-7+9=2$\,.
\end{example}

For three square matrices of same order we have, by the determinant product theorem:
\[\detf{ABC}=\det[(AB)C]=\det(AB)\det(C)=\detf{A}\detf{B}\detf{C}\,.\]
In general we have the following for any finite number of such matrices.

\textbf{Corollary 1:} Let $A_1$,$A_2$,\ldots, $A_k$ be $k$ matrices of dimension $n\times n$.  Then
\[\boxed{\detf{A_1A_2\cdots A_k}=\detf{A_1}\detf{A_2}\cdots\detf{A_k}}\,.\]

Setting $A_i=A$ for all $i$ in the previous corollary gives the following for the determinant of a power of~$A$.

\textbf{Corollary 2:} Let $A$ be a square matrix and $k$ a positive integer. The determinant of the $k\textsuperscript{th}$ power of $A$ is the $k\textsuperscript{th}$ power of its determinant.  In symbols
\[\boxed{\detf{A^k}=(\det A)^k}\,.\]

We have seen that matrix multiplication does not, in general, commute so $AB\neq BA$\,.  However, because multiplication of numbers commutes and determinants are just numbers we have $\boxed{\detf{BA}=\detf{AB}}$ since
\[\detf{BA}=\detf{B}\detf{A}=\detf{A}\detf{B}=\detf{AB}\,.\]
Generalizing to the product of $k$ matrices gives the following final corollary.

\textbf{Corollary 3:} Let $A_1$,$A_2$,\ldots, $A_k$ be $k$ matrices of dimension $n\times n$. Then the determinant of the product $A_1A_2\cdots A_k$ equals the determinant of the product of the $k$ matrices evaluated in any order.

\subsection{Determinant of a Transpose}
\theorem{If $A$ is a square matrix then the determinant of its transpose equals the determinant of $A$,
\[\boxed{\detf{A^T} = \det A}\,.\]}

\textbf{Proof:}\\
Consider the case where $A$ is a $2\times2$ matrix.  Then
\[A=\begin{bmatrix}a_{11} a_{12} \\ a_{21} a_{22}\end{bmatrix}~~~\text{and therefore}~~~
A^T=\begin{bmatrix}a_{11} a_{21} \\ a_{12} a_{22}\end{bmatrix}\,.\]
By direct computation one has:
\[\det A=a_{11}a_{22}-a_{12}a_{21}=\detf{A^T}\,.\]
For $A$ of higher dimension one may proceed by induction by doing cofactor expansion along the first row of $A$ and the first column of $A^T$\,.  The submatrices generated will be the transposes of each other and of smaller dimension than $A$ so their determinants will be equal by assumption of the truth of the $n\textsuperscript{th}$ step.

\subsection{Determinants of Orthogonal Matrices}
Orthogonal matrices have some unique properties that distinguish them from other square matrices, one particular property is related to their determinants.
\theorem{If $A$ is an orthogonal matrix then $\boxed{\detf{A}=1\ \text{or}\ \detf{A}=-1}$\,.}

\textbf{Proof:}\\[.5em]
Using that $A^{-1}=A^T$ for an orthogonal matrix we have:
\[1=\detf{I}=\detf{A^{-1}A}=\detf{A^TA}=\detf{A^T}\detf{A}=\detf{A}\detf{A}=[\detf{A}]^2\,.\]
Since $1=(\det A)^2$ the result follows.

\subsection{Determinants of Elementary Matrices}
We have seen that an invertible matrix can be decomposed into a product of elementary matrices.  Since the determinant of such a product is just the product of the determinants, knowledge of the determinants of elementary matrices will be useful.

\begin{example}
Find the determinant of the given elementary matrix.
\begin{enumerate}

\item $E = \begin{bmatrix}
    1&0&0&0\\0&7&0&0\\0&0&1&0\\0&0&0&1
    \end{bmatrix}$\\

The matrix is diagonal with determinant $\det E = E_{22}(7) = (1)(7)(1)(1)=7$

    \item $E = \begin{bmatrix}
    1&0&0\\3&1&0\\0&0&1
    \end{bmatrix}$\\

The matrix is lower diagonal with 1's along the main diagonal, therefore\\ $\det E = E_{21}(3) = (1)(1)(1)=1$\,.

\item $E = \begin{bmatrix}
    1&0&0\\0&0&1\\0&1&0
    \end{bmatrix}$\\
    
Expanding along the first row gives $\det E =\det P_{23}=(1)(+1)\begin{vmatrix}\,0 \,1 \\ 1 \,0\end{vmatrix}=1(0-1)=-1$

  \end{enumerate}
\end{example}

The results of the previous example may be generalized to arbitrary elementary matrix examples of the three types as given in the following theorem.

\theorem{\label{thm:elementarydeterminants}Let $E$ be an elementary matrix.
\begin{enumerate}
\item If $E$ results from  multiplying a row by a nonzero scalar $c$ then $\det E=\det E_{ii}(c) = c$\,.
\item If $E$ results from the addition of a multiple of one row to a different row then \mbox{$\det E=\det E_{ij}(c) = 1$}\,.
\item If $E$ results from interchanging two rows then $\det E=\det P_{ij}=-1$\,.
\end{enumerate}}

\begin{example}
In Example~\ref{example:elementarydecomposition} we found the decomposition
\[A = \begin{bmatrix*}[r]
    0&1&-2\\1&0&4\\0&0&3
  \end{bmatrix*}=(P_{12})^{-1}(E_{33}(1/3))^{-1}(E_{13}(-4))^{-1}(E_{23}(2))^{-1}= P_{12}E_{33}(3)E_{13}(4)E_{23}(-2)\,.\]
  It follows that
  \[\det A=\det P_{12}\det E_{33}(3)\det E_{13}(4)\det E_{23}(-2)=(-1)(3)(1)(1)=-3\,.\]
\end{example}
Note that, as this last example recalls, we must invert the matrices that implement the row reduction to find the decomposition of $A$\,.  From Theorem~\ref{thm:elementaryinverse} and the last theorem it follows that $\detf{E^{-1}}=1/\det{E}$\,. (We will see shortly this is true of any invertible matrix.)  As such the determinant of $A$ is the product of the reciprocals of the determinants of the elementary matrices that implement the actual row reduction, or, more simply, the reciprocal of the product of those determinants.

\subsection{Effect of Row Operations on Determinants}
In evaluating determinants we have seen the value of doing cofactor expansion along a row or column dominated by zeros.  We have seen previously how Gauss-Jordan elimination was able to produce zeros in a matrix.  We now explore what effect an elementary row operation has on the determinant of a matrix, with an eye to using such knowledge to simplify determinant calculations.  Since row operations can be implemented by elementary matrices, knowledge of their determinants yields the following useful theorem.

\theorem{ (\textbf{Effect of Row/Column Operations on Determinants})\\[.5em]
Let $A$ be a square matrix.
\begin{enumerate} 
\item If one row (column) of $A$ is multiplied by a nonzero scalar $c$ then the determinant changes by a factor of $c$.
\item If a scalar multiple of one row (column) is added to another row (column), then the determinant is unchanged.
\item If two rows (columns) of $A$ are interchanged, then the determinant changes by a factor of $-1$.
\end{enumerate}}

\textbf{Proof:}\\
Suppose matrix $A'$ is created by such a row operation on matrix $A$.  Then there exists an elementary matrix $E$ such that $A'=EA$.  Then $\det A'=\detf{EA}=\detf{E}\detf{A}$ and the stated result follows from Theorem~\ref{thm:elementarydeterminants} by consideration of the type of row operation. Next suppose $A'$ is created by such an operation on a column of $A$.  Then said operation can be represented by a row operation on the transpose of $A$ so that $A'=(EA^T)^T$\,.  Then $\det A'=\det\left((EA^T)^T\right)=\detf{EA^T}=\detf{E}\detf{A^T}=\det E\det A$\, and the result follows again from Theorem~\ref{thm:elementarydeterminants}\,.

The theorem has some useful corollaries.

\textbf{Corollary 1:} If $A$ is an $n\times n$ matrix and $c$ is a scalar, then $\boxed{\detf{cA} = c^n\det A}$\,.

This follows by 1. since multiplying $A$ by $c$ is equivalent to multiplying each of the $n$ rows by $c$\,.

\textbf{Corollary 2:} If square matrix $A$ has a row (column)  that is a scalar multiple of another row (column) then $\det A = 0$\,.

This follows by 2. since if $c$ is the scalar multiple then one can add $-c$ of the one row (column) to the second to produce a new matrix with a row (column) of all zeros and the same determinant as the original matrix.

\textbf{Corollary 3:} If square matrix $A$ has two equal rows (columns) then $\det A=0$\,.

This follows by 3. for if we switch the identical rows (columns) then the determinant of the new matrix equals the negative of the determinant of the original matrix.  However the new matrix is just the original matrix, so $\det A=-\det A$ which implies $\det A=0$\,.  This corollary also follows as a special case of Corollary~2 with scalar equal to one.

We can now use these procedures to simplify the calculation of the determinant as illustrated in the following examples.

\begin{example}
  Compute the determinant of the given matrix.
\begin{enumerate}
    \item $A = \begin{bmatrix*}[r]
    -1&0&4&0\\0&1&3&1\\2&2&0&2\\-3&1&1&1
    \end{bmatrix*}$\\[1em]

      Solution:\\
      $\det A = 0$ since $A$ has two identical columns.

    \item $A = \begin{bmatrix*}[r]
      3&-2&-1\\-6&-4&2\\-3&-2&4
    \end{bmatrix*}$\\[1em]

      Solution:\\
      We perform the following row operations to simplify the matrix and consider the effect on the determinant.
      
    $\rowop{R_2}{R_2 + 2R_1} $ (does not change determinant)\\
    $\rowop{R_3}{R_3 + R_1}$~~\,(no change)
    \[\det A = \begin{vmatrix*}[r]
    3&-2&-1\\0&-8&0\\0&-4&3
    \end{vmatrix*}\hspace{3.5em}\]

    $\rowswap{R_2}{R_3}$ (new determinant differs by minus sign so introduce one to preserve equality)
    \[=-\begin{vmatrix*}[r]
    3&-2&-1\\0&-4&3\\0&-8&0
    \end{vmatrix*}\]

    $\rowop{R_3}{R_3-2R_2}$ (no change)
    \[=-\begin{vmatrix*}[r]
    3&-2&-1\\0&-4&3\\0&0&-6
    \end{vmatrix*}\]
    Matrix is now upper diagonal so $\det A=-(3)(-4)(-6)=-72$\,.

    \item $A = \begin{bmatrix*}[r]
    2&3&1&-3\\3&0&-1&4\\-1&0&1&-2\\13&13&0&-13
    \end{bmatrix*}$\\[1em]

      Solution:\\
$\rowop{R_4}{\frac{1}{13}R_4}$

Note here that multiplying row 4 by $c=1/13$ multiplies the original determinant by $1/13$ so we must multiply by $1/c=13$ to compensate this.  Effectively this looks like ``factoring out 13'' from the row. 
    \[\det A = 13\begin{vmatrix*}[r]
    2&3&1&-3\\3&0&-1&4\\-1&0&1&-2\\1&1&0&-1
    \end{vmatrix*}\hspace{3.5em}\]
    
$\rowop{R_1}{R_1 - 3R_4}$
    \[= \begin{vmatrix*}[r]
    -1&0&1&0\\3&0&-1&4\\-1&0&1&-2\\1&1&0&-1
    \end{vmatrix*}\]
Expanding along the second column:\\
    \[= 13(1)(+1)\begin{vmatrix*}[r]
    -1&1&0\\3&-1&4\\-1&1&-2
    \end{vmatrix*}\]
    $\rowop{R_2}{R_2 + 2R_3}$
    \[=13\begin{vmatrix*}[r]
    -1&1&0\\1&1&0\\-1&1&-2
    \end{vmatrix*}\]
Expand along the last column:\\
       \[=13(-2)(+1)\begin{vmatrix*}[r]-1&1\\1&1
       \end{vmatrix*}\]
         \[=-26(-1-1)=52\]

\item $A = \begin{bmatrix*}[r]
0&1&2&0\\4&0&1&0\\0&3&2&1\\-2&0&1&3
\end{bmatrix*}$\\[1em]

Solution:\\
We will find the determinant by placing the matrix in upper diagonal form.\\
$\rowswap{R_1}{R_4}$
\[\det A = -\begin{vmatrix*}[r]
-2&0&1&3\\4&0&1&0\\0&3&2&1\\0&1&2&0
\end{vmatrix*}\hspace{3em}\]
$\rowop{R_2}{R_2+2R_1}$
\[= -\begin{vmatrix*}[r]
-2&0&1&3\\0&0&3&6\\0&3&2&1\\0&1&2&0
\end{vmatrix*}\]
$\rowswap{R_2}{R_4}$
\[= \begin{vmatrix*}[r]
-2&0&1&3\\0&1&2&0\\0&3&2&1\\0&0&3&6
\end{vmatrix*}\]
$\rowop{R_3}{R_3-3R_2}$
\[= \begin{vmatrix*}[r]
-2&0&1&3\\0&1&2&0\\0&0&-4&1\\0&0&3&6
\end{vmatrix*}\]
$\rowop{R_4}{\frac{1}{3}R_4}$
\[= 3\begin{vmatrix*}[r]
-2&0&1&3\\0&1&2&0\\0&0&-4&1\\0&0&1&2
\end{vmatrix*}\]
$\rowswap{R_3}{R_4}$
\[= -3\begin{vmatrix*}[r]
-2&0&1&3\\0&1&2&0\\0&0&1&2\\0&0&-4&1
\end{vmatrix*}\]
$\rowop{R_4}{R_4+4R_3}$
\[\hspace{12em}= -3\begin{vmatrix*}[r]
-2&0&1&3\\0&1&2&0\\0&0&1&2\\0&0&0&9
\end{vmatrix*}~~~\Leftarrow\text{Upper Diagonal Matrix}\]
\[~~=-3(-2)(1)(1)(9)=54\]
\end{enumerate}
\end{example}

\section{Adjugate of a Matrix}
For any $n\times n$ matrix $A$, recall the $i,j$-cofactor of $A$, denoted by $c_{ij}$ is given by:
\[c_{ij} = (-1)^{i+j}m_{ij} = (-1)^{i+j} \det A_{ij}\]
Then $A$ has the cofactor matrix $C=[c_{ij}]$:
\[C = \begin{bmatrix}
c_{11}&c_{12}&\ldots&c_{1n}\\c_{21}&c_{22}&\ldots&c_{2n}\\\vdots&\vdots&&\vdots\\c_{n1}&c_{n2}&\ldots&c_{nn}
\end{bmatrix}\,.\]

\definition{If $A$ is an $n\times n$ matrix, then the \textbf{adjugate} of $A$ denoted by $\adj A$ is the transpose of the cofactor matrix of $A$.
\[\adj A = C^T = \begin{bmatrix}
c_{11}&c_{21}&\ldots&c_{n1}\\c_{12}&c_{22}&\ldots &c_{n2}\\ \vdots &\vdots & & \vdots \\c_{1n}&c_{2n}&\ldots&c_{nn}
\end{bmatrix}\]}
The adjugate is also known as the \textbf{adjunct} or the \textbf{classical adjoint} however the word adjoint finds different usage in linear algebra and, as such, should be avoided.

\begin{example} \label{example:adjugate}
  Find the adjugate of $A$ if $A = \begin{bmatrix*}[r]
  2&-3&1\\4&0&-2\\3&-1&-3
  \end{bmatrix*}$\,.

Solution:\\
Recall from Example~\ref{example:cofactor} we found the cofactor matrix to be
\[C=\left[\begin{array}{lll}
          +\begin{vmatrix*}[r]
          0&-2\\-1&-3
          \end{vmatrix*}
          &-\begin{vmatrix*}[r]
          4&-2\\3&-3
          \end{vmatrix*}
          &+\begin{vmatrix*}[r]
          4&0\\3&-1
          \end{vmatrix*}\\[1.5em]
          -\begin{vmatrix*}[r]
          -3&1\\-1&-3
          \end{vmatrix*}
          &+\begin{vmatrix*}[r]
          2&1\\3&-3
          \end{vmatrix*}
          &-\begin{vmatrix*}[r]
          2&-3\\3&-1
          \end{vmatrix*}\\[1.5em]
          +\begin{vmatrix*}[r]
          -3&1\\0&-2
          \end{vmatrix*}
          &-\begin{vmatrix*}[r]
          2&1\\4&-2
          \end{vmatrix*}
          &+\begin{vmatrix*}[r]
          2&-3\\4&0
          \end{vmatrix*}
          \end{array}\right]
          = \begin{bmatrix*}[r]
          -2&6&-4\\-10&-9&-7\\6&8&12
          \end{bmatrix*}\]

Therefore, taking the transpose, one has
\[\adj A = C^T = \begin{bmatrix*}[r]
  -2&-10&6\\6&-9&8\\-4&-7&12
  \end{bmatrix*}\]
\end{example}

The adjugate of a matrix has the following important property.
\theorem{\label{thm:adjugate}If $A$ is an $n\times n$ matrix, then:
\[\boxed{A(\adj A) = (\adj  A)A = (\det A)I}\,,\]
where $I$ is the $n\times n$ identity matrix.}

\textbf{Proof:}\\
To show $A(\adj A)=(\det A) I$ we note that the latter matrix is just the diagonal matrix with $\det A$ along the diagonal.  The $i\textsuperscript{th}$ diagonal entry of the product $A(\adj A)$ involves the $i\textsuperscript{th}$ row of $A$ and the $i\textsuperscript{th}$ column of $\adj A$.  But, since $\adj A=C^T$ this is just the $i\textsuperscript{th}$ row of $C$ and we have\footnote{Here we have introduced, for convenience, notation for the $i$-$j$\textsuperscript{th} entry in a matrix, namely $[A]_{ij}=a_{ij}$.}
\[[A(\adj A)]_{ii}=a_{i1}c_{i1}+a_{i2}c_{i2}+\ldots+a_{in}c_{in}\,,\]
which we recognize to be $\det A$ evaluated along the $i\textsuperscript{th}$ row of $A$.  For an off-diagonal entry of the product, $i\neq j$, one would get
\[[A(\adj A)]_{ij}=a_{i1}c_{j1}+a_{i2}c_{j2}+\ldots+a_{in}c_{jn}\,.\]
One observes that none of the cofactors on the right hand side involve the $j\textsuperscript{th}$ row of $A$ since we delete the row and column when working out the cofactor and all the entries are in the $j\textsuperscript{th}$ row.  The entries $a_{i1}$ to $a_{in}$ which multiply the cofactors all sit in a row different from the $j\textsuperscript{th}$ by assumption as well.  Consider then, a new matrix $B$ that is identical to $A$ except in the $j\textsuperscript{th}$ row which is just made to be a copy of $A$'s $i\textsuperscript{th}$ row. Then since $B$ has two rows equal we have $\det B=0$. However cofactor expanding along the $j\textsuperscript{th}$ row of $B$ gives
\[b_{j1}c_{j1}+b_{j2}c_{j2}+\ldots+b_{jn}c_{jn}=\det B=0\,,\]
where the cofactor entries are identical to those of $A$ by construction.  However since the $j\textsuperscript{th}$ row of $B$ equals the $i\textsuperscript{th}$ row  of $A$ we then have
\[a_{i1}c_{j1}+a_{i2}c_{j2}+\ldots+a_{in}c_{jn}=0\,\]
thereby proving $[A(\adj A)]_{ij}=0$ for $i\neq j$, thereby completing the proof.  Similarly one may argue $(\adj  A)A=(\det A)I$\, by considering determinant column cofactor expansions.


\theorem{\label{thm:adjinverse}If $A$ is a square matrix with $\det A \neq 0$, then $A$ is invertible with
\[\boxed{A^{-1} = \frac{1}{\det A}(\adj A)}\,.\]}

\textbf{Proof:}\\
Let $A$ be square with $\det A\neq0$\,. From Theorem~\ref{thm:adjugate} we have 
\[A(\adj A) = (\adj  A)A = (\det A)I\,.\]
Since $\det A\neq 0$ multiply each term by scalar $1/\det A$ to get
\[\frac{1}{\det A}\left[A(\adj A)\right] =\frac{1}{\det A}\left[(\adj  A)A\right] =\frac{1}{\det A}\left[(\det A)I\right]\,.\]
Using the properties of scalar multiplication we have
\[A\left[\frac{1}{\det A}(\adj A)\right]=\left[\frac{1}{\det A}(\adj  A)\right]A=\left[\frac{1}{\det A}(\det A)\right]I\,.\]
Since the last term simplifies to $I$ we have $\displaystyle A^{-1} = \frac{1}{\det A}(\adj A)$ by definition of the inverse.

\begin{example}
  Find the inverse of $A = \begin{bmatrix*}[r]
  2&-3&1\\4&0&-2\\3&-1&-3
  \end{bmatrix*}$ using the adjugate.

Solution:\\
Evaluating the determinant of $A$ along the second column of $A$ gives
\begin{align*}\det A & = -3(-1)\begin{vmatrix*}[r]
  4&-2\\3&-3
  \end{vmatrix*}  +0 + (-1)(-1)\begin{vmatrix*}[r]
  2&1\\4&-2
  \end{vmatrix*} \\
  & = 3(-12+6)] + 1(-4-4)\\
  & = -18 -8 \\
  & = -26
  \end{align*}
  which is nonzero so the inverse exists. From Example~\ref{example:adjugate} we found 
\[\adj A = \begin{bmatrix*}[r]
  -2&-10&6\\6&-9&8\\-4&-7&12
  \end{bmatrix*}\]
  Therefore
  \[A^{-1} = \frac{1}{\det A}(\adj A)= - \frac{1}{26}\begin{bmatrix*}[r]
  -2&-10&6\\6&-9&8\\-4&-7&12
  \end{bmatrix*}\,.\]
\end{example}

\begin{example}
  Find the inverse of $A = \begin{bmatrix*}[r]
  3&2&-1\\1&6&3\\2&-4&0
  \end{bmatrix*}$ using the adjugate.

Solution:\\
  Evaluating the determinant with cofactor expansion along the third row gives
  \begin{align*}
  \det A &= 2(+1)\begin{vmatrix*}[r]
  2&-1\\6&3
  \end{vmatrix*} + 0+ 4(+1)\begin{vmatrix*}[r]
  3&-1\\1&3
  \end{vmatrix*}\\
  &= 2(6+6) + 4(9+1)\\
  &= 24+40\\
  & =64\end{align*}
  which is nonzero so $A^{-1}$ exists with
  \begin{align*}
  A^{-1}&=\frac{1}{\det A}\adj A=\frac{1}{\det A} C^T \\[.5em]
  &=\frac{1}{64}\left[\begin{array}{lll}
          +\begin{vmatrix*}[r]
          6&3\\-4&0
          \end{vmatrix*}
          &-\begin{vmatrix*}[r]
          1&3\\2&0
          \end{vmatrix*}
          &+\begin{vmatrix*}[r]
          1&6\\2&-4
          \end{vmatrix*}\\[1.5em]
          -\begin{vmatrix*}[r]
          2&-1\\-4&0
          \end{vmatrix*}
          &+\begin{vmatrix*}[r]
          3&-1\\2&0
          \end{vmatrix*}
          &-\begin{vmatrix*}[r]
          3&2\\2&-4
          \end{vmatrix*}\\[1.5em]
          +\begin{vmatrix*}[r]
          2&-1\\6&3
          \end{vmatrix*}
          &-\begin{vmatrix*}[r]
          3&-1\\1&3
          \end{vmatrix*}
          &+\begin{vmatrix*}[r]
          3&2\\1&6
          \end{vmatrix*}
          \end{array}\right]^T\\[.5em]
          &= \frac{1}{64}\begin{bmatrix*}[r]
          12&6&-16\\4&2&16\\12&-10&16
          \end{bmatrix*}^T %\\[.5em]
          =\frac{1}{64}\begin{bmatrix*}[r]
          12&4&12\\6&2&-10\\-16&16&16
          \end{bmatrix*}
          =\frac{1}{32}\begin{bmatrix*}[r]
          6&2&6\\3&1&-5\\-8&8&8
          \end{bmatrix*}
          \end{align*}
\end{example}

\begin{example}
Find the inverse of the $2\times2$ matrix $A=\begin{bmatrix*}[r] a & b \\ c & d \end{bmatrix*}$ using the adjugate.

Solution:
Assuming $\det A=ad-bc\neq 0$ the inverse is
\[A^{-1}=\frac{1}{\det A}\adj A=\frac{1}{\det A}C^T=\frac{1}{ad-bc}\begin{bmatrix*}[r] (+1)d & (-1)c \\ (-1)b & (+1)a \end{bmatrix*}^T=\frac{1}{ad-bc}\begin{bmatrix*}[r] d & -b \\ -c &a \end{bmatrix*}\,\]
as we found before.
\end{example}

The converse of Theorem~\ref{thm:adjinverse} also holds with the result:

\theorem{\label{thm:squareinvertible}A square matrix $A$ is invertible if and only if $\det A \neq 0$\,. If $A$ is invertible then
\[\boxed{\det(A^{-1})=\frac{1}{\det A}=(\det A)^{-1}}\,.\]}

\textbf{Proof:}\\
By Theorem~\ref{thm:adjinverse} $\det A\neq 0$ implies $A$ is invertible.  For the converse let $A$ be an invertible matrix.  Then there exists $A^{-1}$ satisfying
\[A A^{-1}=I\,.\]
Taking the determinant of both sides gives
\[\det(A A^{-1})=\det I\,.\]
But the determinant of a product is the product of the determinants and the determinant of an identity matrix is one, therefore:
\[(\det A)\detf{A^{-1}}=1\,.\]
If $\det A=0$ we have a contradiction to the last statement as the left hand side would be zero.  Therefore $\det A\neq 0$\,. In this case we can divide both sides of the last equation by $\det A$ to get $\displaystyle\detf{A^{-1}}=\frac{1}{\det A}$\,.

\begin{example}
  Determine whether the given matrix is invertible.
  \begin{enumerate}
    \item $A = \begin{bmatrix*}[r]
    2&1\\3&-1
    \end{bmatrix*}$\\[.2em]

Solution:\\
$\det A =-2-3=-5\neq 0$ therefore $A$ is invertible.

    \item $A = \begin{bmatrix}
    2&6\\1&3
    \end{bmatrix}$\\[.2em]

Solution:\\
$\det A = 6 - 6 = 0$ therefore $A$ is noninvertible.

\item $A = \begin{bmatrix*}[r]
    -1&1&-2\\0&1&-3\\1&1&-2
    \end{bmatrix*}$\\[.2em]

Solution:\\
Using the Rule of Sarrus,
\vspace{-.5em}
\begin{center}
\begin{tikzpicture}
\matrix[matrix of math nodes,inner sep=1pt,row sep=1em,column sep=1em] (M)
{
    -1 & 1 & -2  & -1 & 1 \\
    ~~0 & 1 & -3  & ~~0 & 1 \\
    ~~1 & 1 & -2  & ~~1 & 1 \\
}
;
\draw[red,->] (M-1-1.north west) -- (M-3-3.south east);
\draw[red,->] (M-1-2.north west) -- (M-3-4.south east);
\draw[red,->] (M-1-3.north west) -- (M-3-5.south east);
\draw[blue,->] (M-1-3.north east) -- (M-3-1.south west);
\draw[blue,->] (M-1-4.north east) -- (M-3-2.south west);
\draw[blue,->] (M-1-5.north east) -- (M-3-3.south west);
\draw[black] (M-1-1.north west) -- (M-3-1.south west);
\draw[black] (M-1-3.north east) -- (M-3-3.south east);
\end{tikzpicture}
\end{center}
\vspace{-1em}
\begin{align*}
\det A&=(-1)(1)(-2)+(1)(-3)(1) + \cancel{(-2)(0)(1)} -(-2)(1)(1) -(-1)(-3)(1) - \cancel{(1)(0)(-2)}\\
&= 2-3+2-3\\
&= -2\,,
\end{align*}
which is nonzero therefore $A$ is invertible.
  \end{enumerate}
  \textbook{\vspace{-.5em}}
\end{example}

\begin{example}
  Find the values of $m$ so that the given matrix is invertible.
  \[A = \begin{bmatrix*}[r]
  2&-3&m\\2&0&-2\\3&-m&-3
  \end{bmatrix*}\]
  \textbook{\vspace{-2em}}

Solution:\\
  $A$ is invertible if and only if $\det A \neq 0$\,. Evaluating $\det A$ along the second row we have
  \begin{align*}
  \det A &= \begin{vmatrix*}[r]
  2&-3&m\\2&0&-2\\3&-m&-3
  \end{vmatrix*}\\
  &=2(-1)\begin{vmatrix*}[r]
  -3&m\\-m&-3
  \end{vmatrix*} + 0 + (-2)(-1)\begin{vmatrix*}[r]
  2&-3\\3&-m
  \end{vmatrix*}\\
  &=-2(9+m^2)+2(-2m+9)\\
  & =-18-2m^2-4m+18\\
  & =-2m(m+2)
  \end{align*}
  Then $\det A=0$ implies $m=0$ or $m=-2$.  Therefore $A$ is invertible ($\det A\neq 0$) if $m\neq 0$ and $m\neq-2$\,.
  \end{example}

The adjugate of a matrix is itself a matrix with determinant and potentially an inverse.  This is explored in the following theorems.

\theorem{Let $A$ be an $n\times n$ matrix with $n>1$, then:
\[\boxed{\det(\adj A) = (\det A)^{n-1}}\,.\]}

\textbf{Proof:}\\
By Theorem~\ref{thm:adjugate}
\[(\adj A)A = (\det A)(I)\,.\]
Taking the determinant of both sides gives
\[\det[(\adj A)(A)] = \det[(\det A)(I)]\,.\]
Since $\det(AB) = \det A \det B$, $\det(cA)=c^n\det A$, and $\det I=1$  we have
\[\det(\adj A)\det A = (\det A)^n\det I=(\det A)^n\,.\]
Case I: $\det A\neq 0$. Dividing through the previous equation by $\det A$ gives \[\det (\adj A) = \frac{(\det A)^n}{\det A}= (\det A)^{n-1}\,,\]
and the theorem holds.

Case II: $\det A=0$.  Then $0^{n-1}=0$ so we need to prove $\det(\adj A)=0$.  We will use proof by contradiction by supposing $\det(\adj A)\neq 0$.  Then $(\adj A)A = (\det A)(I)$ implies
\[(\adj A)A=0\,.\]
Since $\det(\adj A)\neq 0$ Theorem~\ref{thm:adjinverse} implies the matrix $\adj A$ itself is invertible with inverse $(\adj A)^{-1}$.  Left-multiplying both sides of $(\adj A)A=0$ by this inverse implies $A=0$\,.  Then $\adj A=C^T=0$ since all the cofactors of $A$ vanish if $A=0$\,.  But then $\adj A=0$ implies $\det(\adj A)=0$ and we have a contradiction to the original supposition.  Hence the opposite of the supposition must be true and $\det(\adj A)=0$\,.

\theorem{If $A$ is an $n\times n$ invertible matrix, then $\adj A$ is invertible with
\[\boxed{(\adj A)^{-1} = \frac{1}{\det A}A}\,.\]}

\textbf{Proof:}\\
Let $A$ be an $n\times n$ invertible matrix.  Then $\det A\neq0$ by Theorem~\ref{thm:squareinvertible}. From Theorem~\ref{thm:adjugate} we have 
\[A(\adj A) = (\adj  A)A = (\det A)I\,.\]
Since $\det A\neq 0$ multiply each term by scalar $1/\det A$ to get
\[\frac{1}{\det A}\left[A(\adj A)\right] =\frac{1}{\det A}\left[(\adj  A)A\right] =\frac{1}{\det A}\left[(\det A)I\right]\,.\]
Using the properties of scalar multiplication we have
\[\left[\frac{1}{\det A}A\right](\adj A)=(\adj  A)\left[\frac{1}{\det A}A\right]=\left[\frac{1}{\det A}(\det A)\right]I\,.\]
Since the last term simplifies to $I$ we have $\displaystyle(\adj A)^{-1} = \frac{1}{\det A}A$ by definition of the inverse.

\begin{example}
Find the determinant and inverse of the cofactor matrix $C$ of matrix $A$\,.

Solution:\\
Since $\adj A=C^T$ we have (taking the transpose of both sides) $C=(\adj A)^T$, therefore
\[\det C=\det\left[(\adj A)^T\right]=\detf{\adj A}=(\det A)^{n-1}\,.\]
Also since the transpose is invertible if and only if the original matrix is and $\adj A$ is invertible if $A$ is, then $C$ is invertible when $A$ is invertible and
\[C^{-1}=\left[(\adj A)^T\right]^{-1}=\left[(\adj A)^{-1}\right]^T=\left[\frac{1}{\det A}A\right]^T=\frac{1}{\det A}A^T\,.\]
\end{example}

\section{Summary of Properties of Determinants}
Let $A$ and $B$ be $n\times n$ matrices and let $c$ be a scalar, then:
\begin{enumerate}
  \item $\detf{AB} = (\det A)(\det B)$ \hfill (generalizable to product of $k$ matrices)
  \item $\detf{AB} = \detf{BA}$ \hfill (generalizable to permutation of $k$ matrices)
  \item $\detf{A^k}=(\det A)^k$
  \item $\detf{A^T} = \det A$
  \item $\detf{cA} = c^n\det A$
  \item $\displaystyle\detf{A^{-1}} = \frac{1}{\det A}=(\det A)^{-1}$
  \item $\detf{\adj A} = (\det A)^{n-1}$
\end{enumerate}

Also we have the two important inverse relations $\displaystyle A^{-1} = \frac{1}{\det A}(\adj A)$ and $\displaystyle (\adj A)^{-1} = \frac{1}{\det A}A$\,.

More abstract problems involving matrix determinants may be simplified using these determinant properties.

\begin{example}
Let $A$ and $B$ be $3\times 3$ invertible matrices such that $\det A = 2$ and $\det B = -1$\,.\\
Compute \begin{inparaenum} \item $\detf{AB^T}$ \item $\detf{2ABA^T}$ \item $\det\left[-(\adj A)^2 B^4\right]$ \item $\detf{B^{-1}A^{-1}BA^3B^{-1}}$\end{inparaenum}\,.

Solution:
\begin{enumerate}
    \item $\detf{AB^T} = (\det A)(\det B^T) = (\det A)(\det B) = (2)(-1) = -2$
    \item $\detf{2ABA^T} = 2^3(\det A)(\det B)(\det A^T) = 8(2)(-1)(2) = -32$
    \item $\det\left[-(\adj A)^2 B^4\right] = (-1)^3[\det(\adj A)]^2(\det B)^4 = -(2^{3-1})^2(-1)^4 = -16$
    \item\label{itm:detsimp} $\displaystyle\detf{B^{-1}A^{-1}BA^3B^{-1}}=\detf{A^{-1}AA^2B^{-1}BB^{-1}}=\detf{IA^2B^{-1}I}=(\det A)^2(\det B)^{-1}$\\
    $\displaystyle=2^2\frac{1}{(-1)}=-4$
  \end{enumerate}
  Note in question \ref*{itm:detsimp}. how effectively one could just add the exponents of the matrices, treating the inverses as exponents of -1, to get the simplified answer.
\end{example}

\begin{example}
If $\det\begin{bmatrix}a & b \\ c & d \end{bmatrix}=3$, compute $\det\left(\frac{1}{2}A^{-1}\right)$ if $A=\begin{bmatrix}a-b & 5b \\ c-d & 5d\end{bmatrix}$\,.

Solution:\\
We have $\displaystyle \det\left(\frac{1}{2}A^{-1}\right)=\left(\frac{1}{2}\right)^2\detf{A^{-1}}=\frac{1}{4\det A}$ so we need to evaluate $\det A$.\\[.5em]
$\det A=\begin{vmatrix}a-b & 5b \\ c-d & 5d\end{vmatrix}$\\[.5em]

Do the following column operations:\\
$\rowop{C_2}{\frac{1}{5}C_2}$\\[.5em]
$\det A=5\begin{vmatrix}a-b & b \\ c-d & d\end{vmatrix}$\\[.5em]
$\rowop{C_1}{C_1+C_2}$\\[.5em]
$\det A=5\begin{vmatrix}a& b \\ c & d\end{vmatrix}=(5)(3)=15$\\[.5em]
Therefore
\[ \det\left(\frac{1}{2}A^{-1}\right)=\frac{1}{4\det A}=\frac{1}{(4)(15)}=\frac{1}{60}\,.\]
\end{example}

\subsection{Determinants and Linear Systems}
We have seen that in determined linear systems for which the number of unknowns equals the number of equations results in a square coefficient matrix $A$.  Such matrices have determinants and, as such, our knowledge of determinants can directly inform this restricted class of linear systems.  Despite this limitation to linear systems of $n$ equations in $n$ unknowns, it should be noted that many applications naturally result in such systems.

Since matrix $A$ is invertible if and only if its determinant is nonzero we have the following result regarding linear systems which follows from Theorem~\ref{thm:invertibleequivalents}.

\theorem{Let $A$ be a square matrix. Then the determined linear system $A\bm{x}=\bm{b}$ has a unique solution if and only if $\det A \neq 0$\,.}

\begin{example}
  For what values of $m$ does the following linear system have:
  \begin{enumerate}
    \item A unique solution?
    \item No solution?
    \item Infinitely many solutions?
  \end{enumerate}
  \begin{align*}
    x-my+4z &= 2\\
    mx-2m^2y + (2m^3+4m)z &= 2m\\
    -2x + (1+2m)y - 9z &= -3
  \end{align*}

Solution:\\
The coefficient matrix is
$A = \begin{bmatrix}
1 & -m & 4 \\ m & -2m^2 & 2m^3 + 4m \\ -2 & 1+2m & -9
\end{bmatrix}\,.$

Expanding the determinant along the first row gives:
\begin{align*}
\det A & = (1)(+1)\begin{vmatrix}
-2m^2 & 2m^2 + 4m\\ 1+2m & -9
\end{vmatrix} + (-m)(-1)\begin{vmatrix}
m & 2m^3+4m\\-2&-9
\end{vmatrix} + 4(+1)\begin{vmatrix}
m&-2m^2\\-2& 1 + 2m
\end{vmatrix}\\
&= 18m^2 - (2m^3 + 4m)(1+2m) + m[-9m+2(2m^3+4m)] + 4[m(1+2m)-4m^2]\\
&= 18m^2 -2m^3-4m^4-4m-8m^2-9m^2+4m^4+8m^2+4m+8m^2-16m^2\\
&= -2m^3 + m^2
\end{align*}
Then $0=\det A=-2m^3+m^2=m^2(-2m+1)$ if and only if $m=0$ or $m=1/2$.

Since a unique solution occurs when $\det A\neq 0$ this is when $m\neq 0$ and $m\neq 1/2$\,.

When $m=0$ the augmented matrix for the system is
\[[A|B] = \begin{bmatrix}[rrr|r]
1&0&4&2\\0&0&0&0\\-2&1&-9&-3
\end{bmatrix}\hspace{7em}\]
\[\Downarrow\hspace{7em}\]
\begin{flalign*}&\rowopmatrix[15em]{ \\ \rowswap{R_2}{R_3} \\ }{\begin{bmatrix}[rrr|r]
1&0&4&2\\-2&1&-9&-3\\0&0&0&0
  \end{bmatrix}}&\end{flalign*}
\[\Downarrow\hspace{7em}\]
\begin{flalign*}&\rowopmatrix[15em]{ \\ \rowop{R_2}{R_2 + 2R_1} \\}{\begin{bmatrix}[rrr|r]
1&0&4&2\\0&1&-1&1\\0&0&0&0
\end{bmatrix}}&\end{flalign*}
Then $\rank{A}=\rank{[A|B]}=2$ is less than the number of unknowns (3).
Therefore $m = 0$ gives infinitely many solutions.

When $m=1/2$ the augmented matrix for the system is
\[[A|B] = \begin{bmatrix}[rrr|r]1&-\frac{1}{2}&4&2\\[.2em]\frac{1}{2}&-\frac{1}{2} & \frac{9}{4} & 1\\[.2em] -2&2&-9&-3
\end{bmatrix}\hspace{7em}\]
\[\Downarrow\hspace{7em}\]
\begin{flalign*}&\rowopmatrix[15em]{ \rowop{R_1}{2R_1} \\ \rowop{R_2}{4R_2} \\ }{\begin{bmatrix}[rrr|r]2&-1&8&4\\2&-2&9&4\\-2&2&-9&-3
\end{bmatrix}}&\end{flalign*}
\[\Downarrow\hspace{7em}\]
\begin{flalign*}&\rowopmatrix[15em]{ \\ \rowop{R_2}{R_2-R_1} \\ \rowop{R_3}{R_3+R_1}}{\begin{bmatrix}[rrr|r]2&-1&8&4\\0&-1&1&0\\0&1&-1&1
\end{bmatrix}}&\end{flalign*}
\[\Downarrow\hspace{7em}\]
\begin{flalign*}&\rowopmatrix[15em]{ \\ \\ \rowop{R_3}{R_3 + R_2} }{\begin{bmatrix}[rrr|r]
2&-1&8&4\\0&-1&1&0\\0&0&0&1
\end{bmatrix}}&\end{flalign*}
Here $2=\rank{A}<\rank{[A|B]}=3$ or, equivalently, the bottom row yields a contradiction. Therefore $m = \frac{1}{2}$ gives no solution.

Note that this example shows that for almost any value of $m$ the determined system produces a unique solution.  The events of the determined system having no solution or an infinite number of solutions are exceptional.  In linear systems arising from physical problems one should suspect that the problem has some symmetry or constraint when such exceptional cases arise.
\end{example}

\section{Cramer's Rule}
Let $A\bm{x}=\bm{b}$ be a determined linear system of $n$ equations in $n$ unknowns where $\det A \neq 0$ and:
\[A = \begin{bmatrix}
a_{11} & a_{12} & \ldots & a_{1n}\\ a_{21} & a_{22} & \ldots & a_{2n} \\ \vdots & \vdots & & \vdots \\ a_{n1} & a_{n2} & \ldots & a_{nn}
\end{bmatrix}~~~~\bm{b}=\begin{bmatrix}b_1 \\ b_2 \\ \vdots \\ b_n\end{bmatrix}\,.\]
Define $A(1)$ to be the matrix given by
\[A(1) = \begin{bmatrix}
b_1 & a_{12} & \ldots & a_{1n}\\ b_2 & a_{22} & \ldots & a_{2n} \\ \vdots & \vdots & & \vdots \\ b_{n} & a_{n2} & \ldots & a_{nn}
\end{bmatrix}\,,\]
i.e. Replace the first column of $A$ by the right hand side $\bm{b}$\,. If we denote $A=[\bm{a}_1\bm{a}_2\cdots\bm{a}_n]$ where $\bm{a}_i$ is a column vector of $A$, then
\[A(1)=[\bm{b}\bm{a_2}\cdots\bm{a_n}]\,.\]
In general let $A(i)$ denote the matrix given by replacing the $i\textsuperscript{th}$ column of $A$, $\bm{a}_i$, by $\bm{b}$:
\[A(i) = \begin{bmatrix}
a_{11} & \ldots & a_{1,i-1} & b_1 & a_{1,i+1} & \ldots & a_{1n}\\
a_{21} & \ldots & a_{2,i-1} &  b_2 & a_{2,i+1} & \ldots &a_{2n}\\
\vdots & &\vdots &\vdots & \vdots &  &\vdots\\
a_{n1} & \ldots & a_{n,i-1} &b_n & a_{n,i+1} & \ldots & a_{nn}
\end{bmatrix}=[\bm{a}_1\cdots\bm{a}_{i-1}\bm{b}\bm{a}_{i+1}\cdots\bm{a}_n]\]

\theorem{Let $A\bm{x}=\bm{b}$ be a determined linear system of $n$ equations in $n$ unknowns where $\det A \neq 0$\,. The unique solution $\bm{x}=[x_1,\ldots, x_n]^T$ to the system is then given by
\begin{align*}
  x_1 &= \frac{\det A(1)}{\det A} &
   &\ldots&
  x_i &= \frac{\det A(i)}{\det A} &
  &\ldots& 
  x_n &= \frac{\det A(n)}{\det A}\,. 
\end{align*}
This is called \textbf{Cramer's Rule}.}

\textbf{Proof:}\\
Since $\det A \neq 0$ $A$ is invertible and $A\bm{x}=\bm{b}$ has a unique solution given by $\bm{x}=A^{-1}\bm{b}$\,.  Evaluating the latter gives:
\begin{align*}
\bm{x}&=A^{-1}\bm{b} \\
&= \frac{1}{\det A}(\adj A)\bm{b}\\
&=\frac{1}{\det A}C^T\bm{b}\\
&=\frac{1}{\det A}\begin{bmatrix}
c_{11}&c_{21}&\ldots&c_{n1}\\c_{12}&c_{22}&\ldots &c_{n2}\\ \vdots &\vdots & & \vdots \\c_{1n}&c_{2n}&\ldots&c_{nn}
\end{bmatrix}
\begin{bmatrix}
  b_1\\b_2\\\vdots\\b_n
  \end{bmatrix}
  \end{align*}
  Multiplying out the right hand side gives
\[\begin{bmatrix}
  x_1\\x_2\\\vdots\\x_n
  \end{bmatrix} = \frac{1}{\det A}\begin{bmatrix}
  b_1c_{11} + b_2c_{21} + \ldots + b_nc_{n1}\\
  b_1c_{12} + b_2c_{22} + \ldots + b_nc_{n2}\\ \vdots \\
  b_1c_{1n} + b_2c_{2n} + \ldots + b_nc_{nn}
  \end{bmatrix}\]
  Equating the $i\textsuperscript{th}$ entry on each side gives
  \[x_i=\frac{1}{\det A}(b_1c_{1i} + b_2c_{2i} + \ldots + b_nc_{ni})\ \ \ \ \ (i=1,\ldots,n)\,.\]
  But evaluating the determinant of $A(i)$ along the $i\textsuperscript{th}$ column gives
  \[\det A(i)=b_1c_{1i} + b_2c_{2i} + \ldots + b_nc_{ni}\,.\]
  Therefore
  \[x_i=\frac{\det A(i)}{\det A}\ \ \ \ \ \ (i=1,\ldots,n)\,.\]

Note Cramer's Rule is not an efficient method for solving a linear system compared to Gaussian elimination.  It does have theoretical utility, however, as it gives a closed form for the solution of a determined system having a unique solution.

\begin{example}
  Solve the linear system using Cramer's Rule if possible.
  \begin{align*}
    3x+2y+3z &= 4\\
    -2x-4y+2z &= -12\\
    2x + 3z &= 0
  \end{align*}

Solution:
  \begin{align*}
  A & = \begin{bmatrix*}[r]
  3&2&3\\-2&-4&2\\2&0&3
  \end{bmatrix*} & \det A &= 2(+1)(4+12)+3(+1)(-12+4)=32-24=8\\
  &&\det A&\neq 0\ \text{so Cramer's Rule will work to find the unique solution.}\\
  A(1) &= \begin{bmatrix*}[r]
4&2&3\\-12&-4&2\\0&0&3
\end{bmatrix*} & \det A(1) &= 3(+1)(-16+24)=24\\[.5em]
A(2) &= \begin{bmatrix*}[r]
3&4&3\\-2&-12&2\\2&0&3
\end{bmatrix*} & \det A(2) &= 2(+1)(8+36)+3(+1)(-36+8)=88-84=4\\[.5em]
A(3) &= \begin{bmatrix*}[r]
3&2&4\\-2&-4&-12\\2&0&0
\end{bmatrix*} & \det A(3) &= 2(+1)(-24+16)=-16
\end{align*}
Using Cramer's Rule we have the solution:
\begin{align*}
x &= \frac{\det A(1)}{\det A} = \frac{24}{8} = 3 & 
y &= \frac{\det A(2)}{\det A} = \frac{4}{8} = \frac{1}{2} &
z &= \frac{\det A(3)}{\det A} = \frac{-16}{8} = -2\,.
\end{align*}
\end{example}

\begin{example}
% This was changed to have infinitely many solutions to illustrate Cramer's Rule
% cannot always be applied.
Solve the linear system using Cramer's Rule if possible.
  \begin{align*}
    3x_1 + x_2 &= -1\\
    -2x_1 -4x_2 + 3x_3 &= 2\\
    -x_1 -7x_2 +6x_3 &= 3
  \end{align*}
Solution:\\
\begin{align*}
A & = \begin{bmatrix*}[r]
  3&1&0\\-2&-4&3\\-1&-7&6
  \end{bmatrix*}
& \det A &= 3(+1)(-24+21)+(1)(-1)(-12+3)=-9+9=0
\end{align*}
The determined system does not have a unique solution and Cramer's Rule cannot be applied.  Reducing the augmented matrix gives
\[[A|B]=\begin{bmatrix}[rrr|r]
3 & 1 & 0 & -1 \\
-2 & -4 & 3 & 2 \\
-1 & -7 & 6 & 3
\end{bmatrix}\hspace{7em}\]
\[\Downarrow\hspace{7em}\]
\begin{flalign*}&\rowopmatrix[15em]{\rowswap{R_1}{R_3}\\ \\}{\begin{bmatrix}[rrr|r]
-1 & -7 & 6 & 3 \\
-2 & -4 & 3 & 2 \\
3 & 1 & 0 & -1
  \end{bmatrix}}&\end{flalign*}
\[\Downarrow\hspace{7em}\]
\begin{flalign*}&\rowopmatrix[15em]{\rowop{R_1}{-R_1}\\ \rowop{R_2}{R_2-2R_1}\\
\rowop{R_3}{R_3+3R_1}}{\begin{bmatrix}[rrr|r]
1 & 7 & -6 & -3 \\
0 & 10 & -9& -4 \\
0 & -20 & 18 & 8
\end{bmatrix}}&\end{flalign*}
\[\Downarrow\hspace{7em}\]
\begin{flalign*}&\rowopmatrix[15em]{ \\ \rowop{R_2}{\frac{1}{10}R_2} \\ \rowop{R_3}{R_3+2R_2} }{\begin{bmatrix}[rrr|r]
1 & 7 & -6 & -3 \\[.2em]
0 & 1 & -\frac{9}{10}& -\frac{4}{10} \\[.2em]
0 & 0 & 0 & 0
\end{bmatrix}}&\end{flalign*}
\[\Downarrow\hspace{7em}\]
\begin{flalign*}&\rowopmatrix[15em]{\rowop{R_1}{R_1-7R_2} \\ \\}{\begin{bmatrix}[ccr|r]
\circled{1} & 0 & \frac{3}{10} & -\frac{2}{10} \\[.2em]
0 & \circled{1} & -\frac{9}{10}& -\frac{4}{10} \\[.2em]
0 & 0 & 0 & 0
\end{bmatrix}}&\end{flalign*}
The system has infinitely many solutions. The final augmented matrix corresponds to the equivalent linear system:
\begin{align*}
        x_1+\frac{3}{10}x_3&=-\frac{2}{10}\\
        x_2-\frac{9}{10}x_3 &=-\frac{4}{10}\\
        0 &= 0
      \end{align*}
Setting free (independent) variable $\boxed{x_3=s}$ we then solve for the leading variables by back-substitution:
\begin{itemize}
\item $x_2-\frac{9}{10}x_3 =-\frac{4}{10} \implies x_2-\frac{9}{10}s =-\frac{4}{10} \implies \boxed{\textstyle x_2=-\frac{4}{10}+\frac{9}{10}s}$
\item $ x_1+\frac{3}{10}x_3=-\frac{2}{10} \implies x_1+\frac{3}{10}s=-\frac{2}{10}\implies \boxed{\textstyle x_1=-\frac{2}{10}-\frac{3}{10}s}$
\end{itemize}
The general solution is therefore
\[\bm{x}=\begin{bmatrix*}[c] x_1\\ x_2\\ x_3\end{bmatrix*}=\begin{bmatrix*}[r]-\frac{2}{10} \\[.2em] -\frac{4}{10} \\[.2em] 0\end{bmatrix*}
+s\begin{bmatrix*}[r]-\frac{3}{10} \\[.2em] \frac{9}{10} \\[.2em] 1\end{bmatrix*}\,,\]
where $s$ is a parameter.
\end{example}

\begin{example}
Solve the linear system using Cramer's Rule if possible.
  \begin{align*}
  x_1  + 2x_3 &= 6\\
  -3x_1 + 4x_2 + 6x_3 &= 30\\
  -x_1 -2x_2 + 3x_3 &= 8
  \end{align*}
Solution:\\
\begin{align*}
A & = \begin{bmatrix*}[r]
  1&0&2\\-3&4&6\\-1&-2&3
  \end{bmatrix*}
  & \det A &%(1)(-1)^2 m_{11} + 0 + (2)(-1)^4m_{13}\\
%    &= m_{11} + 2m_{13}\\
%    &= \begin{vmatrix}
%    4&6\\-2&3
%    \end{vmatrix} + 2 \begin{vmatrix}
%    -3&4\\-1&-2
%    \end{vmatrix}\\
    =(1)(+1)(12+12) + 2(+1)(6+4)= 24+20= 44 \neq 0\\[.5em]
    A(1) &= \begin{bmatrix*}[r]
    6&0&2\\30&4&6\\8&-2&3
    \end{bmatrix*} & \det A(1) & = 6(+1)(12+12)+2(+1)(-60-32)=144-184= -40\\[.5em]
    A(2) &= \begin{bmatrix*}[r]
    1&6&2\\-3&30&6\\-1&8&3
    \end{bmatrix*} & \det A(2) & = 1(+1)(90-48)+6(-1)(-9+6)+2(+1)(-24+30)\\&&&=42+18+12 = 72\\[.5em]
    A(3)&= \begin{bmatrix*}[r]
    1&0&6\\-3&4&30\\-1&-2&8
    \end{bmatrix*} & \det A(3) & = 1(+1)(32+60)+6(+1)(6+4)=92+60=152
    \end{align*}
Using Cramer's Rule we have the solution:
\begin{align*}
        x_1 &= \frac{\det A(1)}{\det A} = -\frac{40}{44}= - \frac{10}{11} &
        x_2 &= \frac{\det A(2)}{\det A} = \frac{72}{44} = \frac{18}{11} &
        x_3 &= \frac{\det A(3)}{\det A} = \frac{152}{44} = \frac{38}{11}\,.
\end{align*}
\end{example}

\textbook{\newpage}
\begin{example}
In the following system find the value(s) of $a$ such that a solution exists with $y=0$\,.
  \begin{align*}
    x-3z &= 1\\
    ax+ 2y &= 0\\
    y + z &= a
  \end{align*}
Solution:\\
We are solving only for $y$ so we need only consider $A$ and $A(2)$\,.
\begin{align*}
A & = \begin{bmatrix*}[r]
1&0&-3\\a&2&0\\0&1&1
\end{bmatrix*} & \det A %&= a_{11}c_{11} + \cancel{a_{22}c_{22}} + a_{13}c_{13}\\
%  &= 1(-1)^2m_{11} + (-3)(-1)^4m_{13}\\
%  &= m_{11}-3m_{13}\\
%  &= \begin{vmatrix}
%  2&0\\1&1
%  \end{vmatrix} - 3 \begin{vmatrix}
%  a&2\\0&1
%  \end{vmatrix}\\
%  &= 2-0 - 3(a-0)\\
=1(+1)(2-0)-3(+1)(a-0)=2-3a
\end{align*}
A unique solution exists if $2-3a\neq 0$, and so $a\neq\frac{2}{3}$\,.
\begin{align*}
  A(2) &= \begin{bmatrix*}[r]
  1&1&-3\\a&0&0\\0&a&1
  \end{bmatrix*} & 
  \det A(2)% &= a_{21}c_{21} + \cancel{a_{22}c_{22}} + \cancel{a_{23}c_{23}}\\
%  &= a(-1)^3m_{21}\\
%  &= -a \begin{vmatrix}
%  1&-3\\a&1
%  \end{vmatrix}\\
= a(-1)(1+3a)=-a(1+3a)
\end{align*}
Using Cramer's Rule:
\[0=y=\frac{\det A(2)}{\det A}=\frac{-a(1+3a)}{2-3a}\,.\]
The solution requires the numerator vanish and the denominator be non-zero:
\[-a(1+3a) = 0\ \text{and}\  2-3a\neq0\]
Thus ($a=0$ or $1+3a=0$) and $a\neq 2/3$\,, or equivalently
($a=0$ or $a=-1/3$) and $a\neq 2/3$ which reduces logically to just the solution $a=0$ or $a=-1/3$\,.  In the case $a=2/3$ there are potentially solutions with $y=0$ as this corresponds to the case where $\det A=0$ and Cramer's Rule could not be applied.  Putting that value of $a$ into the original system creates a system with augmented matrix
\[\begin{bmatrix}[rrr|r]
1 & 0 & -3 & 1 \\
\frac{2}{3} & 2 & 0 & 0 \\
0 & 1 & 1 & \frac{2}{3}
\end{bmatrix}\,.\]
The reader may verify this is an inconsistent system (no solution)\,.
\end{example}


%TODO
% Perhaps add shading of omitted row and column when calculating submatrices
% for extra clarity.
%
% Move the definition of ``order'' as in a square matrix of order n into
% where I introduce square matrices.  Currently it is referred to in the
% definition of cofactor.
%
% We could proove determinants of triangular matrices using induction or
% put that in footnote.
%
% Add a problem in assignments that is an almost triangular matrix (one
% nonzero entry messes it up) to illustrate the mechanism behind evaluating
% a triangular matrix determinant.
%
% Product of the determinants.  I introduce det(AB)=det(A)det(B)
% and then go on to use it to prove how row operations affect determinants.
% Most texts need to use those results to actually prove the reverse.
% See
% https://proofwiki.org/wiki/Determinant_of_Matrix_Product
% for several proofs of det(AB) and the first two depend on the relationship
% that det(EA)=constant(E)det(A) for some constant dependent on elementary
% matrix A.  The first proof is more elegant as it doesn't require
% consideration of cases.  So if one does want to go that route then
% my approach of using det(AB) to prove the effect of row ops is circular.
% A proof that doesn't require appeal to row-ops uses the Cauchy-Binet
% formula restricted to square matrices.  See above reference linking to
% https://proofwiki.org/wiki/Cauchy-Binet_Formula
% http://planetmath.org/cauchybinetformula
% These require more general discussion of the determinant definition
% and permutations, which might be a good thing in an appendix.
% The best approach is to just use nxn matrices and avoid the generality
% of the Cauchy-Binet Formula.  Such an approach is given in Mathematics
% of Classical and Quantum Physics by Byron and Fuller.  Following that we
% should do the following in an appendix:
% 1) Introduce (as a theorem) the new definition of determinant in terms of
% a permutation.  Start with a 3x3 matrix to motivate it and show how the
% sign depends on the permutation of the second (or first) index.  Explain
% how each term picks out one value in each row and column and that we are
% summing over all n factorial of them appropriately signed.
% 2) Next introduce the levi-civita symbol as a book-keeping term for the sign
% and then show how, by defining it =0 for non-permutations we can use a
% sum to represent the determinant.  Perhaps then show summation convention.
% (and indeed this could be made optional in the book by a switch.)
% Then introduce the determinant as a theorem in terms of the sum and symbol
% Prove it by reducing it to the original definition in terms of the first line.
% Then PROVE cofactor expansion using this (see Byron and Fuller) - since
% we didn't prove that.
% 3) Next either prove product of determinant directly as per Byron and Fuller.
% Alternatively, underlying their proof I suspect one can likely use a
% product of levi-civita tensors equalling a levi-civita tensor times a Kronecker
% delta (see my Phys 351 notes) to prove the determinant formula.  This
% has the advantage of showing them both those technologies and applying them.
% Finally note if we could argue that det(AB)=constant(A)det(B)
% for arbitrary A then the conventional proof mentioned above could also
% be followed without undoing our other proofs.  We could include in a footnote
% to the appendix something like if you go ahead and prove our theorem on
% the effect of matrices then we have det(EB)=constant(E)det(B) and then
% you can prove the theorem like this using elementary matrices and reduction
% to diagonal matrices (or the less elegant method of considering cases where
% the matrix A is invertible or not.
%
% The advantage to my determinant approach is that it allows easy, memorable
% proofs one can actually do in class for most of the theorems and leaves the
% one harder (particularly harder in this approach) theorem out.
% One disadvantage is it fails to give the easiest route to proving
% the determinant of a product (assuming one wants this). Using the theorem
% to prove the others reinforces the theorem in a way it might not be
% with conventional teaching.  Finally if I put the levi-civita definition
% in an appendix, this could be used in other courses as a jumping off point
% and the students would have it in their notes.
%
% Perhaps discuss meaning of the determinant and the product rule when
% doing vectors or in the appendix.  See Byron and Fuller where this is
% discussed.
%
% Make a comment about the computational efficiency of using the adjugate
% versus augmenting [A|I] and reducing.
%
% Make comment about how we write |array| rather than |[array]| when doing
% the determinant by hand.  This is, however, ambiguous for a 1x1 array and
% should never be used for that.  Other books don't use this notation and
% it really makes it lousy to show row operations and have equal signs flowing
% between determinants.
%
% Perhaps I should put row ops on the right hand side rather than the left
% hand side so that arrows in the case of reduction and equal signs in the
% case of determinant don't get mixed up with the row ops (which I want to
% put beside the row).
%
% Maybe make the proof of the inverse of the adjugate as an exercise and give
% them the proof of the inverse of A as a hint.
%
% Add in the assignments, If for invertible A we define for k>0 the
% negative power of A to be A^{-k}=(A^{-1})^k, show that
% det(A^{-k})=(det A)^{-k}
%
% Add highlighting rows/columns for cofactor expansion of determinants.
