Let's try to solve the systems of linear equations:
a11 x1 +a12 x2 +a13 x3 +...+a1n xn =b1
a21 x1 +a22 x2 +a23 x3 +...+a2n xn =b2
a31 x1 +a32 x2 +a33 x3 +...+a3n xn =b3
...
an1 x1 +an2 x2 +an3 x3 +...+ann xn =bn
Which is the special case when the number of equations and the number of variables are the same.
Consider the matrix
[
a
11
a
12
a
13
…
a
1
n
a
21
a
22
a
23
…
a
2
n
a
31
a
32
a
33
…
a
3
n
⋮
⋮
⋮
⋮
⋮
a
n
1
a
n
2
a
n
3
…
a
n
n
]
{\displaystyle {\begin{bmatrix}a_{11}&a_{12}&a_{13}&\ldots &a_{1n}\\a_{21}&a_{22}&a_{23}&\ldots &a_{2n}\\a_{31}&a_{32}&a_{33}&\ldots &a_{3n}\\\vdots &\vdots &\vdots &\vdots &\vdots \\a_{n1}&a_{n2}&a_{n3}&\ldots &a_{nn}\\\end{bmatrix}}}
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 )a11 x1 +Co(a1j )a12 x2 +Co(a1j )a13 x3 +...+Co(a1j )a1n xn +
Co(a2j )a21 x1 +Co(a2j )a22 x2 +Co(a2j )a23 x3 +...+Co(a2j )a2n xn +
Co(a3j )a31 x1 +Co(a3j )a32 x2 +Co(a3j )a33 x3 +...+Co(a3j )a3n xn +
+...+
Co(anj )an1 x1 +Co(anj )an2 x2 +Co(anj )an3 x3 +...+Co(anj )ann xn
=
Co(a1j )b1 +Co(a2j )b2 +Co(a3j )b3 +...+Co(anj )bn .
The left side cancels out except for Co(a1j )a1j xj +Co(a2j )a2j xj +Co(a3j )a3j xj +...+Co(anj )anj xj
which is equal to
x
j
[
a
11
a
12
a
13
…
a
1
n
a
21
a
22
a
23
…
a
2
n
a
31
a
32
a
33
…
a
3
n
⋮
⋮
⋮
⋮
⋮
a
n
1
a
n
2
a
n
3
…
a
n
n
]
=
D
{\displaystyle x_{j}{\begin{bmatrix}a_{11}&a_{12}&a_{13}&\ldots &a_{1n}\\a_{21}&a_{22}&a_{23}&\ldots &a_{2n}\\a_{31}&a_{32}&a_{33}&\ldots &a_{3n}\\\vdots &\vdots &\vdots &\vdots &\vdots \\a_{n1}&a_{n2}&a_{n3}&\ldots &a_{nn}\\\end{bmatrix}}=D}
and the right side is equal to
[
a
11
a
12
a
13
…
b
1
…
a
1
n
a
21
a
22
a
23
…
b
2
…
a
2
n
a
31
a
32
a
33
…
b
3
…
a
3
n
⋮
⋮
⋮
⋮
⋮
⋮
⋮
a
n
1
a
n
2
a
n
3
…
b
n
…
a
n
n
]
{\displaystyle {\begin{bmatrix}a_{11}&a_{12}&a_{13}&\ldots &b_{1}&\ldots &a_{1n}\\a_{21}&a_{22}&a_{23}&\ldots &b_{2}&\ldots &a_{2n}\\a_{31}&a_{32}&a_{33}&\ldots &b_{3}&\ldots &a_{3n}\\\vdots &\vdots &\vdots &\vdots &\vdots &\vdots &\vdots \\a_{n1}&a_{n2}&a_{n3}&\ldots &b_{n}&\ldots &a_{nn}\\\end{bmatrix}}}
, 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 =
D
j
D
{\displaystyle {\frac {D_{j}}{D}}}
.
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.
Consider the system of linear equations below.
3
x
1
+
2
x
2
−
5
x
3
=
15
{\displaystyle 3x_{1}+2x_{2}-5x_{3}=15}
5
x
1
+
x
3
=
23
{\displaystyle 5x_{1}+x_{3}=23}
x
2
+
x
3
=
12
{\displaystyle x_{2}+x_{3}=12}
If we only want the solution for, say,
x
2
{\displaystyle x_{2}}
, we can apply Cramer's Rule to find that its solution is
D
2
D
{\displaystyle {\frac {D_{2}}{D}}}
, and since we know
D
2
=
[
3
15
−
5
5
23
1
0
12
1
]
{\displaystyle D_{2}={\begin{bmatrix}3&15&-5\\5&23&1\\0&12&1\end{bmatrix}}}
,
x
2
=
det
[
3
15
−
5
5
23
1
0
12
1
]
det
[
3
2
−
5
5
0
1
0
1
1
]
=
9
{\displaystyle x_{2}={\frac {\det {\begin{bmatrix}3&15&-5\\5&23&1\\0&12&1\end{bmatrix}}}{\det {\begin{bmatrix}3&2&-5\\5&0&1\\0&1&1\end{bmatrix}}}}=9}
.