Inspect the Matrix Before Calculating
For a determinant problem, the first decision is often not which row to expand along, but whether cofactor expansion is needed at all. A matrix with zeros in the right places may fit a direct formula or a recurrence that avoids a long expansion. The useful skill is to read the whole pattern first: check for a diagonal or triangular matrix, then for triangular blocks, then for a tridiagonal pattern. If none applies, a row or column with few nonzero entries is often the best place to expand.
All matrices in this tutorial are square matrices over \(\mathbb{R}\). A matrix is diagonal if its entries off the main diagonal are zero. It is upper triangular if all entries below the main diagonal are zero, and lower triangular if all entries above the main diagonal are zero. A matrix is tridiagonal if its only potentially nonzero entries lie on the main diagonal and the diagonals immediately above and below it.
Diagonal and Triangular Matrices
For a diagonal matrix, the determinant is the product of its diagonal entries. The same product formula applies to an upper- or lower-triangular matrix. These are results from the earlier material on diagonal and triangular determinants. A diagonal matrix is both upper and lower triangular, so the diagonal case is included. For instance, if a matrix is upper triangular, its entries below the diagonal are zero; expanding successively along the first column reduces the determinant to the product of the diagonal entries.
Worked Example: A Triangular Matrix and a Diagonal Matrix
Consider the upper-triangular matrix \(\mathbf{A}=\begin{bmatrix}2&1&-1\\0&3&4\\0&0&-2\end{bmatrix}\). Its determinant is the product of its diagonal entries:
As a check, expand along the first column, which has only one nonzero entry. The remaining minor is \(\begin{bmatrix}3&4\\0&-2\end{bmatrix}\), with determinant \(3(-2)-4(0)=-6\). Thus \(\det\mathbf{A}=2(-6)=-12\), as before.
For the diagonal matrix \(\mathbf{D}=\begin{bmatrix}4&0&0\\0&-1&0\\0&0&5\end{bmatrix}\), the same rule gives \(\det\mathbf{D}=4(-1)5=-20\). Expanding along the first row gives \(4\det\begin{bmatrix}-1&0\\0&5\end{bmatrix}=4((-1)5-0)=-20\), confirming the product.
Look for the zero pattern, not just for a few zeros. One zero below the diagonal does not make a matrix triangular, and a matrix with most entries zero is not necessarily diagonal or triangular. If the whole matrix does not meet the form, another method may still benefit from those zeros.
Block-Triangular Structure
A matrix is block upper triangular when it can be partitioned into square diagonal blocks so that the blocks below them are zero. In the simplest two-block case, its form is \(\begin{bmatrix}\mathbf{A}&\mathbf{B}\\\mathbf{O}&\mathbf{D}\end{bmatrix}\), where \(\mathbf{A}\) and \(\mathbf{D}\) are square and \(\mathbf{O}\) is a zero block. The block \(\mathbf{B}\) can contain any entries; it need not be zero or triangular.
The important point is that the off-diagonal block does not need to be zero. Compute the determinants of the diagonal blocks, then multiply. Do not treat a block-triangular matrix as an ordinary triangular matrix unless its individual entries also satisfy the triangular pattern.
Worked Example: Two Nontriangular Diagonal Blocks
Let
Partition after row 2 and column 2. The lower-left \(2\times2\) block is zero, so the matrix is block upper triangular. Its diagonal blocks are \(\mathbf{A}=\begin{bmatrix}1&2\\3&5\end{bmatrix}\) and \(\mathbf{D}=\begin{bmatrix}2&1\\1&1\end{bmatrix}\). Calculate each determinant:
Therefore \(\det\mathbf{M}=(-1)(1)=-1\). The blocks \(\mathbf{A}\) and \(\mathbf{D}\) are not triangular, but the block formula still applies.
Check: Expand the full matrix down its first column. The first minor has determinant \(5(2\cdot1-1\cdot1)+2(0\cdot1-2\cdot0)=5\). The second minor has determinant \(2(2\cdot1-1\cdot1)-1(0\cdot1-1\cdot0)=2\). The signed expansion is \(1(5)-3(2)=5-6=-1\), in agreement.
Tridiagonal Matrices and Their Recurrence
A tridiagonal matrix may have many nonzero entries, so a single cofactor expansion can produce a larger minor. Instead, use the recurrence established in the earlier material on tridiagonal determinants. For clarity, write the leading \(k\times k\) part of a tridiagonal matrix with diagonal entries \(a_1,\ldots,a_k\), superdiagonal entries \(b_1,\ldots,b_{k-1}\), and subdiagonal entries \(c_1,\ldots,c_{k-1}\). Let \(D_k\) be the determinant of that leading \(k\times k\) part, and set \(D_0=1\), the determinant of the empty \(0\times0\) matrix. Then \(D_1=a_1\), and for \(k\ge2\),
The minus sign is essential. Here is the cofactor argument for the recurrence. Expand the \(k\times k\) determinant along its last row. Only the entries \(c_{k-1}\) in column \(k-1\) and \(a_k\) in column \(k\) can contribute. The \(a_k\) term is \(a_kD_{k-1}\). The \(c_{k-1}\) term has cofactor sign \((-1)^{k+(k-1)}=-1\). In its minor, the final column has just one nonzero entry, \(b_{k-1}\); expanding that column leaves the leading \((k-2)\times(k-2)\) determinant \(D_{k-2}\), with positive sign because the entry is in the last row and column of that minor. Thus the second contribution is \(-c_{k-1}b_{k-1}D_{k-2}\), proving the recurrence. This reasoning also applies at \(k=2\), with \(D_0=1\). \(\square\)
Worked Example: A Four-by-Four Tridiagonal Determinant
Find the determinant of
Here the diagonal entries are \(2,3,2,1\). The superdiagonal entries are \(1,2,1\), and the subdiagonal entries are \(1,1,2\). Apply the recurrence in order:
Thus \(\det\mathbf{T}=-4\).
Check: Expand along the first row. The first \(3\times3\) minor has determinant \(3(2\cdot1-1\cdot2)-2(1\cdot1-1\cdot0)=0-2=-2\). The second minor has determinant \(1(2\cdot1-1\cdot2)-2(0\cdot1-1\cdot0)=0-0=0\). The first-row expansion is \(2(-2)-1(0)=-4\), confirming the recurrence calculation.
When Cofactor Expansion Is the Better Choice
If the matrix is not diagonal, triangular, block triangular, or tridiagonal, inspect its rows and columns for zeros. Cofactor expansion along a row or column uses one term for each nonzero entry there. A row or column with just one nonzero entry can reduce the calculation particularly quickly; a row or column with several nonzero entries may still be the best option if its minors are simple.
Worked Example: Expand Along a Sparse Row
Consider
This matrix is not triangular, block triangular in an evident partition, or tridiagonal. Row 2 has only one nonzero entry, in column 4. Its cofactor sign is \((-1)^{2+4}=1\), so expansion along row 2 gives
Expand this \(3\times3\) determinant along its first row:
Therefore \(\det\mathbf{C}=3(-4)=-12\). The zero entries in row 2 make the first expansion short, and the resulting minor also has a convenient row.
A Reliable Structure-First Routine
The choice of method is a sequence of checks, not a new determinant formula. Use the first applicable shortcut, but make sure its hypotheses really hold.
If the matrix is diagonal or triangular, multiply the diagonal entries. Do not infer triangular form from a few isolated zeros.
If the matrix has square diagonal blocks and a zero block on one side of the block diagonal, multiply the determinants of its diagonal blocks. The other off-diagonal block may be nonzero.
If every entry outside the main and adjacent diagonals is zero, use the recurrence, keeping the adjacent-diagonal product and its minus sign.
When the structural formulas do not apply, compare the number and complexity of the nonzero entries in candidate rows and columns, then expand where the resulting minors are most manageable.
Each method has a distinct condition. A block formula applies to the stated zero-block arrangement, not to any matrix that merely looks as if it has clusters of entries. The tridiagonal recurrence requires the entries outside the three central diagonals to be zero. Cofactor expansion, by contrast, applies to any square matrix, but its efficiency depends on the row or column chosen.
Common Sign Pitfall
A frequent error in the tridiagonal recurrence is to replace the minus sign with a plus sign. For the leading \(2\times2\) part of \(\mathbf{T}\), that incorrect rule would give \(D_2=3(2)+(1)(1)(1)=7\). Directly calculating the determinant gives
The discrepancy comes from the cofactor sign on the entry in row 2, column 1: it is \((-1)^{2+1}=-1\), not \(+1\). The correct recurrence is \(D_2=3(2)-1=5\). When using a recurrence or expansion, keep the cofactor signs attached to the positions of the entries; a zero pattern shortens the arithmetic but does not remove sign rules.
Once a method has produced a value, check it in a way that suits the matrix. A short cofactor expansion is a useful check for a diagonal or triangular product, and a manageable row or column expansion can check a recurrence or block calculation. The check should use the actual entries and signs, rather than simply repeating the same shortcut.
Check Your Understanding
For each question, identify the relevant structure before calculating or explaining your choice.
- What is the determinant of \(\begin{bmatrix}3&0&0\\2&-1&0\\4&5&2\end{bmatrix}\), and which pattern allows a direct calculation?
- For a block upper-triangular matrix \(\begin{bmatrix}\mathbf{A}&\mathbf{B}\\\mathbf{O}&\mathbf{D}\end{bmatrix}\), which blocks must be square, and must \(\mathbf{B}\) be zero?
- For a tridiagonal matrix with \(a_1=4\), \(a_2=2\), \(b_1=3\), and \(c_1=1\), calculate \(D_2\) using \(D_0=1\) and \(D_1=a_1\).
- In \(\begin{bmatrix}1&0&2\\0&0&5\\3&1&0\end{bmatrix}\), which row or column gives a one-term cofactor expansion, and what is the cofactor sign of its nonzero entry?
- Explain why a matrix with zeros everywhere except on the main diagonal and the two adjacent diagonals can use a recurrence, but a matrix with an additional nonzero entry two columns above the diagonal cannot use that same tridiagonal recurrence.