%display latex
latex.matrix_delimiters(left='[', right=']')
latex.matrix_column_alignment('r')
For each $n$, there is a function called the determinant (of order $n$) which maps each $n\times n$ matrix over $K$ to an element of $K$. In other words, $$ \det \nolimits_n \colon M_n(K) \to K. $$ We simply write $\det$ for $\det_n$ if $n$ is understood or can be arbitrary.
One can/should view $\det$ as a function on the rows (or the columns) of a matrix.
When $n =2, 3$ the formula for determinants are given by:
and $$\det \left[\begin{matrix} a & b &c \\ d & e & f \\ g & h & i \end{matrix}\right] = aei + bfg + cdh - gec- hfa - dbi $$
Checkpoint. Find the determinant of
$$A = \left[\begin{array}{rrr} 2 & 0 & 1 \\ 2 & -2 & -1 \\ 0 & 2 & 2 \end{array}\right] \tag{1} $$We can ask SAGE to spit out these formulas.
var('a,b,c,d,e,f,g,h,i')
A2 = matrix([[a,b],[c,d]]); A2,det(A2)
A3 = matrix([[a,b,c],[d,e,f],[g,h,i]]); A3,A3.det() #another way of calling determinant.
det(A3).expand() #this is the criss-cross formula for 3x3 determinant.
The order 3 and the order 2 determinants are related. More precisely, let $A$ be a $3\times 3$ matrix, then $$ \det A = a_{11}\det A_{11} - a_{12}\det A_{12} + a_{13}\det A_{13} $$ where $A_{ij}$ is the submatrix of $A$ obtained by deleting the $i$-th row and $j$-th column of $A$.
The (i,j) minor of $A$ ( or the minor of $A$ at $(i,j)$ ), denoted by $m(A)_{ij}$ (or simply $m_{ij}$ if $A$ is understood), is defined to be $\det(A_{ij})$.
The (i,j) cofactor of $A$ (or the cofactor of $A$ at $(i,j)$, denoted by $c_{ij}=c(A)_{ij}$, is defined to be
$$c_{ij} = (-1)^{i+j}m_{ij}.$$One can think of cofactor as a signed version of minor.
def cross_out(A,i,j):
return A.delete_rows([i-1]).delete_columns([j-1])
#write a little program so we don't need to remember offsetting the indices everytime.
cross_out(A3,1,1), cross_out(A3,1,3) #this is A_11
A3.minors(2) #all 2x2 minors of A.
In fact a much more general fact is true:
For each $1 \le i \le n$, we have the following expansion by the $i$-th row formula for determinant. $$ \det(A) = \sum_{j=1}^n a_{ij}c_{ij} = \sum_{j=1}^n (-1)^{i+j}a_{ij}m_{ij} $$
Likewise, for each $1 \le j \le n$, the expansion by the $j$-th column formula for determinant is $$ \det(A) = \sum_{i=1}^n a_{ij}c_{ij} = \sum_{i=1}^n (-1)^{i+j}a_{ij}m_{ij} $$.
Checkpoint. Compute the determinant of the matrix $A$ in the checkpoint by expanding
The adjugate (or adjoint) of $A$, denoted by adj$A$ is the transpose of the matrix formed by $A$'s cofactors, i.e. $$ \text{adj}(A) = [c_{ij}]^T = [c_{ji}] $$
A2, A2.adjugate()
Proposition. (adj$A$)$A = \det(A)I$.
Corollary. $A$ is invertible if and only if $\det(A) \neq 0$. And in the case $\det(A) \neq 0$, $$A^{-1} = \dfrac{1}{\det(A)}\text{adj}(A)$$
Checkpoint. Compute adj$(A)$ by hand for the $A$ in the first checkpoint and hence $A^{-1}$.