Tutorials › Linear Algebra › Three-Variable Systems with Strategic Cofactor Expansion

Cramer's Rule, Adjugate and Volume · Tutorial 259 of 1000

Three-Variable Systems with Strategic Cofactor Expansion

Use Cramer’s Rule to solve exact three-variable systems, choosing sparse rows or columns to simplify the determinant calculations.

Intermediate 9 min read

What You'll Learn

  • Set up the coefficient and column-replacement determinants for a three-variable system.
  • Choose a row or column expansion that reduces the arithmetic in each determinant.
  • Track cofactor signs when expanding along any row or column.
  • Apply Cramer’s Rule only when the coefficient determinant is nonzero.
  • Check each calculated coordinate by substitution into the original equations.

From a Three-Variable System to Determinants

A system of three linear equations in three unknowns can be written as \(\mathbf{A}\mathbf{x}=\mathbf{b}\), where \(\mathbf{A}\in\mathbb{R}^{3\times3}\) is the coefficient matrix, \(\mathbf{x}=(x_1,x_2,x_3)^\top\), and \(\mathbf{b}\in\mathbb{R}^3\). When \(\det\mathbf{A}\ne0\), Cramer’s Rule gives each unknown as a ratio of determinants. The main work is often not the rule itself but choosing a useful cofactor expansion for each determinant and keeping the signs straight.

For a \(3\times3\) matrix, a cofactor expansion writes its determinant as a sum of three terms. Each term is one matrix entry multiplied by a signed \(2\times2\) minor. The minor is formed by deleting the row and column containing that entry; its sign is positive or negative according to the entry’s position. In practice, an expansion along a row or column with zeros usually requires fewer calculations. Since replacing a different column changes the entries, the best expansion can differ from one Cramer determinant to another.

Definition: For \(\mathbf{A}=(a_{ij})\in\mathbb{R}^{3\times3}\), the minor \(M_{ij}\) is the determinant of the \(2\times2\) matrix obtained by deleting row \(i\) and column \(j\). The cofactor is \(C_{ij}=(-1)^{i+j}M_{ij}\). The cofactor expansion along row \(i\) is \(\det\mathbf{A}=\sum_{j=1}^3 a_{ij}C_{ij}\), and the expansion along column \(j\) is \(\det\mathbf{A}=\sum_{i=1}^3 a_{ij}C_{ij}\).

The signs follow the checkerboard pattern \(\begin{bmatrix}+&-&+\\-&+&-\\+&-&+\end{bmatrix}\). For example, the cofactor at position \((2,1)\) has a negative sign, while the cofactor at position \((1,3)\) has a positive sign. The determinant formula for a \(2\times2\) matrix is \(\begin{vmatrix}a&b\\c&d\end{vmatrix}=ad-bc\).

Theorem (Cofactor expansion): For any \(3\times3\) matrix, its determinant equals the cofactor expansion along each row and along each column.

Proof. By the permutation definition of the determinant, each term corresponds to a choice of one entry in each row and each column, with sign equal to the sign of the corresponding permutation. To expand along row \(i\), group the determinant terms according to the column \(j\) chosen for that row. In each group, the factor from row \(i\) is \(a_{ij}\). The remaining two factors form the determinant of the matrix with row \(i\) and column \(j\) deleted, with the sign adjusted by \((-1)^{i+j}\). Thus the group is \(a_{ij}C_{ij}\), and summing the three groups gives the row expansion. Grouping instead by the row chosen for a fixed column gives the column expansion by the same permutation argument. \(\square\)

Cramer’s Rule and Its Requirement

Let \(\mathbf{a}_1,\mathbf{a}_2,\mathbf{a}_3\) be the columns of \(\mathbf{A}\). For \(k=1,2,3\), let \(\mathbf{A}_k(\mathbf{b})\) be the matrix obtained by replacing column \(k\) of \(\mathbf{A}\) with \(\mathbf{b}\). The denominator is the coefficient determinant \(D=\det\mathbf{A}\), while the numerator for \(x_k\) is \(D_k=\det\mathbf{A}_k(\mathbf{b})\).

Theorem (Cramer’s Rule): If \(\mathbf{A}\in\mathbb{R}^{3\times3}\) and \(\det\mathbf{A}\ne0\), then the system \(\mathbf{A}\mathbf{x}=\mathbf{b}\) has a unique solution, and its coordinates are \(x_k=\dfrac{\det\mathbf{A}_k(\mathbf{b})}{\det\mathbf{A}}\) for \(k=1,2,3\).

Proof. Since \(\det\mathbf{A}\ne0\), the determinant test for invertibility gives an inverse for \(\mathbf{A}\); hence \(\mathbf{A}\mathbf{x}=\mathbf{b}\) has a unique solution. For that solution, \(\mathbf{b}=x_1\mathbf{a}_1+x_2\mathbf{a}_2+x_3\mathbf{a}_3\). Fix \(k\) and use linearity of the determinant in column \(k\) of \(\mathbf{A}_k(\mathbf{b})\). The term involving \(x_k\) is \(x_k\det\mathbf{A}\). Each term involving \(x_j\) with \(j\ne k\) has two equal columns, namely \(\mathbf{a}_j\), so its determinant is zero. Therefore \(\det\mathbf{A}_k(\mathbf{b})=x_k\det\mathbf{A}\). Division by the nonzero number \(\det\mathbf{A}\) gives the stated formula for each \(k\). \(\square\)

The condition \(\det\mathbf{A}\ne0\) is essential: it is what makes the quotients defined and guarantees a unique solution. If the coefficient determinant is zero, these formulas cannot be used to conclude that a unique solution exists. The first step in any Cramer calculation is therefore to compute \(D\) and check that it is nonzero.

Choose an Expansion for Each Determinant

Worked Example: A Sparse Row in the Coefficient Matrix

Solve the system \(x_1+2x_3=1\), \(x_2+3x_3=2\), \(2x_1+x_3=5\) by Cramer’s Rule.

The coefficient matrix and right-hand side are

$$ \mathbf{A}=\begin{bmatrix}1&0&2\\0&1&3\\2&0&1\end{bmatrix}, \qquad \mathbf{b}=\begin{bmatrix}1\\2\\5\end{bmatrix}. $$

Row 1 has a zero, and row 2 has two zeros, so expand \(D=\det\mathbf{A}\) along row 2. Its only nonzero entry is \(1\) in position \((2,2)\), whose cofactor sign is positive:

$$ D=1\begin{vmatrix}1&2\\2&1\end{vmatrix} =1(1-4)=-3. $$

Since \(D\ne0\), Cramer’s Rule applies. For \(D_1\), replace column 1 with \(\mathbf{b}\). Column 2 still has just one nonzero entry, so expand down that column:

$$ D_1=\det\begin{bmatrix}1&0&2\\2&1&3\\5&0&1\end{bmatrix} =1\begin{vmatrix}1&2\\5&1\end{vmatrix} =1(1-10)=-9. $$

For \(D_2\), replace column 2. Expanding along row 2 uses its zero in column 3 and accounts for the negative cofactor sign at position \((2,1)\):

$$ \begin{aligned} D_2 &=\det\begin{bmatrix}1&1&2\\0&2&3\\2&5&1\end{bmatrix}\\ &=-0\begin{vmatrix}1&2\\5&1\end{vmatrix} +2\begin{vmatrix}1&2\\2&1\end{vmatrix} -3\begin{vmatrix}1&1\\2&5\end{vmatrix}\\ &=0+2(1-4)-3(5-2)=-6-9=-15. \end{aligned} $$

For \(D_3\), row 2 has only one nonzero entry, so use that row:

$$ \begin{aligned} D_3 &=\det\begin{bmatrix}1&0&1\\0&1&2\\2&0&5\end{bmatrix}\\ &=1\begin{vmatrix}1&1\\2&5\end{vmatrix} =1(5-2)=3. \end{aligned} $$

The coordinates are \(x_1=D_1/D=3\), \(x_2=D_2/D=5\), and \(x_3=D_3/D=-1\). Check them in the original equations: \(3+2(-1)=1\), \(5+3(-1)=2\), and \(2(3)+(-1)=5\). All three equations hold.

This example illustrates the strategic choice: expansion down column 2 was efficient for \(D\) and \(D_1\), while a row expansion was convenient for \(D_2\) and \(D_3\). It is legitimate to choose a different row or column for every determinant; each expansion computes the same determinant for that particular matrix.

Worked Example: Track the Signs in a Dense Replacement

Solve \(x_1+2x_2+x_3=1\), \(x_2+3x_3=2\), \(2x_1+x_3=5\). Here the coefficient matrix has a useful sparse second row, but some replacement matrices are denser.

Write

$$ \mathbf{A}=\begin{bmatrix}1&2&1\\0&1&3\\2&0&1\end{bmatrix}, \qquad \mathbf{b}=\begin{bmatrix}1\\2\\5\end{bmatrix}. $$

Expand \(D\) along row 2. The entry \(1\) at \((2,2)\) contributes \(-1\), and the entry \(3\) at \((2,3)\) has a negative cofactor sign:

$$ \begin{aligned} D &=1\begin{vmatrix}1&1\\2&1\end{vmatrix} -3\begin{vmatrix}1&2\\2&0\end{vmatrix}\\ &=(1-2)-3(0-4)=-1+12=11. \end{aligned} $$

For \(D_1\), replacing column 1 gives a row with a zero in column 2, so expand along row 3, whose middle entry is also zero:

$$ \begin{aligned} D_1 &=\det\begin{bmatrix}1&2&1\\2&1&3\\5&0&1\end{bmatrix}\\ &=5\begin{vmatrix}2&1\\1&3\end{vmatrix} +1\begin{vmatrix}1&2\\2&1\end{vmatrix}\\ &=5(6-1)+(1-4)=25-3=22. \end{aligned} $$

For \(D_2\), expand along row 2. The middle cofactor is positive; the last cofactor is negative:

$$ \begin{aligned} D_2 &=\det\begin{bmatrix}1&1&1\\0&2&3\\2&5&1\end{bmatrix}\\ &=2\begin{vmatrix}1&1\\2&1\end{vmatrix} -3\begin{vmatrix}1&1\\2&5\end{vmatrix}\\ &=2(1-2)-3(5-2)=-2-9=-11. \end{aligned} $$

For \(D_3\), row 2 again gives a short expansion:

$$ \begin{aligned} D_3 &=\det\begin{bmatrix}1&2&1\\0&1&2\\2&0&5\end{bmatrix}\\ &=1\begin{vmatrix}1&1\\2&5\end{vmatrix} -2\begin{vmatrix}1&2\\2&0\end{vmatrix}\\ &=(5-2)-2(0-4)=3+8=11. \end{aligned} $$

Thus \(x_1=22/11=2\), \(x_2=-11/11=-1\), and \(x_3=11/11=1\). Substitution checks the solution: \(2+2(-1)+1=1\), \(-1+3(1)=2\), and \(2(2)+1=5\).

Expansion Choice and a Common Sign Error

For each determinant, inspect its rows and columns before calculating. A useful choice usually has the most zero entries; if there is a tie, compare the sizes of the nonzero entries and the minors that would remain. A zero entry contributes nothing, but it does not remove the need to use the cofactor sign for the other entries in that row or column. In a \(3\times3\) problem, all minors are \(2\times2\), so writing out each minor makes the arithmetic auditable.

Common mistake: losing the cofactor sign. For the coefficient matrix from the first worked example, expanding along row 1 gives

$$ \det\begin{bmatrix}1&0&2\\0&1&3\\2&0&1\end{bmatrix} =1\begin{vmatrix}1&3\\0&1\end{vmatrix} +2\begin{vmatrix}0&1\\2&0\end{vmatrix} =1+2(-2)=-3. $$

The entry \(2\) is in position \((1,3)\), whose sign is positive; the minor itself is \(0\cdot0-1\cdot2=-2\). A wrong calculation would change that cofactor sign to negative and write \(1-2(-2)=5\). The correction is to keep the position sign and the minor’s own value distinct: the contribution is \(+2(-2)=-4\), so the determinant is \(1-4=-3\). This agrees with the row-2 expansion used earlier.

A second pitfall is dividing by a zero determinant. If \(\det\mathbf{A}=0\), the Cramer quotients are undefined. For instance, the first two rows of \(\begin{bmatrix}1&2&3\\2&4&6\\0&1&1\end{bmatrix}\) are multiples, so its determinant is zero. The system with right-hand side \((1,3,0)^\top\) would require both \(x_1+2x_2+3x_3=1\) and \(2x_1+4x_2+6x_3=3\); doubling the first equation gives a left side matching the second but a right side of \(2\), not \(3\). Thus this system is inconsistent, and Cramer’s Rule does not apply.

A Reliable Calculation Sequence

1
Form the coefficient matrix.
Place the coefficients of \(x_1,x_2,x_3\) in columns 1, 2, and 3, and write the right-hand side as a column vector \(\mathbf{b}\).
2
Compute \(D=\det\mathbf{A}\).
Choose a row or column with zeros when possible. If \(D=0\), stop: the Cramer quotients cannot be formed.
3
Compute the replacement determinants.
For \(D_k\), replace only column \(k\) with \(\mathbf{b}\). Choose an expansion suited to that new matrix and preserve the checkerboard cofactor signs.
4
Divide and verify.
Use \(x_k=D_k/D\), then substitute the resulting coordinates into all three original equations.

The final substitution is more than a formality. It checks both the determinant arithmetic and the correspondence between each replacement determinant and its variable. If one equation fails, recheck the column replacement, the cofactor signs, and the \(2\times2\) minor calculations before accepting the result.

Check Your Understanding

For each system, begin by checking whether Cramer’s Rule applies. Keep the replacement matrices and expansions visible, then verify any solution in the original equations.

  1. For \(\mathbf{A}=\begin{bmatrix}1&0&1\\2&1&0\\0&3&1\end{bmatrix}\) and \(\mathbf{b}=\begin{bmatrix}4\\1\\5\end{bmatrix}\), compute \(D\) using a row or column with a zero.
  2. For \(\mathbf{A}=\begin{bmatrix}2&1&0\\1&1&1\\0&2&1\end{bmatrix}\) and \(\mathbf{b}=\begin{bmatrix}1\\2\\0\end{bmatrix}\), find the solution by Cramer’s Rule and check all three equations.
  3. In a cofactor expansion, what sign belongs to the entry in position \((2,3)\)? Explain how that sign combines with a negative minor.
  4. Why does \(\det\mathbf{A}=0\) prevent use of the Cramer quotients? Does it by itself show that a system is inconsistent?
  5. For \(\mathbf{A}=\begin{bmatrix}1&2&0\\0&1&3\\2&0&1\end{bmatrix}\), identify a row or column that is convenient for expanding \(\det\mathbf{A}\), and state why.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon