Linear algebra/Cramer's rule

Cramer's rule can be used to solve N linear equations with N unknown variables. If N=3, the unknowns might be {x,y,z} and the linear equations might be:

Mathematics
Cramer's Rule
Subject classification: this is a mathematics resource.
Educational level: this is a secondary education resource.
Educational level: this is a tertiary (university) resource.

The "coefficient matrix" is a set of N^2 numbers {A, B..., I}. Here, we assume that these numbers are known. Also assumed known are the numbers {P, Q, R}, which are are often called the "right hand side". The goal is to find the unknown values of (x, y, z). This system may or may not have a unique soluton, as will be shown below.

If the number of equations were greater than the number of unknowns, there would be no solutions except in unusual circumstances. If the number of equations were less than the number of unknowns, there would be infinitely many solutions. Neither of those cases is covered by Cramer's rule.

Cramer's rule gives the solution in terms of the determinants of the coefficient matrix and the coefficient matrix with individual columns replaced. It says that the value of the nth unknown is the quotient of the determinant of the coefficient matrix with its nth column replaced by the right-hand-side numbers, divided by the determinant of the unmodified coefficient matrix.

For the 3-equation example given above:

This works for any number of equations.

It can be seen that this will fail if the determinant of the coefficient matrix is zero, that is, the matrix is singular.

While Cramer's rule is certainly an elegant expression of the solution, it is not necessarily a useful way to solve a system of linear equations by hand where the number of equations is greater than about 3. This is because pencil-and-paper evaluation of determinants is a tedious and error-prone process. Computer programs to solve linear systems could use Cramer's rule, but they typically use Gaussian elimination, which is the computer equivalent of the "multiply by a constant and subtract" method that is taught in algebra classes.