Command Palette

Search for a command to run...

Linear Methods of AI

Determinant Calculation

Determinant Calculation Methods

After understanding the basic concepts of determinant, we need to know how to calculate it practically. There are several methods that can be used depending on the form of the matrix we encounter.

For small matrices, we can use direct formulas. However, for larger matrices, we need more efficient strategies.

Basic Case of 1×1 Matrix

For matrices of size 1×11 \times 1, the determinant is very simple. If AR1×1A \in \mathbb{R}^{1 \times 1} with A=(a11)A = (a_{11}), then:

detA=a11\det A = a_{11}

This is the most basic case that becomes the foundation for calculating determinants of larger matrices.

Submatrix Concept

Before discussing the cofactor expansion method, we need to understand the concept of submatrix. For matrix ARn×nA \in \mathbb{R}^{n \times n} and indices i,j{1,2,,n}i, j \in \{1, 2, \ldots, n\}, submatrix AijA_{ij} is a matrix of size (n1)×(n1)(n-1) \times (n-1) obtained by removing row ii and column jj from matrix AA.

Let's look at an example for a 3×33 \times 3 matrix. Suppose we have:

A=(a11a12a13a21a22a23a31a32a33)A = \begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{pmatrix}

To get submatrix A12A_{12}, we remove row 1 and column 2:

A12=(a11a12a13a21a22a23a31a32a33)A_{12} = \begin{pmatrix} \cancel{a_{11}} & \cancel{a_{12}} & \cancel{a_{13}} \\ a_{21} & \cancel{a_{22}} & a_{23} \\ a_{31} & \cancel{a_{32}} & a_{33} \end{pmatrix}
=(a21a23a31a33)= \begin{pmatrix} a_{21} & a_{23} \\ a_{31} & a_{33} \end{pmatrix}

For submatrix A23A_{23}, we remove row 2 and column 3:

A23=(a11a12a13a21a22a23a31a32a33)A_{23} = \begin{pmatrix} a_{11} & a_{12} & \cancel{a_{13}} \\ \cancel{a_{21}} & \cancel{a_{22}} & \cancel{a_{23}} \\ a_{31} & a_{32} & \cancel{a_{33}} \end{pmatrix}
=(a11a12a31a32)= \begin{pmatrix} a_{11} & a_{12} \\ a_{31} & a_{32} \end{pmatrix}

This process applies to all combinations of rows and columns that are removed.

Cofactor Expansion

The most common method for calculating determinants is cofactor expansion. For matrix ARn×nA \in \mathbb{R}^{n \times n} with n>1n > 1, the determinant can be calculated using the formula:

detA=i=1n(1)i+jaijdetAij\det A = \sum_{i=1}^{n} (-1)^{i+j} \cdot a_{ij} \cdot \det A_{ij}

for a fixed and freely chosen column jj.

In this formula, the term (1)i+jdetAij(-1)^{i+j} \cdot \det A_{ij} is called the cofactor of element aija_{ij}. The sign (1)i+j(-1)^{i+j} provides a checkerboard pattern to determine positive or negative signs.

Example of 3×3 Cofactor Expansion

Let's look at an example of cofactor expansion for a 3×3 matrix:

A=(213041120)A = \begin{pmatrix} 2 & 1 & 3 \\ 0 & 4 & 1 \\ 1 & 2 & 0 \end{pmatrix}

We choose the first row for expansion:

detA=2(1)1+1detA11+1(1)1+2detA12+3(1)1+3detA13\det A = 2 \cdot (-1)^{1+1} \det A_{11} + 1 \cdot (-1)^{1+2} \det A_{12} + 3 \cdot (-1)^{1+3} \det A_{13}
=2det(4120)1det(0110)+3det(0412)= 2 \cdot \det \begin{pmatrix} 4 & 1 \\ 2 & 0 \end{pmatrix} - 1 \cdot \det \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} + 3 \cdot \det \begin{pmatrix} 0 & 4 \\ 1 & 2 \end{pmatrix}
=2(4012)1(0011)+3(0241)= 2 \cdot (4 \cdot 0 - 1 \cdot 2) - 1 \cdot (0 \cdot 0 - 1 \cdot 1) + 3 \cdot (0 \cdot 2 - 4 \cdot 1)
=2(2)1(1)+3(4)=4+112=15= 2 \cdot (-2) - 1 \cdot (-1) + 3 \cdot (-4) = -4 + 1 - 12 = -15

We can perform expansion based on any row or column. Usually we choose a row or column that has many zeros to simplify the calculation.

Triangular and Diagonal Matrices

For some special types of matrices, determinant calculation becomes very simple:

Upper Triangular Matrix

For upper triangular matrix RR:

R=(r110r2200rnn)R = \begin{pmatrix} r_{11} & * & \cdots & * \\ 0 & r_{22} & \cdots & * \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & r_{nn} \end{pmatrix}

Its determinant is:

detR=r11r22rnn\det R = r_{11} \cdot r_{22} \cdot \ldots \cdot r_{nn}

Lower Triangular Matrix

For lower triangular matrix LL:

L=(l1100l220lnn)L = \begin{pmatrix} l_{11} & 0 & \cdots & 0 \\ * & l_{22} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ * & * & \cdots & l_{nn} \end{pmatrix}

Its determinant is:

detL=l11l22lnn\det L = l_{11} \cdot l_{22} \cdot \ldots \cdot l_{nn}

Diagonal Matrix

For diagonal matrix DD:

D=(d11000d22000dnn)D = \begin{pmatrix} d_{11} & 0 & \cdots & 0 \\ 0 & d_{22} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & d_{nn} \end{pmatrix}

Its determinant is:

detD=d11d22dnn\det D = d_{11} \cdot d_{22} \cdot \ldots \cdot d_{nn}

For all three types of matrices, the determinant equals the product of all main diagonal elements.

Elementary Matrices

Elementary matrices are matrices obtained from the identity matrix with one elementary row operation. The determinants of elementary matrices have values that are easy to calculate:

  1. Scalar matrix Si(λ)S_i(\lambda) that multiplies row i by λ\lambda:

    detSi(λ)=λ\det S_i(\lambda) = \lambda
  2. Permutation matrix Qij(λ)Q_i^j(\lambda) that swaps row i and j:

    detQij(λ)=1\det Q_i^j(\lambda) = 1
  3. Transvection matrix PijP_i^j that adds a multiple of row j to row i:

    detPij=1\det P_i^j = -1

Note that permutation matrices have determinant 1, not -1 as often mistaken. The negative sign appears when we perform row swap operations on other matrices.

Gaussian Elimination for Determinant Calculation

One of the most efficient methods for calculating determinants is using Gaussian elimination. The process is to transform the matrix into upper triangular form, then multiply the diagonal elements.

When matrix AA is transformed into upper triangular form RR through Gaussian elimination, we need to count how many row swaps are performed. If there are pp row swaps, then:

detA=(1)pdetR\det A = (-1)^p \cdot \det R

Since RR is an upper triangular matrix:

detR=r11r22rnn\det R = r_{11} \cdot r_{22} \cdot \ldots \cdot r_{nn}

Therefore:

detA=(1)pr11r22rnn\det A = (-1)^p \cdot r_{11} \cdot r_{22} \cdot \ldots \cdot r_{nn}

Method Efficiency

Gaussian elimination has time complexity O(13n3)O(\frac{1}{3}n^3), which is much more efficient compared to cofactor expansion which has complexity O(n!)O(n!).

For large unstructured matrices, Gaussian elimination is the most practical and reliable method.

Complete Calculation Example

Let's look at an example of determinant calculation using Gaussian elimination:

A=(033220101)A = \begin{pmatrix} 0 & 3 & 3 \\ 2 & 2 & 0 \\ 1 & 0 & 1 \end{pmatrix}

Step 1: Swap rows 1 and 3 to get a non-zero pivot:

(101220033)\begin{pmatrix} 1 & 0 & 1 \\ 2 & 2 & 0 \\ 0 & 3 & 3 \end{pmatrix}

Step 2: Eliminate the first column by subtracting 2 times row 1 from row 2:

(101022033)\begin{pmatrix} 1 & 0 & 1 \\ 0 & 2 & -2 \\ 0 & 3 & 3 \end{pmatrix}

Step 3: Eliminate the second column by subtracting 1.5 times row 2 from row 3:

(101022006)=R\begin{pmatrix} 1 & 0 & 1 \\ 0 & 2 & -2 \\ 0 & 0 & 6 \end{pmatrix} = R

Since there is one row swap (p=1p = 1):

detA=(1)1detR\det A = (-1)^1 \cdot \det R
=(1)1126= (-1)^1 \cdot 1 \cdot 2 \cdot 6
=12= -12