Tutorials › Linear Algebra › When Cramer’s Rule Becomes Inefficient

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

When Cramer's Rule Becomes Inefficient

Distinguish the practical cost of repeated determinant calculations from the mathematical condition that determines whether a square system has a unique solution.

Intermediate 9 min read

What You'll Learn

  • State the conditions required to apply Cramer's Rule.
  • Explain why finding every unknown can require many determinant calculations.
  • Compare Cramer's Rule with row reduction on a three-variable system.
  • Distinguish the consequences of a zero coefficient determinant.
  • Check whether a singular system is inconsistent or has infinitely many solutions.

When a Correct Rule Is the Wrong Tool

Cramer's Rule gives an exact formula for the solution of a square linear system, but a formula can be mathematically valid and still be a poor way to calculate. If a system has many unknowns and every unknown is needed, the rule calls for several determinants. Row reduction, by contrast, uses the same sequence of operations to find all the unknowns. A separate issue arises when the coefficient determinant is zero: then the denominators in Cramer's formulas vanish, and the rule does not apply. That failure does not by itself say whether the system has no solutions or infinitely many.

Let \(\mathbf{A}\in\mathbb{R}^{n\times n}\) be the coefficient matrix, \(\mathbf{x}=(x_1,\dots,x_n)^{\top}\) the unknown vector, and \(\mathbf{b}\in\mathbb{R}^n\) the right-hand side. For each \(i\), let \(\mathbf{A}_i(\mathbf{b})\) be the matrix formed by replacing column \(i\) of \(\mathbf{A}\) with \(\mathbf{b}\). Cramer's Rule, derived by replacing columns, says that if \(\det\mathbf{A}\ne0\), then the system \(\mathbf{A}\mathbf{x}=\mathbf{b}\) has the unique solution

$$ x_i=\frac{\det\mathbf{A}_i(\mathbf{b})}{\det\mathbf{A}}, \qquad i=1,\dots,n. $$

The nonzero determinant is essential: it makes every displayed quotient defined. It also guarantees that the system has a unique solution. These facts are related, but it is useful to separate two questions: Can the formula be applied? and Is it an efficient way to calculate what is wanted?

Why Repeated Determinants Can Be Inefficient

To find all \(n\) components using Cramer's Rule, one calculates the denominator \(\det\mathbf{A}\) and the \(n\) numerators \(\det\mathbf{A}_i(\mathbf{b})\). That is \(n+1\) determinants. For small systems, these may be manageable. For a large system, doing a separate determinant calculation for each component can repeat a great deal of work.

The work depends on the method used. Expanding a determinant by permutations involves up to \(n!\) signed products, so direct expansion becomes unwieldy as \(n\) grows. Determinants can instead be computed using row operations, which is much more efficient than a full expansion. But if that method is applied independently to each of the \(n+1\) matrices, it still repeats substantial work. For a dense \(n\times n\) system, elimination typically takes on the order of \(n^3\) arithmetic operations to solve for all the unknowns at once; separate determinant computations by elimination can take on the order of \(n^4\). These are rough comparisons, not guarantees for every matrix or implementation.

This is a matter of computational convenience, not mathematical validity. When \(\det\mathbf{A}\ne0\), Cramer's Rule remains correct regardless of the size of the system. It may be useful when the system is small, when an exact symbolic formula is wanted, or when only one particular unknown is needed. If all the unknowns in a large system are required, row reduction usually avoids recalculating determinant information for each one.

Worked Example: Comparing Cramer's Rule with Row Reduction

Solve the system with coefficient matrix \(\mathbf{A}=\begin{bmatrix}1&1&1\\2&3&1\\1&-1&2\end{bmatrix}\) and right-hand side \(\mathbf{b}=(6,11,5)^{\top}\). This small example lets us compare the calculations without making them lengthy.

First, Cramer's Rule requires \(\det\mathbf{A}\) and three replacement determinants. Expanding along the first row gives

$$ \det\mathbf{A} =1(6+1)-1(4-1)+1(-2-3) =7-3-5=-1. $$

Replace column 1 by \(\mathbf{b}\) to obtain \(\mathbf{A}_1(\mathbf{b})\). Expanding along its first row gives

$$ \det\mathbf{A}_1(\mathbf{b}) =6(6+1)-1(22-5)+1(-11-15) =42-17-26=-1, \qquad x_1=\frac{-1}{-1}=1. $$

For column 2, the replacement determinant is

$$ \det\mathbf{A}_2(\mathbf{b}) =1(22-5)-6(4-1)+1(10-11) =17-18-1=-2, \qquad x_2=\frac{-2}{-1}=2. $$

For column 3, it is

$$ \det\mathbf{A}_3(\mathbf{b}) =1(15+11)-1(10-11)+6(-2-3) =26+1-30=-3, \qquad x_3=\frac{-3}{-1}=3. $$

So Cramer's Rule gives \(\mathbf{x}=(1,2,3)^{\top}\). Alternatively, row-reduce the augmented matrix, subtracting \(2R_1\) from \(R_2\) and \(R_1\) from \(R_3\), then adding \(2R_2\) to \(R_3\):

$$ \begin{bmatrix} 1&1&1&6\\ 2&3&1&11\\ 1&-1&2&5 \end{bmatrix} \sim \begin{bmatrix} 1&1&1&6\\ 0&1&-1&-1\\ 0&-2&1&-1 \end{bmatrix} \sim \begin{bmatrix} 1&1&1&6\\ 0&1&-1&-1\\ 0&0&-1&-3 \end{bmatrix}. $$

The last row gives \(x_3=3\). The second row gives \(x_2-x_3=-1\), so \(x_2=2\); the first gives \(x_1+x_2+x_3=6\), so \(x_1=1\). Check: \(\mathbf{A}\mathbf{x}=(1+2+3,\;2+6+3,\;1-2+6)^{\top}=(6,11,5)^{\top}=\mathbf{b}\). Both methods work here, but row reduction obtains all three unknowns in one sequence of operations rather than calculating four determinants.

What a Zero Determinant Actually Means

If \(\det\mathbf{A}=0\), Cramer's formulas have zero denominators, so they cannot be used. The determinant test for invertibility says that a square matrix has determinant zero exactly when it is not invertible. In this case, the columns of \(\mathbf{A}\) are linearly dependent: there is a vector \(\mathbf{z}\ne\mathbf{0}\) such that \(\mathbf{A}\mathbf{z}=\mathbf{0}\). This gives a precise way to understand what can happen to the solutions.

Theorem: Let \(\mathbf{A}\in\mathbb{R}^{n\times n}\). If \(\det\mathbf{A}\ne0\), then \(\mathbf{A}\mathbf{x}=\mathbf{b}\) has exactly one solution for every \(\mathbf{b}\in\mathbb{R}^n\). If \(\det\mathbf{A}=0\), then for every \(\mathbf{b}\), the system has either no solutions or infinitely many solutions; it never has exactly one.

Proof. If \(\det\mathbf{A}\ne0\), the determinant test for invertibility gives an inverse \(\mathbf{A}^{-1}\). Multiplying \(\mathbf{A}\mathbf{x}=\mathbf{b}\) by \(\mathbf{A}^{-1}\) gives \(\mathbf{x}=\mathbf{A}^{-1}\mathbf{b}\), so a solution exists. If \(\mathbf{x}_1\) and \(\mathbf{x}_2\) are two solutions, then \(\mathbf{A}(\mathbf{x}_1-\mathbf{x}_2)=\mathbf{0}\). Multiplying by \(\mathbf{A}^{-1}\) gives \(\mathbf{x}_1-\mathbf{x}_2=\mathbf{0}\), so the solution is unique. Now suppose \(\det\mathbf{A}=0\). Dependence of the columns gives \(\mathbf{z}\ne\mathbf{0}\) with \(\mathbf{A}\mathbf{z}=\mathbf{0}\). If the system has no solution, it has none to count. If it has a solution \(\mathbf{x}_0\), then for every \(t\in\mathbb{R}\), \(\mathbf{A}(\mathbf{x}_0+t\mathbf{z})=\mathbf{A}\mathbf{x}_0+t\mathbf{A}\mathbf{z}=\mathbf{b}\). These solutions are distinct for distinct \(t\), because \(\mathbf{z}\ne\mathbf{0}\). Thus there are infinitely many solutions. \(\square\)

The theorem distinguishes two conclusions that are often confused. A zero determinant rules out a unique solution, but it does not say that the equations are inconsistent. The right-hand side determines whether the system is consistent.

Worked Example: A Singular System with Infinitely Many Solutions

Consider \(\begin{bmatrix}1&2\\2&4\end{bmatrix}\mathbf{x}=(3,6)^{\top}\). Its determinant is \(1\cdot4-2\cdot2=0\), so Cramer's Rule cannot be applied. The equations are \(x_1+2x_2=3\) and \(2x_1+4x_2=6\); the second is twice the first. Let \(x_2=t\). Then \(x_1=3-2t\), so all solutions are

$$ \mathbf{x}= \begin{bmatrix}3-2t\\t\end{bmatrix}, \qquad t\in\mathbb{R}. $$

Check: multiplying gives \((3-2t)+2t=3\) in the first row and \(2(3-2t)+4t=6\) in the second. Every real \(t\) gives a solution, and different values of \(t\) give different vectors.

Worked Example: A Singular System with No Solution

Keep the same coefficient matrix but change the right-hand side to \((3,7)^{\top}\). The equations are \(x_1+2x_2=3\) and \(2x_1+4x_2=7\). Twice the first equation has left-hand side \(2x_1+4x_2\), but its right-hand side is \(6\), not \(7\). Thus the equations would require \(6=7\), which is impossible.

Row reduction records the contradiction directly:

$$ \begin{bmatrix} 1&2&3\\ 2&4&7 \end{bmatrix} \sim \begin{bmatrix} 1&2&3\\ 0&0&1 \end{bmatrix} \qquad (R_2\to R_2-2R_1). $$

The last row represents \(0=1\), so the system has no solution. Check: any values satisfying the first equation would make \(2x_1+4x_2=6\), contradicting the second equation's required value \(7\).

Common Mistakes and a Practical Choice

Mistake: concluding that determinant zero means no solution. In the consistent example, \(\det\mathbf{A}=0\), yet every vector \((3-2t,t)^{\top}\) solves the system. The correction is to use the determinant only to rule out a unique solution; then inspect the equations or row-reduce the augmented matrix to determine whether the system is inconsistent or has infinitely many solutions.

Mistake: dividing by zero in a Cramer's formula. For the consistent example, replacing the first column by \(\mathbf{b}=(3,6)^{\top}\) gives \(\begin{bmatrix}3&2\\6&4\end{bmatrix}\), whose determinant is \(3\cdot4-2\cdot6=0\). The proposed expression \(x_1=0/0\) is undefined, not a value for \(x_1\). Row reduction instead shows that \(x_1=3-2t\), with \(t\) free.

Use Cramer's Rule when its hypotheses hold and the determinant calculations are a reasonable amount of work—especially for small systems or a requested component. For larger systems where all unknowns are needed, prefer row reduction: it addresses both invertible and singular systems, and its sequence of operations also reveals whether the equations are inconsistent. The determinant answers an important structural question, but it is not always the best calculation to repeat.

Check Your Understanding

For each question, distinguish what follows from the determinant from what requires solving or inspecting the system.

  1. A \(4\times4\) coefficient matrix has nonzero determinant. What does this guarantee about the solutions for every right-hand side?
  2. Why does finding all unknowns with Cramer's Rule require \(n+1\) determinants for an \(n\times n\) system?
  3. For \(\begin{bmatrix}1&3\\2&6\end{bmatrix}\mathbf{x}=(4,8)^{\top}\), determine whether there are no solutions or infinitely many, and verify your result.
  4. For the same coefficient matrix with right-hand side \((4,9)^{\top}\), explain why the system is inconsistent.
  5. In one sentence, distinguish computational inefficiency from failure of Cramer's Rule's nonzero-determinant condition.

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