Let A be an invertible \(n\times n\) matrix. For any \(\mathbf{b}\) in \(\mathbb{R}^{n}\), the unique solution of \(A\mathbf{x}=\mathbf{b}\) has entries given by
$$x_{j}=\frac{\mathrm{det }A_{j} (\mathbf{b})}{\mathrm{det }A}$$
where \(A_{j}(\mathbf{b})\) is the matrix obtained from A by replacing j th column by the vector \(\mathbf{b}\).
Example
Use Cramer’s rule to solve the system
\begin{eqnarray*}&&3x_{1}-3x_{2}+x_{3}=1\\&&3x_{1}+2x_{2}\ \ \ \ \ \ \ \ \ =0\\&&-x_{1}-5x_{2}+x_{3}=-1\end{eqnarray*}
Solution: View the system as \(A\mathbf{x} =\mathbf{b}\) :
$$\begin{bmatrix}3&-3&1\\3 &2& 0\\-1 &-5&1\\\end{bmatrix}\begin{bmatrix}x_{1}\\x_{2}\\x_{3} \\\end{bmatrix}=\begin{bmatrix}1\\0 \\-1 \\\end{bmatrix} \ \ \ ( A\mathbf{x} =\mathbf{b}) $$
Then we have
$$|A|=\left|\begin{array}{ccc}3&-3&1\\3 &2& 0\\-1 &-5&1\\\end{array}\right|, \ \ \ |A_{1} (\mathbf{b})|=\left|\begin{array}{ccc}1&-3&1\\0 &2& 0\\-1 &-5&1\\\end{array}\right|, \ \ \ |A_{2} (\mathbf{b})|=\left|\begin{array}{ccc}3&1&1\\3 &0& 0\\-1 &-1&1\\\end{array}\right|, \ \ \ |A_{3} (\mathbf{b})|=\left|\begin{array}{ccc}3&-3&1\\3 &2& 0\\-1 &-5&-1\\\end{array}\right|$$
Thus by the Cramer’s rule, we obatain
\begin{eqnarray*}x_{1}&=&\frac{|A_{1}(\mathbf{b})|}{|A|}=\frac{4}{2}=2\\x_{2}&=&\frac{|A_{2}(\mathbf{b})|}{|A|}=\frac{-6}{2}=-3\\x_{3}&=&\frac{|A_{3}(\mathbf{b})|}{|A|}=\frac{-28}{2}=-14\\\end{eqnarray*}
Proof
Let’s consider the following system:
\begin{eqnarray*}&&a_{11}x_{1}+a_{12}x_{2}+\cdots +a_{1n}x_{n}=b_{1}\\&&a_{21}x_{1}+a_{22}x_{2}+\cdots +a_{2n}x_{n}=b_{2}\\&&\ \ \ \ \ \ \ \ \ \ \ \ \vdots \\&&a_{n1}x_{1}+a_{n2}x_{2}+\cdots +a_{nn}x_{n}=b_{n}\end{eqnarray*}
If we let \(A=[a_{ij}]\), \(\mathbf{x}=[x_{i}]^{t}\) and \(\mathbf{b}=[b_{i}]^{t}\), we can rewrite these equations by using matrices as below:
$$\begin{bmatrix}a_{11} &a_{12}&\cdots&a_{1n}\\a_{21} &a_{22}&\cdots&a_{2n}\\\vdots &\vdots & \ddots & \vdots\\a_{n1} &a_{n2}&\cdots&a_{nn}\\\end{bmatrix}\begin{bmatrix}x_{1}\\x_{2} \\\vdots \\x_{n} \\\end{bmatrix}=\begin{bmatrix}b_{1}\\b_{2} \\\vdots \\b_{n} \\\end{bmatrix} \ \ \ ( A\mathbf{x} =\mathbf{b}) $$
Now, if we suppose that A is an inversible matrix, then the inverse matrix of A is given by
$$A^{-1}=\frac{1}{\mathrm{det} A }\begin{bmatrix}\tilde{a}_{11} &\tilde{a}_{21}&\cdots&\tilde{a}_{n1}\\\tilde{a}_{12} &\tilde{a}_{22}&\cdots&\tilde{a}_{n2}\\\vdots &\vdots & \ddots & \vdots\\\tilde{a}_{1n} &\tilde{a}_{n2}&\cdots&\tilde{a}_{nn}\\\end{bmatrix}$$
where \(\tilde{a}_{ij}\) is the \((i,j)\)-cofactor of A, given by \(\tilde{a}_{ij}=(-1)^{i+j}\ \mathrm{det }A_{ij}\).
Therefore, \(\mathbf{x}=[x_{i}]^{t}\) is given by
$$\begin{bmatrix}x_{1}\\x_{2} \\\vdots \\x_{n} \\\end{bmatrix}=\frac{1}{\mathrm{det} A }\begin{bmatrix}\tilde{a}_{11} &\tilde{a}_{21}&\cdots&\tilde{a}_{n1}\\\tilde{a}_{12} &\tilde{a}_{22}&\cdots&\tilde{a}_{n2}\\\vdots &\vdots & \ddots & \vdots\\\tilde{a}_{1n} &\tilde{a}_{n2}&\cdots&\tilde{a}_{nn}\\\end{bmatrix}\begin{bmatrix}b_{1}\\b_{2} \\\vdots \\b_{n} \\\end{bmatrix}=\frac{1}{\mathrm{det} A }\begin{bmatrix}b_{1}\tilde{a}_{11} +b_{2}\tilde{a}_{21}+\cdots +b_{n}\tilde{a}_{n1}\\\vdots \\b_{j}\tilde{a}_{1j} +b_{2}\tilde{a}_{2j}+\cdots +b_{n}\tilde{a}_{nj}\\\vdots \\b_{1}\tilde{a}_{1n} +b_{2}\tilde{a}_{2n}+\cdots +b_{n}\tilde{a}_{nn}\\\end{bmatrix}$$
For \(1\leq j\leq n\), we can rewrite \(x_{j}\) by using the determinant of matrix obtained from A by replacing column j by vector \(\mathbf{b}\):
\begin{eqnarray*} x_{j}&=&\frac{1}{\mathrm{det } A}(b_{j}\tilde{a}_{1j} +b_{2}\tilde{a}_{2j}+\cdots +b_{n}\tilde{a}_{nj})\\&& \\&=&\frac{1}{\mathrm{det }A}\left|\begin{array}{ccccc}a_{11} &\cdots&b_{1}&\cdots &a_{1n}\\a_{21} &\cdots&b_{2}&\cdots &a_{2n}\\\vdots &\ & \vdots &\ & \vdots\\a_{n1} &\cdots&b_{n} &\cdots&a_{nn}\\\end{array}\right|\ \ \ \ ( \text{ expansion down the \(j\)th column })\\&& \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \text{↑}\\&& \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ j \text{th column}\end{eqnarray*}