Cramer's rule as a construction

Cramer's rule gives a closed-form solution to the n-by-n linear system Ax = b, assuming the determinant of A is nonzero. The derivation starts from a cleverly built matrix: take the identity matrix and replace its first column with the vector x. Multiplying A by this special matrix yields:

C_1

Since the determinant of this product factors (the product property of determinants), we can isolate x. The determinant of the special matrix itself is trivial to compute—it reduces to the first component of x—which leads directly to:

\[ x = \frac{\det(B_1)}{\det(A)} \]

where B_1 is A with its first column replaced by b. Applying the same trick with the second, third, and later columns, generalizes to:

C_2

For each i, the solution component x_i equals the ratio of det(B_i) to det(A), where B_i is formed by swapping the i-th column of A with the vector b. This is Cramer's rule in its standard form.

The argument above is motivating rather than fully rigorous. A formal proof is available on Wikipedia's Cramer's rule page.

What it yields for matrix inversion

The same logic can be turned around to express the inverse of a matrix. Write the unknown inverse as a matrix X, with columns that must satisfy A X = I. Each column of X is therefore a solution to a linear system where the right-hand side is the corresponding column of the identity matrix.

For a 2-by-2 matrix, solving those two systems explicitly with Cramer's rule produces the familiar closed-form inverse:

\[ A^{-1} = \frac{1}{\det(A)} \begin{pmatrix} d & -b \\ -c & a \end{pmatrix} \]

This formula is exact and valid whenever det(A) ≠ 0. It is the compact result that most practitioners recognize.

Why it doesn't scale

The same procedure extends to larger matrices, but the cost grows quickly. Inverting a 3-by-3 matrix via Cramer's rule requires computing nine determinants, each of which is a 2-by-2 minor (the cofactor of the corresponding entry). In general, for an n-by-n matrix, you need n² such cofactors, each a determinant of an (n-1)-by-(n-1) submatrix. Recursing down, the total work scales as O(n!), which is intractable beyond very small sizes.

O(n^3)

Gauss-Jordan elimination, by contrast, solves the same problem in O(n³) time. For that reason, Cramer's rule is not used for numerical work—neither for inverting matrices nor for solving systems. Its practical value is confined to very small matrices and to generating symbolic formulas, such as the 2-by-2 inverse shown above.

[1]This is just straightforward matrix multiplication, and using the fact that etc.
[2]Feel free to check this on paper by performing the full multiplication between A and in their symbolic form and noticing that you only need the first column of to obtain the first column of the result.