% This is lecture no. 11 of MH1200/: Linear Algebra I.

\chapter{Big Determinant Theorems}%
\label{cha:big_determinant_theorems}

\section{Theorems}%
\label{sec:theorems}

\begin{thrm}
	\label{thrm1}
	Determinant detects invertibility.
	Let $A$ be an arbitrary $n\times n$ matrix.
	Then, $A$ is invertible if and only if:
	\[
	\det A \neq 0
	.\]
\end{thrm}

\begin{thrm}
	\label{thrm2}
	Determinant repsects multiplication.
	Let $A$ and $B$ be arbitrary $n\times n$ matrices.
	Then:
	\[
		\det(AB) = \det A \det B
	.\]
\end{thrm}

\section{Proofs}%
\label{sec:proofs}

Both theorems are proven using the theory of elementary matrices in lecture \ref{cha:elementary_matrices}.
First, we must prove the effect of elementary row operations on determinants.

\begin{proof}
	Effect of first elementary row operation on determinant.
	Consider the following elementary row operation:
	\[
	R_i \to R_i + cR_j
	.\]
	And a general square matrix $A$ of the following form:
	\[
	A =
	\begin{bmatrix}
		\leftarrow & R_1 & \rightarrow \\
		& \vdots & \\
		\leftarrow & R_i & \rightarrow \\
		& \vdots & \\
		\leftarrow & R_j & \rightarrow \\
		& \vdots & \\
		\leftarrow & R_n & \rightarrow \\
	\end{bmatrix}
	.\]
	Determinants are row linear so:
	\begin{align*}
		\det A' & =
		\begin{vmatrix}
			\leftarrow & R_1 & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_i + cR_j & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_j & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_n & \rightarrow \\
		\end{vmatrix}
		\\
			& =
		\begin{vmatrix}
			\leftarrow & R_1 & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_i & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_j & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_n & \rightarrow \\
		\end{vmatrix}
		+
		c
		\begin{vmatrix}
			\leftarrow & R_1 & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_j & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_j & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_n & \rightarrow \\
		\end{vmatrix}
		\\
			& = \det A
	\end{align*}
\end{proof}

The effect of the second elementary row operation on the determinant is:
\[
\det A' = - \det A
.\]
As proved in lecture \ref{cha:basic_theory_of_determinants}, \cref{sub:property_5}.

\begin{proof}
	Effect of the third elementary row operation on the determinant.
	Consider the square matrix $A'$ obtained from a square matrix $A$ by multiplying $R_i$ by some constant $c$ :
	\[
		A' =
		\begin{bmatrix}
			\leftarrow & R_1 & \rightarrow \\
			& \vdots & \\
			\leftarrow & cR_i & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_n & \rightarrow \\
		\end{bmatrix}
	.\]
	And therefore:
	\[
		\det A' =
		\begin{vmatrix}
			\leftarrow & R_1 & \rightarrow \\
			& \vdots & \\
			\leftarrow & cR_i & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_n & \rightarrow \\
		\end{vmatrix}
		= c
		\begin{vmatrix}
			\leftarrow & R_1 & \rightarrow \\
			& \vdots & \\
			\leftarrow & cR_i & \rightarrow \\
			& \vdots & \\
			\leftarrow & R_n & \rightarrow \\
		\end{vmatrix}
		=
		c\det A
	.\]
\end{proof}

Using these proofs, we can show that:
\begin{equation}
	\label{elem}
	\det(\textit{EA}) = \det(E)\det(A).
\end{equation}

\begin{proof}
	Determinant multiplication respects elementary matrices.
	In general, \cref{elem} can be rewritten as such:
	\[
		\det (R(A)) = \det(R(I_n)) \det (A)
	.\]
	For the first elementary row operation, we know that:
	\[
		\det(R(A)) = \det(A)
	.\]
	And therefore:
	\begin{align*}
		\det(R(A)) & = \det A\\
			   & = 1 \cdot \det A \\
			   & = \det(R(I_n)) \det A
	\end{align*}
	For the second elementary row operation, we know that:
	\[
		\det(R(A)) = - \det(A)
	.\]
	And therefore:
	\begin{align*}
		\det (R(A)) & = (-1) \det A\\
			    & = (-1) \cdot 1 \cdot \det A\\
			    & = (-1) \cdot \det I_n \cdot \det A\\
			    & = \det (R(I_n)) \cdot \det A
	\end{align*}
	For the third elementary row operation, we know that:
	\[
		\det(R(A)) = c \det(A)
	.\]
	And therefore:
	\begin{align*}
		\det (R(A)) & = c \det A\\
			    & = c \cdot 1 \cdot \det A\\
			    & = c \det I_n \cdot \det A\\
			    & = \det (R(I_n)) \cdot \det A
	\end{align*}
\end{proof}

Let $A'$ be the row reduced echelon form of $A$.
If we express the row reduction that turns $A$ into $A'$ via elementary matrices then we obtain the formula:
\begin{equation}
	\label{rref}
	A' = E_k \cdots E_1 A.
\end{equation}

\begin{proof}
	Determinant detects invertibility.
	Rearranging \cref{rref} to make $A$ the subject of the equation:
	\[
		A = E_{1}^{-1}\cdots  E_{k}^{-1} A'
	.\]
	Since all the inverted elementary matrices $E_i^{-1}$ are also elementary matrices, we can use \cref{elem} that we have proved to rewrite:
	\begin{equation}
		\label{star}
		\det A = \det (E_{1}^{-1}) \cdots \det(E_{k}^{-1}) \det A'.
	\end{equation}
	Firstly, assuming $A$ is invertible, we know therefore that the row reduced echelon form of $A$ is the identity matrix from theorem \ref{invert} and therefore:
	\[
	A' = I_n
	.\]
	Thus, \cref{star} becomes:
	\[
		\det A = \det (E_{1}^{-1}) \cdots \det(E_{k}^{-1}) \det I_n
	.\]
	Since every factor on the right hand side is non-zero, $\det \neq 0$.
	Therefore, if $A$ is invertible, then $\det A \neq 0$.
	Secondly, assuming $A$ is not invertible, then from theorem \ref{invert} we know that:
	\[
	A' \neq I_n
	.\]
	And since $A'$ is square, we can deduce that $A'$ has at least one row of zeros.
	Therefore:
	\[
	\det A' = 0
	.\]
	Thus \cref{star} becomes:
	\begin{align*}
		\det A & = \det (E_{1}^{-1}) \cdots \det(E_{k}^{-1}) \det A'\\
		       & = 0
	\end{align*}
\end{proof}

\begin{proof}
	Determinants respect multiplication.
	In the case where $A$ is invertible we know from theorem \ref{invert} that $A$ can be expressed as a product of elementary matrices:
	\[
	A = E_1 \cdots E_k
	.\]
	Therefore:
	\begin{align*}
		\det (\textit{AB}) & = \det (E_1 \cdots E_k B)\\
				   & = \det E_1 \cdots \det E_k \det B\\
				   & = \det(E_1\cdots E_k) \det B\\
				   & = \det A \det B
	\end{align*}

	\noindent
	In the case that $A$ is not invertible, then neither is $\textit{AB}$.
	Therefore:
	\[
		\det A = \det (\textit{AB}) = 0
	.\]
	And trivially:
	\[
	\det A \det B = \det AB
	.\]
\end{proof}

\section{Adjoint Matrices}%
\label{sec:adjoint_matrices}

\begin{definition}
	Adjoint Matrix.
	Let $A$ be an $n\times n$ matrix.
	Let $C_{ij}$ denote the cofactor associated to the $(i,j)$-entry of the matrix.
	Let $C$ denote the matrix of cofactors, an $n\times n$ matrix whose $(i,j)$-entry is $C_{ij}$.
	The adjoint matrix of $A$, denoted $\text{adj} (A)$, is defined to be the transpose of the matrix of cofactors:
	\[
		\text{adj} (A) = C^T
	.\] 
\end{definition}

\bigbreak

The adjoint matrix of a square matrix can be used to directly calculate the inverse of a square matrix.
This is because of the following property.

\begin{thrm}
	Let $A$ be an $n\times n$ matrix.
	Let $\text{adj}(A)$ denote its adjoint.
	Then:
	\[
		(A) \text{adj}(A) = \text{adj} (A) A = (\det A) I_n
	.\]
\end{thrm}

\begin{proof}
	The Adjoint matrix is almost the inverse.
	By definition the $(i,j)$-entry of $\text{adj}(A)$ is the cofactor of the $(j,i)$-entry of $A$:
	\[
		(\text{adj}(A))_{ij} = C_{ji}
	.\]
	The cofactors $C_{ij}$ are used to calculate the determinant of $A$ by the usual cofactor expansion:
	\[
		\det A = a_{i1}C_{i1} + \dotsb + a_{in}C_{in}
	.\]
	It is therefore required to show that:
	\begin{equation}
		\label{adjoint}
		(A) \text{adj}(A) = \det (A) I_n
	.\end{equation}
	The $(i,j)$-entry of the left hand side is:
	\[
		[(A) \text{adj}(A)]_{ij}
		=
		a_{i1}(\text{adj}(A))_{1j} + \dotsb + a_{in}(\text{adj}(A))_{nj}
	.\]
	Which can be written as:
	\[
		[(A) \text{adj}(A)]_{ij}
		=
		a_{i1}C_{j1} + \dotsb + a_{in}C_{jn}
	.\]
	The $(i,j)$-entry of the right hand side is:
	\[
		[\det (A) I_n]_{ij}
		=
		\begin{cases}
			\det A & \text{if } i = j,\\
			0 & \text{if } i \neq j.\\
		\end{cases}
	.\]
	In the case where $i=j$:
	\[
		a_{i1}C_{j1} + \dotsb + a_{in}C_{jn}
	.\]
	Can be written as:
	\[
		a_{i1}C_{i1} + \dotsb + a_{in}C_{in}
	.\]
	Which is the cofactor expansion for the determinant of $A$ along row $i$ so therefore:
	\[
		\det A
		=
		a_{i1}C_{i1} + \dotsb + a_{in}C_{in}
	.\]
	Therefore the diagonal entries of $(A)\adj (A)$ are equal to the diagonal entries of $\det(A) I_n$.
	In the case where $i \neq j$, we must show that:
	\[
		a_{i1}C_{j1} + \dotsb + a_{in}C_{jn} = 0
	.\]
	To do this, we will take the matrix $A$, and apply $R_j \rightarrow R_i$ to get $A'$:
	\[
	A =
	\begin{bmatrix}
		a_{11} & \cdots & a_{1n}\\
		\vdots & \ddots & \vdots\\
		a_{i1} & \cdots & a_{in}\\
		\vdots & \ddots & \vdots\\
		a_{j1} & \cdots & a_{jn}\\
		\vdots & \ddots & \vdots\\
		a_{n1} & \cdots & a_{nn}\\
	\end{bmatrix}
	\qquad
	A' =
	\begin{bmatrix}
		a_{11} & \cdots & a_{1n}\\
		\vdots & \ddots & \vdots\\
		a_{i1} & \cdots & a_{in}\\
		\vdots & \ddots & \vdots\\
		a_{i1} & \cdots & a_{in}\\
		\vdots & \ddots & \vdots\\
		a_{n1} & \cdots & a_{nn}\\
	\end{bmatrix}
	.\]
	A cofactor expansion along row $j$ gives:
	\[
	\det A' = 
	a_{i1}C'_{j1} + \dotsb + a_{in}C'_{jn}
	.\]
	And since the two matrices have the same cofactors along row $j$:
	\[
	\det A' = 
	a_{i1}C_{j1} + \dotsb + a_{in}C_{jn}
	.\]
	Since $A'$ is a matrix with duplicate rows, we can immediately conclude that:
	\[
	\det A' = 0
	.\]
	And therefore:
	\[
		a_{i1}C_{j1} + \dotsb + a_{in}C_{jn} = 0
	.\]
	Holds true, thus proving that $(i,j)$-entry in the left hand side of \cref{adjoint} is equal to the $(i,j)$-entry of the right hand side.
\end{proof}

\section{Cramer's Rule}%
\label{sec:cramer_s_rule}

Cramer's rule is a determinant trick which directly calculates the unique solution with $n$ variables in $n$ equations where there is only one unique solution.

\begin{thrm}
	Let $A$ be an invertible $n\times n$ matrix.
	Let $(b_1, \dotsc, b_n) \in \mathbb{R}^n$.
	Because $A$ is invertible the matrix equation:
	\[
	A
	\begin{bmatrix}
		x_1\\
		\vdots \\
		x_n\\
	\end{bmatrix}
	=
	\begin{bmatrix}
		b_1\\
		\vdots \\
		b_n\\
	\end{bmatrix}
	.\]
	has a unique solution.
	Let $A_j$ denote the matrix obtained by replacing column $j$ of $A$ with the column vector on the right hand side of the equation.
	Then, for all $1 \leqslant i \leqslant n$ we have:
	\[
		x_i = \frac{\det A_i}{\det A}
	.\]
	which solves for the $x_i$ component of the unique solution.
\end{thrm}
