# Cofactors

A computer finds the determinant from the pivots when the square matrix is reduced to upper triangular form using Gaussian elimination. However, originally the determinant was defined through cofactor expansion, which is credited to the great French mathematician, astronomer, and physicist Pierre-Simon marquis de Laplace (1749--1827) who is best known for his investigations into the stability of the solar system. Probably because he did not hold strong political views and was not a member of the aristocracy, he escaped imprisonment and execution during the French Revolution. Laplace was president of the Board of Longitude, aided in the organization of the metric system, helped found the scientific Society of Arcueil, and was created a marquis. He served for six weeks as minister of the interior under Napoleon.

Therefore, the cofactor expansion is also called the Laplace expansion, which is an expression for the determinant $$\det{\bf A} = |{\bf A}|$$ of an n × n matrix A that is a weighted sum of the determinants of n sub-matrices of A, each of size (n−1) × (n−1). The Laplace expansion has mostly educational and theoretical interest as one of several ways to view the determinant, but not of practical use in determinant computation.

For a given n × n matrix $${\bf A} = \left[ a_{ij} \right] ,$$ the minor of the entry in the i-th row and j-th column (also called the (i,j) minor) is the determinant of the submatrix formed by deleting the i-th row and j-th column. This number is often denoted Ai,j or Mi,j.

The term minor is apparently due to the English mathematician James Sylvester (who used it in 1850 paper).

For a given n × n matrix $${\bf A} = \left[ a_{ij} \right] ,$$ the (i,j)-cofactor of A is the number Cij given by $$C_{ij} = (-1)^{i+j} M_{i,j} = (-1)^{i+j} \det{\bf A}_{i,j} .$$ The n × n matrix of cofactors is called the adjugate of A
$\mbox{adj}{\bf A} = \left[ (-1)^{i+j} \det{\bf A}_{i,j} \right] = \left[ C_{ij} \right] .$

Theorem: (Cofactor Expansion or Laplace Expansion) The determinant of an n × n matrix A can be computed by a cofactor expansion across any row or down any column. The expansion across the i-th row using cofactors $$C_{ij} = (-1)^{i+j} \det{\bf A}_{i,j} .$$ is

$\det{\bf A} = a_{i1} C_{i,1} + a_{i2} C_{i,2} + \cdots + a_{in} C_{i,n} .$
The cofactor expansion down the j-th column is
$\det{\bf A} = a_{1j} C_{1,j} + a_{2j} C_{2,j} + \cdots + a_{nj} C_{n,j} . \qquad \blacksquare$

The plus or minus sign in the (i,j)-cofactor depends on the position of aij in the matrix, regardless of the sign of aij itself. The factor $$(-1)^{i+j}$$ determine the following checkerboard pattern of signs:
$\begin{bmatrix} +&-&+& \cdots \\ -&+&-&* \cdots \\ +&-&+& \cdots \\ \vdots&&& \ddots \end{bmatrix} .$
The Cofactor Expansion with respect to the first row can be visualied with the following figure for a 4×4 matrix.
A1 = {{-2, 2, 2, 2}, {2, 9, 6, 9}, {2, 6, 9, 6}, {2, 9, 6, 9}};
MatrixPlot[A1]
A2 = {{2, -2, 2, 2}, {6, 2, 6, 9}, {9, 2, 9, 6}, {6, 2, 6, 9}};
MatrixPlot[A2]
A3 = {{2, 2, -2, 2}, {6, 9, 2, 9}, {9, 6, 2, 6}, {6, 9, 2, 9}};
MatrixPlot[A3]
A4 = {{2, 2, 2, -2}, {6, 9, 6, 2}, {9, 6, 9, 2}, {6, 9, 6, 2}};
aa4 = MatrixPlot[A4]
Export["A4.png", aa4]
A visualization of the expansion by columns 1 and 2 of a 4×4 matrix in order to compute the determinant as a sum of six products of 2×2 matrices.
B1 = {{-2, -2, 2, 2}, {-2, -2, 2, 2}, {2, 2, 9, 6}, {2, 2, 6, 9}};
bb1 = MatrixPlot[B1];
B2 = {{-2, -2, 2, 2}, {2, 2, 6, 9}, {-2, -2, 2, 2}, {2, 2, 6, 9}};
bb2 = MatrixPlot[B2];
B3 = {{-2, -2, 2, 2}, {2, 2, 6, 9}, {2, 2, 9, 6}, {-2, -2, 2, 2}};
bb3 = MatrixPlot[B3]
B4 = {{2, 2, 9, 6}, {-2, -2, 2, 2}, {-2, -2, 2, 2}, {2, 2, 6, 9}};
bb4 = MatrixPlot[B4]
B5 = {{2, 2, 9, 6}, {-2, -2, 2, 2}, {2, 2, 9, 6}, {-2, -2, 2, 2}};
bb5 = MatrixPlot[B5]
B6 = {{2, 2, 9, 6}, {2, 2, 6, 9}, {-2, -2, 2, 2}, {-2, -2, 2, 2}};
bb6 = MatrixPlot[B6]
Export["B6.png", bb6]

Example: Consider the matrix
${\bf A} = \begin{bmatrix} 48&-30&-14&1 \\ 65&-41&-19&0 \\ 17&-10&-5&3 \\ -35&22&10&0 \end{bmatrix} .$
By choosing the second row (because one entry is zero, which simplify all calculations), we obtain the Laplace expansion
$\det{\bf A} = -65 \begin{vmatrix} -30&-14&1 \\ -10&-5&3 \\ 22&10&0 \end{vmatrix} - 41 \begin{vmatrix} 48&-14&1 \\ 17&-5&3 \\ -35&10&0 \end{vmatrix} + 19 \begin{vmatrix} 48&-30&1 \\ 17&-10&3 \\ -35&22&0 \end{vmatrix} .$
Now we calculate each determinant of these 3 × 3 matrices by expanding them with respect to the last column:
\begin{align*} \det \begin{bmatrix} -30&-14&1 \\ -10&-5&3 \\ 22&10&0 \end{bmatrix} &= \begin{vmatrix} -10&-5 \\ 22&10 \end{vmatrix} -3 \begin{vmatrix} -30&-14 \\ 22&10 \end{vmatrix} = 10 -24 = -14, \\ \det \begin{bmatrix} 48&-14&1 \\ 17&-5&3 \\ -35&10&0 \end{bmatrix} &= \begin{vmatrix} 17&-5 \\ -35&10 \end{vmatrix} -3 \begin{vmatrix} 48&-14 \\ -35&10 \end{vmatrix} = -5 + 30 = 25 , \\ \det \begin{bmatrix} 48&-30&1 \\ 17&-10&3 \\ -35&22&0 \end{bmatrix} &= \begin{vmatrix} 17&-10 \\ -35&22 \end{vmatrix} -3 \begin{vmatrix} 48&-30 \\ -35&22 \end{vmatrix} = 24-18 =6 . \end{align*}
Then we get the determinant:
$\det{\bf A} = -65 \cdot (-14) -41 \cdot 25 + 19 \cdot 6 = -1 .$
In the following Mathematica commands, we will compute the determinant of A by expanding along the first row and then also the first and third columns, using the Det and Drop commands:
A = {{48, -30, -14, 1}, {65, -41, -19, 0}, {17, -10, -5, 3}, {-35, 22, 10, 0}}
Drop[A, {2}, {3}] // MatrixForm
$$\begin{pmatrix} 48&-30&1 \\ 17&-10& 3 \\ -35 &22&0 \end{pmatrix}$$
Det[%]
6
Sum[(-1)^(1 + k) A[[1, k]] Det[Drop[A, {1}, {k}]], {k, 1, 4}]
Sum[(-1)^(k + 3) A[[k, 3]] Det[Drop[A, {k}, {3}]], {k, 1, 4}]
Sum[(-1)^(k + 3) A[[k, 1]] Det[Drop[A, {k}, {1}]], {k, 1, 4}]
-1

Example: In $$\mathbb{R}^n ,$$ the vectors $$e_1 [1,0,0,\ldots , 0] , \quad e_2 =[0,1,0,\ldots , 0], \quad \ldots , e_n =[0,0,\ldots , 0,1]$$ form a basis for n-dimensional real space, and it is called the standard basis. Its dimension is n.

Example: Let us consider the set of all real $$m \times n$$ matrices, and let $${\bf M}_{i,j}$$ denote the matrix whose only nonzero entry is a 1 in the i-th row and j-th column. Then the set $${\bf M}_{i,j} \ : \ 1 \le i \le m , \ 1 \le j \le n$$ is a basis for the set of all such real matrices. Its dimension is mn.

Example: The set of monomials $$\left\{ 1, x, x^2 , \ldots , x^n \right\}$$ form a basis in the set of all polynomials of degree up to n. It has dimension n+1. ■

Example: The infinite set of monomials $$\left\{ 1, x, x^2 , \ldots , x^n , \ldots \right\}$$ form a basis in the set of all polynomials. ■

Theorem: If A is a triangular matrix, then its determinant is a product of the entries on the main diagonal. ▣

1. Eberly, D., The Laplace Expansion Theorem: Computing the Determinants and Inverses of Matrices, 2008.
2. Determinants by Laplace expansion and inverses by adjoint matrices
3. Laplace's Expansion, Wiki books.
4. Avera, V. and De Simone, A., An elementary proof of Laplace's formula on determinants, International Journal of Mathematical Education in Science and Technology, Volume 43, 2012 - Issue 3, https://doi.org/10.1080/0020739X.2011.592618