# Cramer's rule

**Cramer's rule** is an elegant formula for the solutions of a system of linear equations. A typical *linear system* (also known as a set of "simultaneous linear equations") is a set of N linear equations in N variables (or "unknowns".)

For N=3, it might look like this:

The numbers A...I (the "coefficient matrix") are given, as are the numbers P, Q, R (the "right-hand-sides".) The values of x, y, z (the "unknowns") are to be found. A system of N linear equations in N unknowns has a uniquely determined solution except in unusual circumstances (the coefficient matrix having determinant zero, 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 n^{th} unknown is the quotient of the determinant of the coefficient matrix with its n^{th} 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.