Linear Algebra & Applications

2201NSC

Matrices
Part II

Elementary Matrices and Row Operations

Recall the three row operations permitted in Gaussian elimination:

  1. Swapping rows;
  2. Rescaling one row;
  3. Adding a multiple of one row to another row.

These operations can be represented by elementary matrices, $E_{i}.$ There is one elementary matrix for each operation.

The operation is achieved by multiplying a given matrix on the left by $E_{i}.$

The steps in Gaussian elimination can then be written as a product sequence:

$A \rightarrow E_{1}A $ $ \rightarrow E_{2}E_{1}A \rightarrow$ $\cdots \rightarrow E_{k}E_{k-1}\cdots E_{2}E_{1}A$


Elementary Matrices Examples

1. Interchanging two rows: Identity matrix with two off-diagonal 1s

$\begin{pmatrix} \color{red}0 & \color{red}1 & \color{blue}0 \\ \color{red}1 & \color{red}0 & \color{blue} 0 \\ \color{blue}0 & \color{blue}0 & \color{blue}1 \end{pmatrix}$ $\begin{pmatrix} 0 & -4 & 8 & 4 \\ 1 & -1 & 1 & 0 \\ 2 & 2 & 3 & 4 \end{pmatrix} $ $ = \begin{pmatrix} 1 & -1 & 1 & 0 \\ 0 & -4 & 8 & 4 \\ 2 & 2 & 3 & 4 \end{pmatrix}$

2. Rescaling one row: Identity matrix with one non-unit diagonal term

$\begin{pmatrix} \color{blue}1 & \color{blue}0 & \color{blue}0 \\ \color{blue}0 & \color{red}{-1/4} & \color{blue}0 \\ \color{blue}0 & \color{blue}0 & \color{blue}1 \end{pmatrix} $ $ \begin{pmatrix} 1 & -1 & 1 & 0 \\ 0 & -4 & 8 & 4 \\ 2 & 2 & 3 & 4 \end{pmatrix} $ $= \begin{pmatrix} 1 & -1 & 1 & 0 \\ 0 & 1 & -2 & -1 \\ 2 & 2 & 3 & 4 \end{pmatrix}$

3. Adding a multiple of one row to another: identity matrix with extra off-diagonal term

$\begin{pmatrix} \color{blue}1 & \color{blue}0 & \color{blue}0 \\ \color{blue}0 & \color{blue}1 & \color{blue}0 \\ \color{red}{-2} & \color{blue}0 & \color{blue}1 \end{pmatrix} $ $ \begin{pmatrix} 1 & -1 & 1 & 0 \\ 0 & 1 & -2 & -1 \\ 2 & 2 & 3 & 4 \end{pmatrix} $ $= \begin{pmatrix} 1 & -1 & 1 & 0 \\ 0 & 1 & -2 & -1 \\ 0 & 4 & 1 & 4 \end{pmatrix}$


Elementary Matrices Examples


$\begin{pmatrix} \color{blue}1 & \color{blue}0 & \color{blue}0 \\ \color{blue}0 & \color{blue}1 & \color{blue}0 \\ \color{red}{-2} & \color{blue}0 & \color{blue}1 \end{pmatrix} $ $\begin{pmatrix} \color{blue}1 & \color{blue}0 & \color{blue}0 \\ \color{blue}0 & \color{red}{-1/4} & \color{blue}0 \\ \color{blue}0 & \color{blue}0 & \color{blue}1 \end{pmatrix} $ $\begin{pmatrix} \color{red}0 & \color{red}1 & \color{blue}0 \\ \color{red}1 & \color{red}0 & \color{blue} 0 \\ \color{blue}0 & \color{blue}0 & \color{blue}1 \end{pmatrix}$ $\begin{pmatrix} 0 & -4 & 8 & 4 \\ 1 & -1 & 1 & 0 \\ 2 & 2 & 3 & 4 \end{pmatrix} $ $= \begin{pmatrix} 1 & -1 & 1 & 0 \\ 0 & 1 & -2 & -1 \\ 0 & 4 & 1 & 4 \end{pmatrix}$


$A\rightarrow$ $E_3$ $E_2$ $E_1$ $A\qquad $




Gaussian Elimination as a Product of Matrices

We can systematically write out row reduction on an augmented matrix:

$ \left( \begin{array}{cccc|c} a_{11} & a_{12} & \cdots & a_{1n} & q_{1}\\ a_{21} & a_{22} & \cdots & a_{2n} & q_{2} \\ \vdots & \vdots & \ddots & \vdots & \vdots \\ a_{n1} & a_{n2} & \cdots & a_{nn} & q_{n} \\ \end{array} \right) $ $\rightarrow \left( \begin{array}{cccc|c} b_{11} & b_{12} & \cdots & b_{1n} & r_{1}\\ 0 & b_{22} & \cdots & b_{2n} & r_{2} \\ \vdots & \vdots & \ddots & \vdots & \vdots \\ 0 & 0 & \cdots & b_{nn} & r_{n} \\ \end{array} \right) $ $\rightarrow \left( \begin{array}{cccc|c} 1 & 0 & \cdots & 0 & s_{1}\\ 0 & 1 & \cdots & 0 & s_{2} \\ \vdots & \vdots & \ddots & \vdots & \vdots \\ 0 & 0 & \cdots & 1 & s_{n} \\ \end{array} \right) $

$\big(A \mid \mathbf q\big) $ $\quad\quad \rightarrow \qquad\quad \big(B \mid \mathbf r\big)$ $\quad\;\; \rightarrow \qquad \big(I \mid \mathbf s\big)$

From our initial augmented matrix $\big(A \mid \mathbf q\big)$ we obtain the upper-triangular form:

$\big(B \mid \mathbf r\big) $ $= E_{k}\cdots E_{1}\big(A \mid \mathbf q\big) $ $ = \big(E_{k}\cdots E_{1}A \mid E_{k}\cdots E_{1}\mathbf q\big)$

...and eventually the reduced row echelon solution:

$\big(I \mid \mathbf s\big) $ $= \big(E_{m}\cdots E_{k+1}\big)E_{k}\cdots E_{1}\big(A \mid \mathbf q\big)$ $ = \big(E_{m}\cdots E_{1}A \mid E_{m}\cdots E_{1}\mathbf q\big) $



Important Consequence: Matrix Inversion

We have just seen that the reduction process creates the tracking identity:

$$\big(I \mid \mathbf s\big) = \big(E_{m}\cdots E_{1}A \mid E_{m}\cdots E_{1}\mathbf q\big)$$

Which explicitly means that:

$E_{m}\cdots E_{1}A= I $ $ \implies E_{m}\cdots E_{1} = A^{-1} \text{ (!!)}$

It follows directly that if we start with the identity matrix inside the augmented side:

$E_{m}\cdots E_{1}\big(A \mid I\big) $ $=\big (E_{m}\cdots E_{1}A \mid E_{m}\cdots E_{1}I\big) $ $= \big(I \mid A^{-1}\big)$

Conclusion: We can use standard row reduction on the augmented matrix $\big(A \mid I\big)$ to safely find the inverse matrix $A^{-1}.$


Matrix Inversion: Simple Example

Find the inverse of $A = \left(\begin{array}{cc} 2 & 1 \\ 1 & 1 \end{array}\right). $

$ \left(\begin{array}{cc|cc} 2 & 1 & 1 & 0 \\ 1 & 1 & 0 & 1 \end{array}\right) \begin{array}{c} R1 \\ R2 \end{array} $ $\rightarrow \left(\begin{array}{cc|cc} 1 & \frac{1}{2} & \frac{1}{2} & 0 \\ 1 & 1 & 0 & 1 \end{array}\right) \begin{array}{r} \frac{1}{2}R1 \\ R2 \end{array} \qquad \qquad\qquad\qquad $

$ \rightarrow \left( \begin{array}{cc|cc} 1 & \frac{1}{2} & \frac{1}{2} & 0 \\ 0 & \frac{1}{2} & -\frac{1}{2} & 1 \end{array} \right) \begin{array}{l} R1 \\ R1-R2 \end{array} $ $ \rightarrow \left( \begin{array}{cc|cc} 1 & 0 & 1 & -1 \\ 0 & 1 & -1 & 2 \end{array} \right) \begin{array}{l} R1-R2 \\ 2R2 \end{array} $

$$\Rightarrow A^{-1} = \begin{pmatrix} 1 & -1 \\ -1 & 2 \end{pmatrix}$$

Check: $\begin{pmatrix} 2 & 1 \\ 1 & 1 \end{pmatrix}\begin{pmatrix} 1 & -1 \\ -1 & 2 \end{pmatrix} $ $= \begin{pmatrix} 2-1 & -2+2 \\ 1-1 & -1+2 \end{pmatrix} $ $ = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}$ ✅


Matrix Inversion: Less Simple Example

Show that the inverse of $ A= \begin{pmatrix} 3&2&-1\\ 3&1&-1\\ 3&2&1 \end{pmatrix} $ is $ A^{-1}= \begin{pmatrix} -\frac12&\frac23&\frac16\\ 1&-1&0\\ -\frac12&0&\frac12 \end{pmatrix}. $

$ \left( \begin{array}{ccc|ccc} 3&2&-1&1&0&0\\ 3&1&-1&0&1&0\\ 3&2&1&0&0&1 \end{array} \right) \begin{array}{c} R1\\ R2\\ R3 \end{array} $ $ \rightarrow \left( \begin{array}{ccc|ccc} 3&2&-1&1&0&0\\ 0&-1&0&-1&1&0\\ 0&0&2&-1&0&1 \end{array} \right) \begin{array}{l} R1\\ R2-R1\\ R3-R1 \end{array}\qquad\qquad \qquad $

$ \rightarrow \left( \begin{array}{ccc|ccc} 3&0&-1&-1&2&0\\ 0&-1&0&-1&1&0\\ 0&0&1&-\frac12&0&\frac12 \end{array} \right) \begin{array}{l} R1+2R2\\ R2\\ \frac12R3 \end{array} $ $ \rightarrow \left( \begin{array}{ccc|ccc} 3&0&0&-\frac32&2&\frac12\\ 0&1&0&1&-1&0\\ 0&0&1&-\frac12&0&\frac12 \end{array} \right) \begin{array}{l} R1+R3\\ -R2\\ R3 \end{array} $

$ \rightarrow \left( \begin{array}{ccc|ccc} 1&0&0&-\frac12&\frac23&\frac16\\ 0&1&0&1&-1&0\\ 0&0&1&-\frac12&0&\frac12 \end{array} \right) \begin{array}{c} \frac13R1\\ R2\\ R3 \end{array} $ $ \Rightarrow A^{-1}= \begin{pmatrix} -\frac12&\frac23&\frac16\\ 1&-1&0\\ -\frac12&0&\frac12 \end{pmatrix} $


Calculating inverses using Octave/Matlab

We can confirm our results very easily via Octave or Matlab, using the inv command:

						
>> inv([2 1; 1 2])
ans =
1.00000 -1.00000
-1.00000 2.00000
  
						
>> inv([3 2 -1;3 1 -1;3 2 1])
ans =
-0.50000 0.66667 0.16667
1.00000 -1.00000 -0.00000
-0.50000 0.00000 0.50000
  



When is a Matrix Invertible?

Theorem (Equivalent conditions for nonsingularity)

The following statements about $A \in \mathbb{R}^{n \times n}$ are equivalent:

  • A: $A$ is invertible (nonsingular)
  • B: The only solution to $A\mathbf x=\mathbf 0$ is $\mathbf x=\mathbf 0$
  • C: $A$ is row-equivalent to $I$ (i.e., there is a sequence of elementary matrices such that $E_m \dots E_1 A = I$)

Proof Outline:

Show that $A \Rightarrow B \Rightarrow C \Rightarrow A.$

For $A \Rightarrow B$: If $A$ is invertible and $A\mathbf x=\mathbf 0,$

then $\;\mathbf x = I\mathbf x $ $= \left(A^{-1}A\right)\mathbf x$ $ = A^{-1}\left(A\mathbf x\right) $ $= A^{-1}\mathbf 0 $ $= \mathbf 0.$

So $\mathbf x=\mathbf 0$ is the only solution.



When is a Matrix Invertible? (Cont'd)

Theorem (Equivalent conditions for nonsingularity)

Statements: A ($A$ is invertible), B ($A\mathbf x=\mathbf 0 \Rightarrow \mathbf x=\mathbf 0$), C ($A$ is row-equivalent to $I$).

Proof Outline (Cont'd)

For $B \Rightarrow C$: Suppose $\mathbf x=\mathbf 0$ is the only solution to $A\mathbf x=\mathbf 0.$ Reduce the augmented matrix $(A \mid \mathbf 0)$ to $(U \mid \mathbf 0)$ where $U$ is in reduced row echelon form.

If $U$ contains a zero row, then there is a family of solutions. But $\mathbf x=\mathbf 0$ is the only solution, so $U$ has no zero rows.

Since $A$ is an $n \times n$ matrix, $U = I.$ So there exist elementary matrices $E_1, E_2, \dots, E_m$ such that $E_m \dots E_1 A = I.$ Hence $A$ is row-equivalent to $I.$



When is a Matrix Invertible? (Cont'd)

Theorem (Equivalent conditions for nonsingularity)

Statements: A ($A$ is invertible), B ($A\mathbf x=\mathbf 0 \Rightarrow \mathbf x=\mathbf 0$), C ($A$ is row-equivalent to $I$).

Proof Outline (Cont'd)

For $C \Rightarrow A$: If $A$ is row-equivalent to $I,$ then there exist elementary matrices $E_1, E_2, \dots, E_m$ such that $E_m \dots E_1 A = I.$

Therefore, $A^{-1} = E_m \dots E_1.$ So $A^{-1}$ exists, and hence $A$ is invertible.






When do Linear Systems have Unique Solutions?

Corollary (Uniqueness of solutions for linear systems) The linear system \(A\mathbf x=\mathbf b\) with \(n\) equations in \(n\) unknowns has a unique solution iff \(A\) is nonsingular.

Equivalent Two-Part Corollary Proof Outline:
  1. \(A\) is singular \(\Rightarrow\) \(A\mathbf x=\mathbf b\) has no solution or at least two distinct solutions: If \(A\) is singular, \(A\mathbf x=\mathbf0\) has a non-zero solution \(\mathbf x_0.\) If \(\mathbf x_b\) is a solution of \(A\mathbf x=\mathbf b,\) let \(\mathbf y=\mathbf x_b+\mathbf x_0.\) Then \(A\mathbf y =A(\mathbf x_b+\mathbf x_0)\) \( =A\mathbf x_b+A\mathbf x_0\) \(=\mathbf b+\mathbf0=\mathbf b,\) and since \(\mathbf x_0\ne\mathbf0,\) \(\mathbf y\ne\mathbf x_b.\)

    Thus, if \(A\) is singular, the system \(A\mathbf x=\mathbf b\) cannot have a unique solution: it has either no solution or at least two distinct solutions.

  2. \(A\) is nonsingular \(\Rightarrow\) \(A\mathbf x=\mathbf b\) has a unique solution: Since \(A\) is nonsingular, \(A^{-1}\) exists, so any solution must satisfy \(\mathbf x=(A^{-1}A)\mathbf x\) \(=A^{-1}(A\mathbf x)\) \(=A^{-1}\mathbf b.\)

Determinants: Motivation

A condition for a nonsingular matrix

We have just seen that:

$A \text{ is nonsingular} \iff A\mathbf x=\mathbf b \text{ has a unique solution}$

We would like a measurable property of the matrix itself that distinguishes singular from nonsingular matrices.

To achieve this, we introduce a quantity known as the determinant.

  • We denote the determinant of a square matrix $A$ by $\det (A)$ or by $|A|.$
  • $\det (A)$ is calculated from the matrix elements $a_{ij}.$
  • It will turn out that $\det A \neq 0$ iff $A$ is nonsingular.

So how do we calculate $\det A$?


Determinants: Motivation

Determinants for $A\in \mathbb R^{1\times 1}$

A $1 \times 1$ matrix $$A = (a_{11})$$ will have an inverse if and only if $a_{11} \neq 0.$

We therefore define $\det( A )= a_{11}$ for a $1 \times 1$ matrix.




Determinants: Motivation

Determinants for $A\in \mathbb R^{2\times 2}$
  1. $A = \begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix}$ is nonsingular if and only if it can be row reduced to $I.$
  2. We perform the row reductions:

    $ \begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix} \begin{array}{l} R1 \\ R2\end{array} $ $ \rightarrow \begin{pmatrix} a_{11} & a_{12} \\ 0 & a_{11}a_{22}- a_{12}a_{21} \end{pmatrix} \begin{array}{l} R1 \\ a_{11}R2- a_{21}R1 \end{array} $

  3. We will be able to row reduce $A$ to $I$ as long as $a_{11}a_{22} - a_{12}a_{21} \neq 0.$


Determinants: Motivation

Determinants for $A\in \mathbb R^{2\times 2}$
  • But what if $a_{11} = 0$?
  • Let's assume $a_{21} \neq 0$:

    $\begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix} \rightarrow \begin{pmatrix} a_{21} & a_{22} \\ 0 & a_{12} \end{pmatrix}$

  • We will be able to row reduce $A$ to $I$ as long as $a_{12} \neq 0$ and $a_{21} \neq 0$...
    which is equivalent to $a_{11}a_{22} - a_{12}a_{21} \neq 0$ when $a_{11} = 0.$
  • Finally, we note that if $a_{11} = a_{21} = 0,$ then $A$ is not row-reducible to $I$...
    but $a_{11}a_{22} - a_{12}a_{21} = 0$ in this case!

We therefore define: $\det (A) = a_{11}a_{22} - a_{12}a_{21}$ for a $ 2 \times 2$ matrix.


Determinants for $A \in \mathbb{R}^{3 \times 3}$

  1. $A = \begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{pmatrix}$ is nonsingular iff it can be row reduced to $I.$
  2. We perform the row reductions:

    $\begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{pmatrix} \rightarrow \begin{pmatrix} a_{11} & a_{12} & a_{13} \\ 0 & a_{11}a_{22}-a_{21}a_{12} & a_{11}a_{23}-a_{21}a_{13} \\ 0 & a_{11}a_{32}-a_{31}a_{12} & a_{11}a_{33}-a_{31}a_{13} \end{pmatrix}$

  3. We will be able to row reduce $A$ to $I$ as long as:

    $\det \begin{pmatrix} a_{11}a_{22}-a_{21}a_{12} & a_{11}a_{23}-a_{21}a_{13} \\ a_{11}a_{32}-a_{31}a_{12} & a_{11}a_{33}-a_{31}a_{13} \end{pmatrix} \neq 0$



Determinants for $A \in \mathbb{R}^{3 \times 3}$

$\left| \begin{array}{cc} a_{11}a_{22}-a_{21}a_{12} & a_{11}a_{23}-a_{21}a_{13} \\ a_{11}a_{32}-a_{31}a_{12} & a_{11}a_{33}-a_{31}a_{13} \end{array} \right|$

$= [a_{11}a_{22}-a_{21}a_{12}][a_{11}a_{33}-a_{31}a_{13}] - [a_{11}a_{32}-a_{31}a_{12}][a_{11}a_{23}-a_{21}a_{13}]$

$= \dots$

$= a_{11}[a_{11}a_{22}a_{33}-a_{22}a_{31}a_{13}-a_{21}a_{12}a_{33}-a_{11}a_{32}a_{23}+a_{32}a_{21}a_{13}+a_{31}a_{12}a_{23}]$

In analogy with the $2 \times 2$ case, for a $3 \times 3$ matrix we could propose:

$$\det (A) = a_{11}a_{22}a_{33}-a_{22}a_{31}a_{13}-a_{21}a_{12}a_{33}-a_{11}a_{32}a_{23}+a_{32}a_{21}a_{13}+a_{31}a_{12}a_{23}$$

But what about the cases where $a_{11}=0$, etc.?



Determinants for $A \in \mathbb{R}^{3 \times 3}$

Just as in the $2 \times 2$ case, the $3 \times 3$ definition for $\det A$ works in all the special cases where $a_{11}$, $a_{21}$ or $a_{31}$ are zero.

We therefore define the determinant of a $3 \times 3$ matrix as:

$$\det(A)= a_{11}a_{22}a_{33}-a_{22}a_{31}a_{13}-a_{21}a_{12}a_{33}-a_{11}a_{32}a_{23}+a_{32}a_{21}a_{13}+a_{31}a_{12}a_{23}$$

But remembering a formula like this is difficult... and it won't get any easier as our matrices get bigger.

Is there a better way to calculate the determinant?

🤔

Patterns with the determinant formula

The formula to compute the determinant of a $3 \times 3$ matrix is starting to get complicated:

$\det (A) = a_{11}a_{22}a_{33}-a_{22}a_{31}a_{13}-a_{21}a_{12}a_{33}-a_{11}a_{32}a_{23}+a_{32}a_{21}a_{13}+a_{31}a_{12}a_{23}$

Remembering this formula will be difficult and will not get easier as our matrices get bigger!

😬


Patterns with the determinant formula

For a $2\times2$ matrix $ A= \left( \begin{array}{cc} a_{11} & a_{12}\\ a_{21} & a_{22} \end{array} \right). $

Choose the first row.

$ \left( \begin{array}{cc} \color{red}{a_{11}} & \color{red}{a_{12}}\\ a_{21} & a_{22} \end{array} \right) $








Patterns with the determinant formula

For a $2\times2$ matrix $ A= \left( \begin{array}{cc} a_{11} & a_{12}\\ a_{21} & a_{22} \end{array} \right). $

Cross out the row and column containing each selected element.
The remaining $1\times1$ matrix has determinant equal to its single entry.

$ \left( \begin{array}{cc} \color{red}{a_{11}} & \color{lightgrey}{a_{12}}\\ \color{lightgrey}{a_{21}} & \color{blue}{a_{22}} \end{array} \right) \quad \left( \begin{array}{cc} \color{lightgrey}{a_{11}} & \color{red}{a_{12}}\\ \color{blue}{a_{21}} & \color{lightgrey}{a_{22}} \end{array} \right)\qquad \qquad $

$ \;\;\color{red}{a_{11}}\det(\color{blue}{a_{22}})\;\;\;\; $ $ \color{red}{a_{12}}\det(\color{blue}{a_{21}})\qquad\qquad $





Patterns with the determinant formula

For a $2\times2$ matrix $ A= \left( \begin{array}{cc} a_{11} & a_{12}\\ a_{21} & a_{22} \end{array} \right). $

Apply the alternating sign pattern: $ \left( \begin{array}{cc} + & -\\ - & + \end{array} \right). $

$ \left( \begin{array}{cc} \color{red}{a_{11}} & \color{lightgrey}{a_{12}}\\ \color{lightgrey}{a_{21}} & \color{blue}{a_{22}} \end{array} \right) \quad \left( \begin{array}{cc} \color{lightgrey}{a_{11}} & \color{red}{a_{12}}\\ \color{blue}{a_{21}} & \color{lightgrey}{a_{22}} \end{array} \right)\qquad \qquad $

$\text{det}\left(A\right)=$ $+$ $ \color{red}{a_{11}}\det(\color{blue}{a_{22}})\; $ $-\,$ $ \color{red}{a_{12}}\det(\color{blue}{a_{21}}) $ $ = a_{11}a_{22} - a_{12}a_{21}\quad$





Patterns with the determinant formula

For a $2\times2$ matrix $ A= \left( \begin{array}{cc} a_{11} & a_{12}\\ a_{21} & a_{22} \end{array} \right). $ The determinant is given by:

$\large \text{det}\left(A\right)= a_{11}a_{22} - a_{12}a_{21}$

This same pattern extends to larger matrices, where the remaining matrix is no longer $1\times1.$






Patterns with the determinant formula

For a $3\times3$ matrix:

$ \det(A)= a_{11}a_{22}a_{33} - a_{22}a_{31}a_{13} - a_{21}a_{12}a_{33} - a_{11}a_{32}a_{23} + a_{32}a_{21}a_{13} + a_{31}a_{12}a_{23} \;\; $

$ \det(A)= \color{red}{a_{11}}a_{22}a_{33} - a_{22}a_{31}\color{red}{a_{13}} - a_{21}\color{red}{a_{12}}a_{33} - \color{red}{a_{11}}a_{32}a_{23} + a_{32}a_{21}\color{red}{a_{13}} + a_{31}\color{red}{a_{12}}a_{23} \;\; $

$ = \color{red}{a_{11}} \left( \color{blue}{a_{22}a_{33}} - \color{blue}{a_{32}a_{23}} \right) - \color{red}{a_{12}} \left( \color{blue}{a_{21}a_{33}} - \color{blue}{a_{31}a_{23}} \right) + \color{red}{a_{13}} \left( \color{blue}{a_{21}a_{32}} - \color{blue}{a_{31}a_{22}} \right) $

$ = \color{red}{a_{11}} \det\!\left( \begin{array}{cc} \color{blue}{a_{22}} & \color{blue}{a_{23}}\\ \color{blue}{a_{32}} & \color{blue}{a_{33}} \end{array} \right) - \color{red}{a_{12}} \det\!\left( \begin{array}{cc} \color{blue}{a_{21}} & \color{blue}{a_{23}}\\ \color{blue}{a_{31}} & \color{blue}{a_{33}} \end{array} \right) + \color{red}{a_{13}} \det\!\left( \begin{array}{cc} \color{blue}{a_{21}} & \color{blue}{a_{22}}\\ \color{blue}{a_{31}} & \color{blue}{a_{32}} \end{array} \right)\;\, $

$ \left( \begin{array}{ccc} \color{red}{a_{11}} & \color{lightgray}{a_{12}} & \color{lightgray}{a_{13}}\\ \color{lightgray}{a_{21}} & \color{blue}{a_{22}} & \color{blue}{a_{23}}\\ \color{lightgray}{a_{31}} & \color{blue}{a_{32}} & \color{blue}{a_{33}} \end{array} \right) \qquad \left( \begin{array}{ccc} \color{lightgray}{a_{11}} & \color{red}{a_{12}} & \color{lightgray}{a_{13}}\\ \color{blue}{a_{21}} & \color{lightgray}{a_{22}} & \color{blue}{a_{23}}\\ \color{blue}{a_{31}} & \color{lightgray}{a_{32}} & \color{blue}{a_{33}} \end{array} \right) \qquad \left( \begin{array}{ccc} \color{lightgray}{a_{11}} & \color{lightgray}{a_{12}} & \color{red}{a_{13}}\\ \color{blue}{a_{21}} & \color{blue}{a_{22}} & \color{lightgray}{a_{23}}\\ \color{blue}{a_{31}} & \color{blue}{a_{32}} & \color{lightgray}{a_{33}} \end{array} \right) $



Minors and Cofactors

Formal Definition of Determinant

For any matrix $A$, we define the minor $M_{ij}$ to be the matrix comprising the elements remaining once the row and column containing $a_{ij}$ are removed.

Example: For a $4 \times 4$ matrix, removing row 2 and column 3 yields $M_{23}$:

$A = \begin{pmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34} \\ a_{41} & a_{42} & a_{43} & a_{44} \end{pmatrix}\qquad\qquad \qquad\qquad \qquad\quad\, $

$A = \begin{pmatrix} a_{11} & a_{12} & \color{red}{a_{13}} & a_{14} \\ \color{red}{a_{21}} & \color{red}{a_{22}} & \color{red}{a_{23}} & \color{red}{a_{24}} \\ a_{31} & a_{32} & \color{red}{a_{33}} & a_{34} \\ a_{41} & a_{42} & \color{red}{a_{43}} & a_{44} \end{pmatrix}\qquad\qquad \qquad\qquad \qquad\quad\, $

$A = \begin{pmatrix} a_{11} & a_{12} & \color{red}{a_{13}} & a_{14} \\ \color{red}{a_{21}} & \color{red}{a_{22}} & \color{red}{a_{23}} & \color{red}{a_{24}} \\ a_{31} & a_{32} & \color{red}{a_{33}} & a_{34} \\ a_{41} & a_{42} & \color{red}{a_{43}} & a_{44} \end{pmatrix} \implies M_{23} = \begin{pmatrix} a_{11} & a_{12} & a_{14} \\ a_{31} & a_{32} & a_{34} \\ a_{41} & a_{42} & a_{44} \end{pmatrix}$

We then define the cofactor $C_{ij}$ as:

$$\large C_{ij} = \left(-1\right)^{i+j} \det M_{ij}$$

Formal Definition of Determinant

The determinant of a square matrix $A \in \mathbb{R}^{n \times n}$ is defined inductively by:

$$\det (A )= \begin{cases} a_{11} & \text{if } n=1 \\ \sum_{i=1}^{n} a_{1i} C_{1i} & \text{if } n>1 \end{cases}$$

where $C_{1i}$ is the cofactor of the corresponding element $a_{1i}$ in the first row.





Formal Definition of Determinant (Cont'd): Important Generalization

We are not forced to sum the terms $a_{ij}C_{ij}$ along the top row only!

  • $\det (A) = \sum_{i=1}^{n} a_{ki} C_{ki}$ along any row $k$
  • $\det (A )= \sum_{i=1}^{n} a_{ik} C_{ik}$ down any column $k$

Example: We can expand down the first column to take advantage of the zeros:

$ \begin{vmatrix} 0 & 2 & 3 & 0 \\ 0 & 4 & 5 & 0 \\ 0 & 1 & 0 & 3 \\ 2 & 0 & 1 & 3 \end{vmatrix} \color{white}{= 0 - 0 + 0 - 2 \begin{vmatrix} 2 & 3 & 0 \\ 4 & 5 & 0 \\ 1 & 0 & 3 \end{vmatrix}} $

$ \begin{vmatrix} \color{red}{0} & 2 & 3 & 0 \\ \color{red}{0} & 4 & 5 & 0 \\ \color{red}{0} & 1 & 0 & 3 \\ \color{red}{2} & 0 & 1 & 3 \end{vmatrix} \color{white}{= 0 - 0 + 0 - 2 \begin{vmatrix} 2 & 3 & 0 \\ 4 & 5 & 0 \\ 1 & 0 & 3 \end{vmatrix}} $

$ \begin{vmatrix} \color{red}{0} & 2 & 3 & 0 \\ \color{red}{0} & 4 & 5 & 0 \\ \color{red}{0} & 1 & 0 & 3 \\ \color{red}{2} & 0 & 1 & 3 \end{vmatrix} = 0 - 0 + 0 - 2 \begin{vmatrix} 2 & 3 & 0 \\ 4 & 5 & 0 \\ 1 & 0 & 3 \end{vmatrix} $

$ \begin{vmatrix} \color{red}{0} & 2 & 3 & 0 \\ \color{red}{0} & 4 & 5 & 0 \\ \color{red}{0} & 1 & 0 & 3 \\ \color{red}{2} & 0 & 1 & 3 \end{vmatrix} = 0 - 0 + 0 - 2 \begin{vmatrix} 2 & 3 & \color{blue}{0} \\ 4 & 5 & \color{blue}{0} \\ 1 & 0 & \color{blue}{3} \end{vmatrix} $

Now, expanding down the last column of the remaining $3 \times 3$ matrix:

$= -2 \left( 0 - 0 + 3 \begin{vmatrix} 2 & 3 \\ 4 & 5 \end{vmatrix} \right)$ $= -2 \times 3 \times (10 - 12) $ $ = 12.$

Useful Properties of Determinants

Core properties to remember:
  1. $A$ is singular if and only if $\det (A) = 0.$
  2. $\det(A) = \det\left(A^T\right).$
  3. If $A$ is a triangular matrix, $\det (A)$ is simply the product of its diagonal elements.
  4. $\det( A) = 0$ if:
    • $A$ has a row or column consisting entirely of zeros; or
    • $A$ has two identical rows or columns; or
    • One row (or column) of $A$ is a linear combination of other rows (or columns).
  5. $\det\left(AB\right) = \left(\det A\right)\left(\det B\right).$
  6. Elementary matrices:
    • If $E$ swaps two rows in $A$, then $\det(E) = -1.$
    • If $E$ rescales a row of $A$ by a constant $k$, then $\det (E) = k.$
    • If $E$ adds a multiple of a row to another row, then $\det (E) = 1.$

Application: Cramer's Rule

Solving a Linear System

Use Cramer's rule to solve the system:

$ \begin{aligned} x + 2y + z &= 5 \\ 2x + 2y + z &= 6 \\ x + 2y + 3z &= 9 \end{aligned} $

$ \begin{aligned} x + 2y + z &= 5 \\ 2x + 2y + z &= 6 \\ x + 2y + 3z &= 9 \end{aligned} \rightarrow \left( \begin{array}{cccc} 1 & 2 & 1 \\ 2 & 2 & 1 \\ 1 & 2 & 3 \\ \end{array} \right) \left( \begin{array}{cccc} x \\ y \\ z \\ \end{array} \right) = \left( \begin{array}{cccc} 5 \\ 6 \\ 9 \\ \end{array} \right) $

$ \begin{aligned} x + 2y + z &= 5 \\ 2x + 2y + z &= 6 \\ x + 2y + 3z &= 9 \end{aligned} \rightarrow \left( \color{blue}{ \begin{array}{cccc} 1 & 2 & 1 \\ 2 & 2 & 1 \\ 1 & 2 & 3 \\ \end{array} } \right) \left( \begin{array}{cccc} x \\ y \\ z \\ \end{array} \right) = \left( \begin{array}{cccc} 5 \\ 6 \\ 9 \\ \end{array} \right) $

$ \begin{aligned} x + 2y + z &= 5 \\ 2x + 2y + z &= 6 \\ x + 2y + 3z &= 9 \end{aligned} \rightarrow \left( \begin{array}{cccc} 1 & 2 & 1 \\ 2 & 2 & 1 \\ 1 & 2 & 3 \\ \end{array} \right) \left( \begin{array}{cccc} x \\ y \\ z \\ \end{array} \right) = \left( \begin{array}{cccc} \color{red}5 \\ \color{red}6 \\ \color{red}9 \\ \end{array} \right) $

The determinant of the coefficient matrix is $\det M= -4.$

Cramer's rule yields:

$x =\ds \frac{\begin{vmatrix} \color{red}5 & 2 & 1 \\ \color{red}6 & 2 & 1 \\ \color{red}9 & 2 & 3 \end{vmatrix}}{\det M}$ $= \dfrac{-4}{-4}$ $= 1,$
$y =\ds \frac{\begin{vmatrix} 1 & \color{red}5 & 1 \\ 2 & \color{red}6 & 1 \\ 1 & \color{red}9 & 3 \end{vmatrix}}{\det M}$ $= \dfrac{-4}{-4} = 1,$
$z = \ds\frac{\begin{vmatrix} 1 & 2 & \color{red}5 \\ 2 & 2 & \color{red}6 \\ 1 & 2 & \color{red}9 \end{vmatrix}}{\det M}$ $=\dfrac{-8}{-4} $ $= 2.$


Application: Cramer's Rule (Cont'd)

General Case Formulation

In general, given a system $M\mathbf x = \mathbf y$ where $\det M \neq 0$, the unique solution for each variable $x_i$ can be calculated by replacing the $i$-th column of $M$ with the vector $\mathbf y$: $$x_i = \frac{\det(M_i)}{\det(M)}$$

Where $M_i$ is constructed as:$$M_i = \begin{pmatrix} M_{11} & \dots & M_{1(i-1)} & \color{red}{y_1} & M_{1(i+1)} & \dots & M_{1n} \\ M_{21} & \dots & M_{2(i-1)} & \color{red}{y_2} & M_{2(i+1)} & \dots & M_{2n} \\ \vdots & & \vdots & \vdots & \vdots & & \vdots \\ M_{n1} & \dots & M_{n(i-1)} & \color{red}{y_n} & M_{n(i+1)} & \dots & M_{nn} \end{pmatrix}$$


Why does Cramer's Rule work?

First, we observe an important property of cofactor expansion identity:

$a_{i1}C_{j1} + a_{i2}C_{j2} + \dots + a_{in}C_{jn} = \begin{cases} \det A & \text{if } i=j \\ 0 & \text{if } i \neq j \end{cases}$
  • When $i=j$, this matches the standard definition of $\det A.$
  • When $i \neq j$, this corresponds to evaluating the determinant of an altered matrix where rows $i$ and $j$ are identical, which must equal $0.$

Next, we define the adjoint matrix ($\text{adj } A$) as the transpose of the cofactor matrix:

$$\text{adj } A = \begin{pmatrix} C_{11} & C_{21} & \dots & C_{n1} \\ C_{12} & C_{22} & \dots & C_{n2} \\ \vdots & \vdots & \ddots & \vdots \\ C_{1n} & C_{2n} & \dots & C_{nn} \end{pmatrix}$$

From this property, it follows that: $A\left(\text{adj } A\right) $ $ = \left(\det A\right)I$ $ \Ra A^{-1} = \dfrac{1}{\det A}\text{adj } A.$


Why does Cramer's Rule work? (Cont'd)

If $\mathbf x$ is the unique solution to the linear system $A\mathbf x=\mathbf b$, we can isolate $\mathbf x$ using the adjoint matrix inverse:

$$\mathbf x = A^{-1}\mathbf b = \frac{1}{\det A}(\text{adj } A)\mathbf b$$

Evaluating for an individual component entry $x_i$ gives:

$\ds x_i = \frac{b_1 C_{1i} + b_2 C_{2i} + \dots + b_n C_{ni}}{\det A}$ $ =\ds \frac{\det A_i}{\det A}$

This holds because the expression $b_1 C_{1i} + b_2 C_{2i} + \dots + b_n C_{ni}$ acts exactly as the cofactor expansion down the $i$-th column of a modified matrix $A_i$, where the original $i$-th column elements of $A$ have been replaced by the vector elements of $\mathbf b$: $$A_i = \begin{pmatrix} a_{11} & \dots & b_1 & \dots & a_{1n} \\ a_{21} & \dots & b_2 & \dots & a_{2n} \\ \vdots & & \vdots & & \vdots \\ a_{n1} & \dots & b_n & \dots & a_{nn} \end{pmatrix}$$

Application: Determinants and Vector Algebra

Cross Product & Scalar Triple Product

A highly convenient method to evaluate the cross product of two 3D vectors is via a symbolic determinant:

$\mathbf b \times \mathbf c = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ b_1 & b_2 & b_3 \\ c_1 & c_2 & c_3 \end{vmatrix}$

It follows directly that the scalar triple product can be computed as:

$\mathbf a \pd (\mathbf b \times \mathbf c) = \begin{vmatrix} a_1 & a_2 & a_3 \\ b_1 & b_2 & b_3 \\ c_1 & c_2 & c_3 \end{vmatrix}$

Conceptual Questions:

  • What does the scalar triple product represent geometrically?
  • What happens to the value if one vector is a linear combination of the other two?

Summary

Main Points Covered

  • Matrix notation & terminology
  • Matrix operations and algebra
  • Block matrices
  • Inversion via Gaussian elimination
  • Determinants and their operational properties
  • Cramer's Rule systems

Where to Next?

  • Linear Transformations
    • What are they conceptually?
    • Their core algebraic connection with matrices