# Linear Algebra/Cramer's Rule

**Cramer's Rule**[edit]

Let's try to solve the systems of linear equations:

a_{11}x_{1}+a_{12}x_{2}+a_{13}x_{3}+...+a_{1n}x_{n}=b_{1}

a_{21}x_{1}+a_{22}x_{2}+a_{23}x_{3}+...+a_{2n}x_{n}=b_{2}

a_{31}x_{1}+a_{32}x_{2}+a_{33}x_{3}+...+a_{3n}x_{n}=b_{3}

...

a_{n1}x_{1}+a_{n2}x_{2}+a_{n3}x_{3}+...+a_{nn}x_{n}=b_{n}

Which is the special case when the number of equations and the number of variables are the same.

Consider the matrix

to be denoted D.

First, we multiply the nth equation by the cofactor Co(a_{nj}) for the jth column, and add it all up. This gets us

Co(a_{1j})a_{11}x_{1}+Co(a_{1j})a_{12}x_{2}+Co(a_{1j})a_{13}x_{3}+...+Co(a_{1j})a_{1n}x_{n}+

Co(a_{2j})a_{21}x_{1}+Co(a_{2j})a_{22}x_{2}+Co(a_{2j})a_{23}x_{3}+...+Co(a_{2j})a_{2n}x_{n}+

Co(a_{3j})a_{31}x_{1}+Co(a_{3j})a_{32}x_{2}+Co(a_{3j})a_{33}x_{3}+...+Co(a_{3j})a_{3n}x_{n}+

+...+

Co(a_{nj})a_{n1}x_{1}+Co(a_{nj})a_{n2}x_{2}+Co(a_{nj})a_{n3}x_{3}+...+Co(a_{nj})a_{nn}x_{n}

=

Co(a_{1j})b_{1}+Co(a_{2j})b_{2}+Co(a_{3j})b_{3}+...+Co(a_{nj})b_{n}.

The left side cancels out except for Co(a_{1j})a_{1j}x_{j}+Co(a_{2j})a_{2j}x_{j}+Co(a_{3j})a_{3j}x_{j}+...+Co(a_{nj})a_{nj}x_{j}

which is equal to

and the right side is equal to

, to be denoted D(j), which is the same thing as D but with the jth column replaced by b_{k}.

Dividing by D gets x_{j}=.

This formula is called Cramer's Rule, and this solution exists when D is not equal to 0.

In particular, in the process of finding the solution, we also find that this is the only solution, so this solution is unique.

### Example[edit]

Consider the system of linear equations below.

If we only want the solution for, say, , we can apply Cramer's Rule to find that its solution is , and since we know

,

.