# Cramer's rule

Cramer's rule is a way of solving a system of linear equations using determinants.

Suppose we are trying to solve a system of linear equations such that

...

or Ax = b in matrix form, where

Cramer's Rule says that

where A_{i} is a new matrix formed by replacing the ith column of A with the b vector.

Example

In this case,

By Cramer's rule,

x_{1} |
= | = | = | -5 | ||

x_{2} |
= | = | = | 3 | ||

x_{3} |
= | = | = | -8 |

We can then check that

### Proof

We reinterpret the matrix-vector equation Ax = b as

In other words, b = x_{1}v_{1} + ... + x_{n}v_{n} where each v_{i} is the ith column of matrix A (see Matrix Multiplication). If we plug this expression for b into A_{i}, the matrix made by replacing the ith column of A with b, we get:

From the, properties of determinants, we can perform column operations of the type (i) + k(j) → (i) without changing the determinant. Therefore we can use the columns containing v_{1},..., v_{i - 1}, v_{i + 1},... v_{n} to subtract out every term in x_{1}v_{1} + ... + x_{n}v_{n} except for x_{i}v_{i}. In other words,

From another property of determinants, a column of type k(i) → (i) has the same effect of multiplying the determinant by k. Therefore we can pull the scalar fact x_{i} from the iith column which contains x_{1}v_{i}. In other words,

Since

combining (1.) and (2.) gives us det(A_{i}) = x_{i}det(A). Dividing by det(A) gives us , which is the original statement of Cramer's rule.

### Limitations of Cramer's rule

- Because we are dividing by det(A) to get , Cramer's rule only works if det(A) ≠ 0. If det(A) = 0, Cramer's rule cannot be used because a unique solution doesnt exist since there would be infinitely many solutions, or no solution at all.
- Cramer's rule is slow because we have to evaluate a determinant for each x
_{i}. When we evaluate each det(A_{i}) we have to perform Gaussian elimination on each A_{i}for a total of n times. In comparison, if we were to use the augmented matrix, [A|b], we would only need to perform Gaussian elimination once to solve Ax = b.

See also matrix notation.