# Cramer's rule

**Cramer's rule** is a theorem of linear algebra that gives each component of the solution of a square system of linear equations as a ratio of determinants: for the system \( A\mathbf{x} = \mathbf{b} \) with \( A \) an \( n \times n \) nonsingular matrix, the \( j \)-th unknown is

\[ x_j = \frac{\det(A_j)}{\det(A)}, \qquad j = 1, \ldots, n, \]

where \( A_j \) is the matrix obtained from \( A \) by replacing its \( j \)-th column with \( \mathbf{b} \)<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup><sup> • </sup><sup>[2](https://mjo.osborne.economics.utoronto.ca/index.php/tutorial/index/1/eqs/t)</sup>. The rule was first presented by Gabriel Cramer (1704–1752) in 1750 and is proved in every first course on linear algebra, but as a numerical algorithm it is usable only for small systems, and its floating-point behavior is worse than the familiar operation-count objection suggests<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup><sup> • </sup><sup>[3](https://proofwiki.org/wiki/Cramer%27s_Rule/Historical_Note)</sup>.

| Key fact | Detail |
|---|---|
| Statement | \( x_j = \det(A_j)/\det(A) \), with \( A_j \) equal to \( A \) except that column \( j \) is replaced by \( \mathbf{b} \); requires \( \det(A) \neq 0 \)<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup><sup> • </sup><sup>[2](https://mjo.osborne.economics.utoronto.ca/index.php/tutorial/index/1/eqs/t)</sup> |
| First publication | Gabriel Cramer, appendix to *Introduction à l'analyse des lignes courbes algébriques*, Geneva, 1750<sup>[3](https://proofwiki.org/wiki/Cramer%27s_Rule/Historical_Note)</sup><sup> • </sup><sup>[4](https://nonagon.org/ExLibris/gabriel-cramer-cramers-rule)</sup> |
| Cost by cofactors | \( n+1 \) determinants of \( n! \) terms each; at \( n = 20 \) that is about \( 4.6 \times 10^{19} \) operations<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup> |
| Cost via LU | \( n+1 \) factorizations against elimination's one: 112,000 versus 5,333 operations at \( n = 20 \)<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup> |
| Measured accuracy | On 40,000 nearly parallel 2×2 systems at 24-bit precision, worst backward error 458 units of roundoff for Cramer's rule versus 1.3 for elimination with row interchange<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup> |
| Zero determinant | When \( \det(A) = 0 \) the rule cannot be applied and does not distinguish a system with no solution from one with infinitely many; elimination is needed<sup>[5](https://openstax.org/books/college-algebra-2e/pages/7-8-solving-systems-with-cramers-rule)</sup> |
| Practical niche | Small systems (2×2, 3×3), exact or symbolic arithmetic, and derivations in economics and linear algebra<sup>[6](https://www.datacamp.com/tutorial/cramers-rule)</sup><sup> • </sup><sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup> |

## Statement and scope

The rule applies to a system of \( n \) linear equations in \( n \) unknowns whose coefficient matrix \( A \) is nonsingular, which is equivalent to \( \det(A) \neq 0 \)<sup>[7](https://archive.nptel.ac.in/content/storage2/courses/122104018/node30.html)</sup>. Under that single hypothesis the system has a unique solution, and the rule gives each component separately<sup>[2](https://mjo.osborne.economics.utoronto.ca/index.php/tutorial/index/1/eqs/t)</sup>. For a 3×3 system written \( D \) for the determinant of the coefficient matrix and \( D_x, D_y, D_z \) for the determinants formed by replacing the \( x \), \( y \), and \( z \) columns with the constant column, the solution is \( x = D_x/D \), \( y = D_y/D \), \( z = D_z/D \)<sup>[5](https://openstax.org/books/college-algebra-2e/pages/7-8-solving-systems-with-cramers-rule)</sup>.

When \( \det(A) = 0 \) the rule says nothing about which of the two remaining cases holds. A system with a zero determinant either has no solution or has infinitely many, and deciding between them requires elimination on the system<sup>[5](https://openstax.org/books/college-algebra-2e/pages/7-8-solving-systems-with-cramers-rule)</sup><sup> • </sup><sup>[2](https://mjo.osborne.economics.utoronto.ca/index.php/tutorial/index/1/eqs/t)</sup>.

## Proof

The standard proof runs through the inverse matrix. Since \( A \) is nonsingular, \( \mathbf{x} = A^{-1}\mathbf{b} \), and the \( (i,j) \)-th entry of \( A^{-1} \) is \( (-1)^{i+j}|A_{ji}|/|A| \), where \( A_{ji} \) is the minor obtained by deleting row \( j \) and column \( i \). Expanding \( \det(A_i) \) along its \( i \)-th column, which is \( \mathbf{b} \), gives exactly the sum \( \sum_j (-1)^{i+j} b_j |A_{ji}| \), so \( x_i = \det(A_i)/\det(A) \)<sup>[2](https://mjo.osborne.economics.utoronto.ca/index.php/tutorial/index/1/eqs/t)</sup>. An equivalent proof multiplies \( A\mathbf{x} = \mathbf{b} \) by the adjugate and uses the linearity of the determinant in a single column: \( \det(A \xleftarrow{k} \mathbf{b}) = x_k \det(A) \), because replacing column \( k \) by \( \mathbf{a}_i \) gives \( \det(A) \) when \( i = k \) and 0 otherwise<sup>[8](https://courses.math.wichita.edu/math511/ch3/3/ApplicationsOfDeterminant.html)</sup>.

Cramer himself stated the rule without proof; the proof came later<sup>[4](https://nonagon.org/ExLibris/gabriel-cramer-cramers-rule)</sup>. New proofs continue to appear, including a combinatorial proof published on arXiv in 2024<sup>[9](https://arxiv.org/abs/2408.10282)</sup>.

## History

Gabriel Cramer, a Genevan mathematician, presented the rule in a short appendix titled *De l'évanouissement des inconnues* (On the Vanishing of Unknowns) to his *Introduction à l'analyse des lignes courbes algébriques*, published in Geneva in 1750 by the firm of frères Cramer and Cl. Philibert<sup>[4](https://nonagon.org/ExLibris/gabriel-cramer-cramers-rule)</sup><sup> • </sup><sup>[10](https://www.e-rara.ch/zut/content/titleinfo/1233318)</sup>. The book appeared as 680 pages plus eleven of front matter, and the rule appears on pages 657–659 according to MathWorld's citation of the original<sup>[10](https://www.e-rara.ch/zut/content/titleinfo/1233318)</sup><sup> • </sup><sup>[11](https://mathworld.wolfram.com/CramersRule.html)</sup>. Correspondence shows Cramer had begun the treatise a decade earlier, mentioning a "petit traitté de l'Analyse des Courbes" in a letter to Jean Jallabert in the autumn of 1740<sup>[12](https://smf.emath.fr/system/files/filepdf/RHM_25_2_Joffredo.pdf)</sup>.

## Computational cost

The familiar objection is arithmetic. An \( n \times n \) system needs \( n+1 \) determinants; computed by cofactor expansion, each determinant has \( n! \) terms, and the often-quoted figure is that solving a 20×20 system this way would take longer than the age of the universe<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>. This objection is incomplete, because nobody computes a determinant by cofactor expansion either. Computing each determinant by LU factorization, Cramer's rule costs \( n+1 \) factorizations against elimination's one<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>:

| \( n \) | LU solve | Cramer via LU | Cramer via cofactors |
|---|---|---|---|
| 4 | 43 | 213 | 72 |
| 10 | 667 | 7,333 | \( 3.3 \times 10^{7} \) |
| 20 | 5,333 | 112,000 | \( 4.6 \times 10^{19} \) |

A factor of \( n+1 \) is a poor constant but still a constant, and it would not by itself rule out the rule at \( n = 2 \), where the factor is 3 and the whole computation is six operations<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>.

## Numerical stability

The objection that matters is stability. [Gaussian elimination](https://www.edgepedia.org/gaussian-elimination) with a row interchange is backward stable: the computed solution is the exact solution of a nearby system \( (A + \Delta A)\hat{\mathbf{x}} = \mathbf{b} + \Delta \mathbf{b} \), with \( \|\Delta A\| \) a small multiple of the unit roundoff times \( \|A\| \). Cramer's rule has no bound of this shape at all<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>.

The gap has been measured directly. Over 40,000 two-by-two systems whose rows are nearly parallel, evaluated at 24 significand bits, the worst normwise backward error \( \eta(\hat{\mathbf{x}}) = \|\mathbf{b} - A\hat{\mathbf{x}}\| / (\|A\|\,\|\hat{\mathbf{x}}\| + \|\mathbf{b}\|) \) was 1.3 units of roundoff for elimination with row interchange and 458 units for Cramer's rule. The worst case had a condition number of \( 3.2 \times 10^{4} \), a mildly awkward matrix rather than a pathological one, and elimination solved it to 1.3u<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>. In double precision the same comparison reads 391u for Cramer's rule against 1.4u for elimination<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>.

Because the error axis is measured in units of the format's own roundoff, this is not a shortage of digits. Elimination sits at a bounded multiple of \( u \) at 16, 24, 32, 43, and 53 bits, while Cramer's rule's tail stays at tens to hundreds of \( u \) wherever it is measured; doubling the mantissa buys a stable method eight more correct digits and an unstable one eight more digits of an answer that still solves no nearby problem<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>. The mechanism is a single division by a determinant whose value arises from cancellation of large terms<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>. The 2×2 inverse formula \( A^{-1} = (1/\det A)\begin{bmatrix} a_{22} & -a_{12} \\ -a_{21} & a_{11} \end{bmatrix} \) is the same arithmetic in different form and inherits the same defect, since \( \mathbf{x} = A^{-1}\mathbf{b} \) computed this way is Cramer's rule<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>. At \( n = 3 \) the closed form contains roughly three times as many independent roundings and two subtractions of nearly equal quantities per determinant, and every measured quantity gets worse<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>.

## Where it is still used

**Small and exact computations.** The rule survives in geometry kernels for line–line intersections, barycentric coordinates, and triangle circumcentres, which are 2×2 or 3×3 problems whose input coordinates are often exact integers or fixed-point numbers. Even with exact inputs the stability argument applies whenever the rule is evaluated in finite-precision arithmetic, since the computation is unstable unless carried out exactly<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup><sup> • </sup><sup>[14](https://djvu.online/file/uGJmLc3c54Qe6)</sup>. In exact rational arithmetic the rule has no error at all, and in interval arithmetic it produces an enclosure; it is a poor choice on cost and a sound one on correctness<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>.

**Selective solution.** Because each unknown is computed independently, the rule is particularly useful when only some of the variables in a solution are needed: the value of one variable costs two determinants regardless of how many other variables exist<sup>[2](https://mjo.osborne.economics.utoronto.ca/index.php/tutorial/index/1/eqs/t)</sup>.

**Theory and economics.** As a formula rather than an algorithm, the rule underlies the adjugate, the closed form for the matrix inverse, and the derivative of a determinant<sup>[1](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)</sup>. In comparative statics, economists use it to solve the differentiated first-order conditions of an equilibrium for the response of each endogenous variable, since the shared denominator means the signs of comparative-static derivatives can often be read from the numerators alone<sup>[13](https://eclass.aueb.gr/modules/document/file.php/DEOS422/%CE%92%CE%B9%CE%B2%CE%BB%CE%B9%CE%BF%CE%B3%CF%81%CE%B1%CF%86%CE%AF%CE%B1/Textbooks/Walter%20Nicholson_%20Christopher%20M.%20Snyder%20-%20Microeconomic%20Theory_%20Basic%20Principles%20and%20Extensions-Cengage%20Learning%20%282016%29.pdf)</sup>. For systems larger than about 3×3, numerical practice uses Gaussian elimination with partial pivoting at \( O(n^{3}) \) cost, [LU decomposition](https://www.edgepedia.org/lu-decomposition) for many right-hand sides with the same matrix, or [QR decomposition](https://www.edgepedia.org/qr-decomposition) for ill-conditioned systems<sup>[6](https://www.datacamp.com/tutorial/cramers-rule)</sup>.

## References

1. [A rule that is correct and unusable, Numerical Linear Algebra](https://www.numerical-linear-algebra.com/essays/a-rule-that-is-correct-and-unusable/)
2. [Mathematical methods for economic theory: 1.3 Solving systems of linear equations, M. J. Osborne, University of Toronto](https://mjo.osborne.economics.utoronto.ca/index.php/tutorial/index/1/eqs/t)
3. [Cramer's Rule/Historical Note, ProofWiki](https://proofwiki.org/wiki/Cramer%27s_Rule/Historical_Note)
4. [Gabriel Cramer on Cramer's Rule, Ex Libris](https://nonagon.org/ExLibris/gabriel-cramer-cramers-rule)
5. [7.8 Solving Systems with Cramer's Rule, College Algebra 2e, OpenStax](https://openstax.org/books/college-algebra-2e/pages/7-8-solving-systems-with-cramers-rule)
6. [Cramer's Rule: A Direct Method for Solving Linear Systems, DataCamp](https://www.datacamp.com/tutorial/cramers-rule)
7. [Cramer's Rule, NPTEL course notes](https://archive.nptel.ac.in/content/storage2/courses/122104018/node30.html)
8. [Applications of Determinants, Wichita State University course notes](https://courses.math.wichita.edu/math511/ch3/3/ApplicationsOfDeterminant.html)
9. [A combinatorial proof of Cramer's Rule, arXiv:2408.10282](https://arxiv.org/abs/2408.10282)
10. [Introduction à l'analyse des lignes courbes algébriques, ETH-Bibliothek Zürich, Rar 4992](https://www.e-rara.ch/zut/content/titleinfo/1233318)
11. [Cramer's Rule, Wolfram MathWorld](https://mathworld.wolfram.com/CramersRule.html)
12. [Genèse de l'analyse des courbes de Gabriel Cramer, Revue d'histoire des mathématiques](https://smf.emath.fr/system/files/filepdf/RHM_25_2_Joffredo.pdf)
13. [Mathematics for Microeconomics, Nicholson and Snyder, Microeconomic Theory (2016)](https://eclass.aueb.gr/modules/document/file.php/DEOS422/%CE%92%CE%B9%CE%B2%CE%BB%CE%B9%CE%BF%CE%B3%CF%81%CE%B1%CF%86%CE%AF%CE%B1/Textbooks/Walter%20Nicholson_%20Christopher%20M.%20Snyder%20-%20Microeconomic%20Theory_%20Basic%20Principles%20and%20Extensions-Cengage%20Learning%20%282016%29.pdf)
14. [djvu.online](https://djvu.online/file/uGJmLc3c54Qe6)

---
*Topic: Encyclopedia › Physical world and mathematics › Mathematics and statistics › Numbers and algebra › Linear and multilinear algebra › Matrix theory › Determinants and minors*

*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license
