\documentclass{article}
\input{../macros.tex}

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Lecture 20: \large{Cramer's rule, inverse matrix, and volume}}

We know a formula for and some properties of the determinant.  Now we see how the determinant can be used.

\subsection*{Formula for $\mb A^{-1}$}

We know:
$$\twobytwo abcd^{-1} = \frac{1}{ad-bc} \twobytwo d{-b}{-c}a.$$ Can we
get a formula for the inverse of a 3 by 3 or $n$ by $n$ matrix?  We
expect that $\frac{1}{\det \mb A}$ will be involved, as it is in the 2 by
2 example, and by looking at the cofactor matrix $\small \twobytwo d{-c}{-b}a$ we might 
guess that cofactors will be involved.

In fact:
$$\mb A^{-1} = \frac{1}{\det \mb A} \mb C^T$$
where $\mb C$ is the matrix of cofactors -- please notice the transpose!  Cofactors of row one of $\mb A$ go into column $1$
of $\mb A^{-1}$, and then we divide by the determinant.


\bigskip

The determinant of $\mb A$ involves products with $n$ terms and
the cofactor matrix involves products of $n-1$ terms.  $\mb A$ and $\frac{1}{\det \mb A} \mb C^T$ might cancel
each other.  This is much easier to see from our formula for the determinant than when
using Gauss-Jordan elimination.

To more formally verify the formula, we'll check that $\mb A \mb C^{T}
= (\det \mb A)\mb I$.

$$\mb A \mb C^{T} = 
\threebythree {a_{11}}{\cdots}{a_{1n}}\vdots\ddots\vdots{a_{n1}}{\cdots}{a_{nn}}
\threebythree {C_{11}}{\cdots}{C_{n1}}\vdots\ddots\vdots{C_{1n}}{\cdots}{C_{nn}}.
$$
The entry in the first row and first column of the product matrix is:
$$\sum_{j=1}^n a_{1j}{C_{j1}} = \det \mb A.$$ (This is just the
cofactor formula for the determinant.)  This happens for every entry
on the diagonal of $\mb A \mb C^{T}$.

To finish proving that $\mb A \mb C^{T} = (\det \mb A)\mb I$, we just
need to check that the off-diagonal entries of $\mb A \mb C^T$ are
zero.  In the two by two case, multiplying the entries in row 1 of
$\mb A$ by the entries in column 2 of $\mb C^T$ gives $a(-b) + b(a) =
0$.  This is the determinant of $\mb A_s = \twobytwo abab$.
In higher dimensions, the product of the first row of $\mb A$ and the last column
of $\mb C^T$ equals the determinant of a matrix whose first and last
rows are identical.  This happens with all the off diagonal matrices,
which confirms that $\mb A^{-1} = \frac{1}{\det \mb A} \mb C^T$.

\smallskip

This formula helps us answer questions about how the inverse changes
when the matrix changes.

\subsection*{Cramer's Rule for $\vb x = \mb A^{-1}\vb b$}

We know that if $\mb A\vb x = \vb b$ and $\mb A$ is nonsingular, then
$\vb x = \mb A^{-1}\vb b$.  Applying the formula $\mb A^{-1} = {\mb C^T}/{\det \mb A}$
gives us:
$$\vb x = \frac{1}{\det \mb A}\mb C^T \vb b.$$

{\em Cramer's rule} gives us another way of looking at this equation.
To derive this rule we break $\vb x$ down into its components.
Because the $i$'th component of $\mb C^T \vb b$ is a sum of cofactors
times some number, it is the determinant of some matrix $B_j$.
$$x_j = \frac{\det \mb B_j}{\det \mb A},$$ where $\mb B_j$ is the matrix 
created by starting with $\mb A$ and then replacing column $j$ with $\vb b$, so:
\begin{eqnarray*}
\mb B_1 &=& \left[ 
\begin{array}{cc} 
\vb b & \begin{array}{c}\text{last }$n-1$\\\text{columns}\\\text{of }\mb A\end{array}
\end{array}
\right] \qquad \text{and}\\
\mb B_n &=& \left[ 
\begin{array}{cc} 
 \begin{array}{c}\text{first }$n-1$\\ \text{columns}\\ \text{of }\mb A
 \end{array} & \vb b
\end{array}\right].
\end{eqnarray*}
This agrees with our formula $x_1 = \frac{\det \mb B_1}{\det \mb A}$. When taking the determinant of $\mb B_1$ we get a
sum whose first term is $b_1$ times the cofactor $C_{11}$ of $\mb A$.

\smallskip

Computing inverses using Cramer's rule is usually less efficient than using elimination.

\subsection*{$|\det \mb A| =$ volume of box}

Claim: $|\det \mb A|$ is the volume of the box ({\em parallelepiped})
whose edges are the column vectors of $\mb A$.  (We could equally well use the row vectors, forming a different box with the same volume.)

\begin{figure}[h]
\centering
  \mypic{../Images/lec20fig1}\\
  \caption{The box whose edges are the column vectors of $\mb A$.}\label{fig:l20_g1}
\end{figure}

If $\mb A = \mb I$, then the box is a unit cube and its volume is $1$.
Because this agrees with our claim, we can conclude that the volume
obeys determinant property 1.  

If $\mb A = \mb Q$ is an orthogonal matrix then the box is a unit cube in a different
orientation with volume $1 = |\det \mb Q|$.  (Because $\mb Q$ is an
orthogonal matrix, $\mb Q^T \mb Q = \mb I$ and so $\det \mb Q = \pm
1$.)

Swapping two columns of $\mb A$ does not change the volume of the box
or (remembering that $\det A = \det A^T$) the absolute value of the
determinant (property 2).  If we show that the volume of the box also
obeys property 3 we'll have proven $|\det \mb A|$ equals the volume
of the box.

If we double the length of one column of $\mb A$, we double the volume
of the box formed by its columns.  Volume satisfies property 3(a).

Property 3(b) says that the determinant is linear in the rows of the matrix:
$$\twobytwodetc {a+a'} {b+b'} c d = \twobytwodet abcd + \twobytwodet
{a'}{b'}cd.$$ Figure~\ref{fig:l20_g2} illustrates why this should be
true.
\begin{figure}[h]
\centering
  \mypic{../Images/lec20fig2}\\
  \caption{Volume obeys property 3(b).}\label{fig:l20_g2}
\end{figure}

Although it's not needed for our proof, we can also see that determinants obey property 4.  If two edges of a box are equal, the box flattens out and has no volume.

Important note: If you know the coordinates for the corners of a box,
then computing the volume of the box is as easy as calculating a
determinant.  In particular, the area of a parallelogram with edges
$\twobyone a b$ and $\twobyone c d$ is $ad-\nolinebreak bc$.  The area of a
triangle with edges $\twobyone a b$ and $\twobyone c d$ is half the
area of that parallelogram, or $\frac{1}{2}(ad-bc)$.  The area of a triangle with vertices at $(x_1, y_1)$, $(x_2, y_2)$
and $(x_3, y_3)$ is: $$\frac{1}{2}\threebythreedet {x_1} {y_1} 1 {x_2}
{y_2} 1 {x_3} {y_3} 1.$$

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
