Artificial Intelligence 🤖
Matrices
Determinants

Determinants

The determinant is a function which takes as an input a square matrix and outputs a real or complex number called the determinant of the input matrix. The denominator in the fraction appearing in Eq. (10.17) is the determinant of a 2×22 \times 2 matrix AA. For the inverse of a matrix AA to exist, we require that the determinant is nonzero. The notation for the determinant is

detA=a11a12a21a22=A.\operatorname{det} A=\left|\begin{array}{ll} a_{11} & a_{12} \\ a_{21} & a_{22} \end{array}\right|=|A| .

With a 2×22 \times 2 matrix

A=(a11a12a21a22)A=\left(\begin{array}{cc} a_{11} & a_{12} \\ a_{21} & a_{22} \end{array}\right)

we can use the shortcut

detA2×2=a11a22a12a21.\operatorname{det} A_{2 \times 2}=a_{11} a_{22}-a_{12} a_{21} .

For instance,

1237=1×72×3=1\left|\begin{array}{cc} 1 & 2 \\ 3 & 7 \end{array}\right|=1 \times 7-2 \times 3=1

For 3×33 \times 3 determinants, we make use of each entry in the first row and multiply by the 2×22 \times 2 determinant that is not in the entry's column or row. This is called the expansion of detA\operatorname{det} A by the first row of AA. More specifically,

detA=a11a12a13a21a22a23a31a32a33=a11a22a23a32a33a12a21a23a31a33+a13a21a22a31a32.\operatorname{det} A=\left|\begin{array}{lll} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{array}\right|=a_{11}\left|\begin{array}{ll} a_{22} & a_{23} \\ a_{32} & a_{33} \end{array}\right|-a_{12}\left|\begin{array}{ll} a_{21} & a_{23} \\ a_{31} & a_{33} \end{array}\right|+a_{13}\left|\begin{array}{ll} a_{21} & a_{22} \\ a_{31} & a_{32} \end{array}\right| .

Each term in the matrix comes with a corresponding sign given as follows,

(+++++)\left(\begin{array}{ccc} + & - & + \\ - & + & - \\ + & - & + \end{array}\right)

obtained from the formula (1)i+j(-1)^{i+j}. We may also choose to expand by the first column of AA instead. In that case we have,

detA=a11a12a13a21a22a23a31a32a33=a11a22a23a32a33a21a12a13a32a33+a31a12a13a22a23\operatorname{det} A=\left|\begin{array}{lll} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{array}\right|=a_{11}\left|\begin{array}{ll} a_{22} & a_{23} \\ a_{32} & a_{33} \end{array}\right|-a_{21}\left|\begin{array}{ll} a_{12} & a_{13} \\ a_{32} & a_{33} \end{array}\right|+a_{31}\left|\begin{array}{ll} a_{12} & a_{13} \\ a_{22} & a_{23} \end{array}\right|

Example 10.3 Calculate the determinant of

A=(123012152)A=\left(\begin{array}{ccc} 1 & 2 & 3 \\ 0 & -1 & 2 \\ 1 & 5 & 2 \end{array}\right)

by expanding along the first row and the first column.

Solution Expanding along the first row, we have

detA=1125220212+30115=1(210)2(02)+3(0+1)=5\operatorname{det} A=1\left|\begin{array}{cc} -1 & 2 \\ 5 & 2 \end{array}\right|-2\left|\begin{array}{ll} 0 & 2 \\ 1 & 2 \end{array}\right|+3\left|\begin{array}{cc} 0 & -1 \\ 1 & 5 \end{array}\right|=1(-2-10)-2(0-2)+3(0+1)=-5

Expanding along the first column, we have

detA=11252+12312=1(210)+1(4+3)=5\operatorname{det} A=1\left|\begin{array}{cc} -1 & 2 \\ 5 & 2 \end{array}\right|+1\left|\begin{array}{cc} 2 & 3 \\ -1 & 2 \end{array}\right|=1(-2-10)+1(4+3)=-5

We have already used the determinant in computing the cross product (see Chapter 9, Section 9.4) as well as in the scalar triple product. Recall that we used the latter in calculating the volume of a parallelepiped and so the determinant,

(a×b)c=c1c2c3a1a2a3b1b2b3(\boldsymbol{a} \times \boldsymbol{b}) \cdot \boldsymbol{c}=\left|\begin{array}{lll} c_{1} & c_{2} & c_{3} \\ a_{1} & a_{2} & a_{3} \\ b_{1} & b_{2} & b_{3} \end{array}\right|

can be understood as calculating a volume.

Cofactors of a matrix

Minors and cofactors

Given a matrix A=(aij)n×nA=\left(a_{i j}\right)_{n \times n}, the minors are the determinants formed by removing the given row and column of the matrix. If AA is a square matrix then the minor of the entry in the ith i^{\text {th }} row and jth j^{\text {th }} solumn is the determinant of the submatrix formed by deleting the ith i^{\text {th }} row and jth j^{\text {th }} column. This number is often denoted by MijM_{i j}. Minors are used to calculate cofactors which are in turn used to compute determinants and inverses. The cofactors of a matrix AA are denoted by

Cij=(1)i+jMijC_{i j}=(-1)^{i+j} M_{i j}

Example 10.4 For the matrix

A=(2136136278412231)A=\left(\begin{array}{cccc} 2 & 1 & 3 & 6 \\ -1 & 3 & 6 & 2 \\ 7 & 8 & 4 & 1 \\ 2 & -2 & 3 & 1 \end{array}\right)

calculate the cofactor C3,2C_{3,2}.

Solution The sign corresponding to row 3 , column 2 is negative since (1)3+2=1(-1)^{3+2}=-1. The minor M3,2M_{3,2} is given by the determinant of the submatrix left after deleting row 3 , column 2 as shown below

(213613627$412231)\left(\begin{array}{cccc} 2 & 1 & 3 & 6 \\ -1 & 3 & 6 & 2 \\ 7 & \$ & 4 & 1 \\ 2 & -2 & 3 & 1 \end{array}\right)

The cofactor is

C3,2=236162231C_{3,2}=-\left|\begin{array}{ccc} 2 & 3 & 6 \\ -1 & 6 & 2 \\ 2 & 3 & 1 \end{array}\right|

expanding along the first row gives

C3,2=(2623131221+61623)=75C_{3,2}=-\left(2\left|\begin{array}{ll} 6 & 2 \\ 3 & 1 \end{array}\right|-3\left|\begin{array}{cc} -1 & 2 \\ 2 & 1 \end{array}\right|+6\left|\begin{array}{cc} -1 & 6 \\ 2 & 3 \end{array}\right|\right)=75

Consider the determinant of AA as the expansion along the first row expressed in terms of the cofactors,

detA=j=13a1jC1j\operatorname{det} A=\sum_{j=1}^{3} a_{1 j} C_{1 j}

We may expand over any row or column and get a similar expression in terms of cofactors. We observe that

ai1Cj1+ai2Cj2+ai3Cj3={detA if i=j0 if ija_{i 1} C_{j 1}+a_{i 2} C_{j 2}+a_{i 3} C_{j 3}=\left\{\begin{array}{c} \operatorname{det} A \text { if } i=j \\ 0 \quad \text { if } i \neq j \end{array}\right.

To understand the iji \neq j case consider a 3×33 \times 3 matrix AA and say, i=1i=1 and j=2j=2 in Eq. (10.23).

For i=1,j=2i=1, j=2 in Eq. (10.23), the entries of the first row of AA i.e. a11,a12,a13a_{11}, a_{12}, a_{13} are used while the cofactors C21,C22,C23C_{21}, C_{22}, C_{23} are obtained with the second row always deleted. Since the second row is always deleted and none of the entries a21,a22,a23a_{21}, a_{22}, a_{23} are used in Eq. (10.23) then, it follows, that the second row can simply be replaced with any row; note that this does not affect the calculation of Eq. (10.23) when i=1,j=2i=1, j=2.

Now suppose we replace the second row with a row that is equal to the first one such that the 3×33 \times 3 matrix is made up of two rows that are the same and a third row that is different. Let us go back to Eq. (10.22) which gives the relationship between the determinant and the triple scalar product. The vectors a,b\boldsymbol{a}, \boldsymbol{b}, and c\boldsymbol{c} represent the rows of the matrix. If any of those two are the same, the determinant is zero; if a\boldsymbol{a} and b\boldsymbol{b} are the same, the angle between them is zero and therefore the cross product is zero [see Eq. (9.22)]. If a\boldsymbol{a} and c\boldsymbol{c} or b\boldsymbol{b} and c\boldsymbol{c} are equal, then a×b\boldsymbol{a} \times \boldsymbol{b} is perpendicular to a plane that contains both a\boldsymbol{a} and b\boldsymbol{b} (and, by extension, c\boldsymbol{c} ) and therefore the determinant is zero since the dot product of two perpendicular vectors is zero. The same argument can be made for the general case where iji \neq j.

Let us see this with an example. Consider the matrix

A=(111231222)A=\left(\begin{array}{ccc} 1 & -1 & 1 \\ 2 & 3 & -1 \\ 2 & 2 & 2 \end{array}\right)

For i=1,j=2i=1, j=2 in Eq. (10.23), we are considering the expression,

a11C21+a12C22+a13C23.a_{11} C_{21}+a_{12} C_{22}+a_{13} C_{23} .

The cofactors in the second row are associated with the signs,,-+- refer to Eq. (10.21)]. Equation (10.24) gives,

111221112211122-1\left|\begin{array}{cc} -1 & 1 \\ 2 & 2 \end{array}\right|-1\left|\begin{array}{cc} 1 & 1 \\ 2 & 2 \end{array}\right|-1\left|\begin{array}{cc} 1 & -1 \\ 2 & 2 \end{array}\right|

Since the entries in the second row have not been used, we realise that this result is the same as calculating the determinant of

B=(111111222)B=\left(\begin{array}{ccc} 1 & -1 & 1 \\ 1 & -1 & 1 \\ 2 & 2 & 2 \end{array}\right)

detB\operatorname{det} B is trivially zero since two of the three rows in BB are the same.

Cramer's rule

The adjugate matrix and Cramer's rule

The adjugate matrix denoted by adjA\operatorname{adj} A is the transpose of the matrix formed by the cofactors of AA, i.e.

adjA=(C11C21C31C12C22C32C13C23C33).\operatorname{adj} A=\left(\begin{array}{lll} C_{11} & C_{21} & C_{31} \\ C_{12} & C_{22} & C_{32} \\ C_{13} & C_{23} & C_{33} \end{array}\right) .

The product A(adjA)A(\operatorname{adj} A) has its entries equal to

ai1Cj1+ai2Cj2+ai3Cj3a_{i 1} C_{j 1}+a_{i 2} C_{j 2}+a_{i 3} C_{j 3}

from Eq. (10.23) we know this is equal to detA\operatorname{det} A when i=ji=j and equal to 0 when iji \neq j. Therefore

A(adjA)=detAI3.A(\operatorname{adj} A)=\operatorname{det} A I_{3} .

This leads us to Cramer's rule which states

A1=1detAadjAA^{-1}=\frac{1}{\operatorname{det} A} \operatorname{adj} A

this follows from Eq. (10.14).

Example 10.5 Consider a 2×22 \times 2 matrix,

A=(a11a12a21a22)A=\left(\begin{array}{ll} a_{11} & a_{12} \\ a_{21} & a_{22} \end{array}\right)

determine its inverse using Cramer's rule.

Solution We determine the inverse using Eq. (10.26). The cofactors are associated with the following signs

(++)\left(\begin{array}{cc} + & - \\ - & + \end{array}\right)

The matrix of cofactors is

(a22a21a12a11)\left(\begin{array}{cc} a_{22} & -a_{21} \\ -a_{12} & a_{11} \end{array}\right)

which gives the adjugate matrix as

adjA=(a22a12a21a11).\operatorname{adj} A=\left(\begin{array}{cc} a_{22} & -a_{12} \\ -a_{21} & a_{11} \end{array}\right) .

From Eq. (10.26), the inverse of AA is

A1=1a22a11a21a12(a22a12a21a11),A^{-1}=\frac{1}{a_{22} a_{11}-a_{21} a_{12}}\left(\begin{array}{cc} a_{22} & -a_{12} \\ -a_{21} & a_{11} \end{array}\right),

as before.

n×nn \times n determinants

So far we have calculated determinants of 2×22 \times 2 and 3×33 \times 3 matrices. The determinant formula generalises to n×nn \times n matrices as follows

detA=k=1na1kA1k\operatorname{det} A=\sum_{k=1}^{n} a_{1 k} A_{1 k}

where A1kA_{1 k} are the minors described above. We find these determinants by induction on the dimension of the matrix. We carry out an example on a 4×44 \times 4 matrix next.

Example 10.6 Compute the determinant of the following 4×44 \times 4 matrix,

A=(1321245311112243)A=\left(\begin{array}{cccc} 1 & 3 & 2 & -1 \\ -2 & 4 & 5 & -3 \\ 1 & 1 & -1 & 1 \\ 2 & 2 & 4 & 3 \end{array}\right)

Solution We start by calculating the determinant by expansion along the first row,

1321245311112243=14531112433253111243+2243111223+1245111224.\left|\begin{array}{cccc} 1 & 3 & 2 & -1 \\ -2 & 4 & 5 & -3 \\ 1 & 1 & -1 & 1 \\ 2 & 2 & 4 & 3 \end{array}\right|=1\left|\begin{array}{ccc} 4 & 5 & -3 \\ 1 & -1 & 1 \\ 2 & 4 & 3 \end{array}\right|-3\left|\begin{array}{ccc} -2 & 5 & -3 \\ 1 & -1 & 1 \\ 2 & 4 & 3 \end{array}\right|+2\left|\begin{array}{ccc} -2 & 4 & -3 \\ 1 & 1 & 1 \\ 2 & 2 & 3 \end{array}\right|+1\left|\begin{array}{ccc} -2 & 4 & 5 \\ 1 & 1 & -1 \\ 2 & 2 & 4 \end{array}\right| .

Next, for each of the four 3×33 \times 3 determinants above, we obtain 3 determinants formed by the submatrices left when deleting the row and column of each entry in the first row. We carry these out one by one.

1453111243=411435112331124=513253111243=3(211435112331124)=272243111223=2(211234112331122)=121245111224=2112441124+51122=36\begin{aligned} 1\left|\begin{array}{ccc} 4 & 5 & -3 \\ 1 & -1 & 1 \\ 2 & 4 & 3 \end{array}\right| & =4\left|\begin{array}{cc} -1 & 1 \\ 4 & 3 \end{array}\right|-5\left|\begin{array}{cc} 1 & 1 \\ 2 & 3 \end{array}\right|-3\left|\begin{array}{cc} 1 & -1 \\ 2 & 4 \end{array}\right|=-51 \\ -3\left|\begin{array}{ccc} -2 & 5 & -3 \\ 1 & -1 & 1 \\ 2 & 4 & 3 \end{array}\right| & =-3\left(-2\left|\begin{array}{cc} -1 & 1 \\ 4 & 3 \end{array}\right|-5\left|\begin{array}{cc} 1 & 1 \\ 2 & 3 \end{array}\right|-3\left|\begin{array}{cc} 1 & -1 \\ 2 & 4 \end{array}\right|\right)=27 \\ 2\left|\begin{array}{ccc} -2 & 4 & -3 \\ 1 & 1 & 1 \\ 2 & 2 & 3 \end{array}\right| & =2\left(-2\left|\begin{array}{cc} 1 & 1 \\ 2 & 3 \end{array}\right|-4\left|\begin{array}{cc} 1 & 1 \\ 2 & 3 \end{array}\right|-3\left|\begin{array}{cc} 1 & 1 \\ 2 & 2 \end{array}\right|\right)=-12 \\ 1\left|\begin{array}{ccc} -2 & 4 & 5 \\ 1 & 1 & -1 \\ 2 & 2 & 4 \end{array}\right| & =-2\left|\begin{array}{cc} 1 & -1 \\ 2 & 4 \end{array}\right|-4\left|\begin{array}{cc} 1 & -1 \\ 2 & 4 \end{array}\right|+5\left|\begin{array}{ll} 1 & 1 \\ 2 & 2 \end{array}\right|=-36 \end{aligned}

The determinant of AA is calculated as -72 .

Exercises

  1. Calculate the following 2×22 \times 2 determinants: (a) 1213\left|\begin{array}{cc}1 & 2 \\ -1 & 3\end{array}\right|; (b) 3112\left|\begin{array}{cc}3 & 1 \\ -1 & 2\end{array}\right|.
  2. Calculate the following 3×33 \times 3 determinants: (a) 112023132\left|\begin{array}{ccc}1 & -1 & 2 \\ 0 & 2 & 3 \\ -1 & 3 & -2\end{array}\right| (b) 213221011\left|\begin{array}{ccc}2 & -1 & 3 \\ -2 & 2 & 1 \\ 0 & 1 & 1\end{array}\right|.