Jump to content

Linear Algebra/Cramer's Rule

From Wikibooks, open books for an open world

Cramer's Rule

[edit | edit source]

Let's try to solve the systems of linear equations:
a11x1+a12x2+a13x3+...+a1nxn=b1
a21x1+a22x2+a23x3+...+a2nxn=b2
a31x1+a32x2+a33x3+...+a3nxn=b3
...
an1x1+an2x2+an3x3+...+annxn=bn

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

Consider the matrix

[a11a12a13…a1na21a22a23…a2na31a32a33…a3n⋮⋮⋮⋮⋮an1an2an3…ann]

to be denoted D.

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

Co(a1j)a11x1+Co(a1j)a12x2+Co(a1j)a13x3+...+Co(a1j)a1nxn+
Co(a2j)a21x1+Co(a2j)a22x2+Co(a2j)a23x3+...+Co(a2j)a2nxn+
Co(a3j)a31x1+Co(a3j)a32x2+Co(a3j)a33x3+...+Co(a3j)a3nxn+
+...+
Co(anj)an1x1+Co(anj)an2x2+Co(anj)an3x3+...+Co(anj)annxn
=
Co(a1j)b1+Co(a2j)b2+Co(a3j)b3+...+Co(anj)bn.

The left side cancels out except for Co(a1j)a1jxj+Co(a2j)a2jxj+Co(a3j)a3jxj+...+Co(anj)anjxj

which is equal to xj[a11a12a13…a1na21a22a23…a2na31a32a33…a3n⋮⋮⋮⋮⋮an1an2an3…ann]=D

and the right side is equal to

[a11a12a13…b1…a1na21a22a23…b2…a2na31a32a33…b3…a3n⋮⋮⋮⋮⋮⋮⋮an1an2an3…bn…ann], to be denoted D(j), which is the same thing as D but with the jth column replaced by bk.

Dividing by D gets xj=DjD.

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 | edit source]

Consider the system of linear equations below.
3x1+2x2−5x3=15
5x1+x3=23
x2+x3=12

If we only want the solution for, say, x2, we can apply Cramer's Rule to find that its solution is D2D, and since we know
D2=[315−552310121],
x2=det⁡[315−552310121]det⁡[32−5501011]=9.