# How does Cramer's rule work?

I know Cramer’s rule works for 3 linear equations. I know all steps to get solutions. But I don’t know why (how) Cramer’s rule gives us solutions?

Why do we get $x=\frac{\Delta_1}\Delta$ and $y$ and $z$ in the same way?

I want to know how these steps give us solutions?

#### Solutions Collecting From Web of "How does Cramer's rule work?"

It’s actually simple; I explain it here in two variables, but the principle is the same.

Say you have an equation
$$\begin{pmatrix}a&b\\c&d\end{pmatrix}\begin{pmatrix}x\\y\end{pmatrix}=\begin{pmatrix}p\\q \end{pmatrix}$$

Now you can see that the following holds

$$\begin{pmatrix}a&b\\c&d\end{pmatrix}\begin{pmatrix}x&0\\y&1\end{pmatrix}=\begin{pmatrix}p&b\\q &d\end{pmatrix}$$

Finally just take the determinant of this last equation; $\det$ is multiplicative so you get $$\Delta x=\Delta_1$$

Cramer’s rule is very easy to discover because if you solve the linear system of equations
\begin{align*}
a_{11} x_1 + a_{12} x_2 + a_{13} x_3 &= b_1 \\
a_{21} x_1 + a_{22} x_2 + a_{23} x_3 &= b_2 \\
a_{31} x_1 + a_{32} x_2 + a_{33} x_3 &= b_3 \\
\end{align*}
by hand, just using a standard high school approach of eliminating variables, then out pops Cramer’s rule! In my opinion, this is the most likely way that a mathematician would discover the determinant in the first place, and Cramer’s rule is discovered simultaneously.

I remember thinking that it must be quite difficult to prove Cramer’s rule for an $n \times n$ matrix, but it turns out to be surprisingly easy (once you take the right approach). We’ll prove it below.

The most useful way of looking at the determinant, in my opinion, is this: the function $M \mapsto \det M$ is an alternating multilinear function of the columns of $M$ which satisfies $\det(I) = 1$. This characterization of the determinant gives us a quick, simple proof of Cramer’s rule.

For simplicity, I’ll assume $A$ is a $3 \times 3$ matrix with columns $a_1, a_2, a_3$. Suppose that $$b = Ax = x_1 a_1 + x_2 a_2 + x_3 a_3.$$ Then
\begin{align*}
\begin{vmatrix} b & a_2 & a_3 \end{vmatrix} &=
\begin{vmatrix} x_1 a_1 + x_2 a_2 + x_3 a_3 & a_2 & a_3 \end{vmatrix} \\
&= x_1 \begin{vmatrix} a_1 & a_2 & a_3 \end{vmatrix} +
x_2 \begin{vmatrix} a_2 & a_2 & a_3 \end{vmatrix} +
x_3 \begin{vmatrix} a_3 & a_2 & a_3 \end{vmatrix} \\
&= x_1 \det A.
\end{align*}
If $\det A \neq 0$, it follows that
$$x_1 = \frac{\begin{vmatrix} b & a_2 & a_3 \end{vmatrix}}{\det A}.$$

I learned this proof in section 4.4, problem 16 (“Quick proof of Cramer’s rule“) in Gilbert Strang’s book Linear Algebra and its Applications.

Here is a very simple solution that only uses some properties of determinants. Consider the following system:

$$\left\{ \begin{array}{c} a_1x+b_1y+c_1z=d_1 \\ a_2x+b_2y+c_2z=d_2 \\ a_3x+b_3y+c_3z=d_3 \end{array} \right.$$
Assume $\Delta\neq0$, then, \require{action}\begin{align} \Delta_1& \mathtip{=\left| \matrix{d_1 & b_1 & c_1 \\ d_2 & b_2 & c_2 \\ d_3 & b_3 & c_3}\right|}{\text{by definition of }\Delta_1} \\& \\ &\mathtip{=\left| \matrix{(a_1x+b_1y+c_1z) & b_1 & c_1 \\ (a_2x+b_2y+c_2z) & b_2 & c_2 \\ (a_3x+b_3y+c_3z) & b_3 & c_3}\right|}{\text{by the system of equations}} \\& \\ &\mathtip{=\left| \matrix{(a_1x+b_1y+c_1z)-(b_1y+c_1z) & b_1 & c_1 \\ (a_2x+b_2y+c_2z)-(b_2y+c_2z) & b_2 & c_2 \\ (a_3x+b_3y+c_3z)-(b_3y+c_3z) & b_3 & c_3}\right|}{\text{If a multiple of one column is added to another column, the value of the determinant is not changed.}} \\ & \\ &\mathtip{=\left| \matrix{a_1x & b_1 & c_1 \\ a_2x & b_2 & c_2 \\ a_3x & b_3 & c_3}\right|}{\text{Simplifying}} \\& \\ &\mathtip{= x\left| \matrix{a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3}\right|}{\text{If each entry in a given row is multiplied by k, then the value of the determinant is multiplied by k.}} \\& \\ &\mathtip{= x\Delta}{\text{by definition of }\Delta} \end{align} Thus $x=\dfrac{\Delta_1}{\Delta}$. The proof is due to D. E. Whitford and M. S. Klamkin. (“On an Elementary Derivation of Cramer’s Rule”, American Mathematical Monthly, vol. 60 (1953), pp.186–7).

This is another way to look at it. $Ax = b$ where A is invertible. First we define the following matrix:

$$I_i(x) = [e_1\,\,e_2\,\, e_{i-1}\,\,x\,\,e_{i+1}\,\, …\,\, e_n]$$
By the defenition of matrix multiplication:
$$AI_i(x) = [Ae_1\,\,Ae_2\,\, Ae_{i-1}\,\,Ax\,\,Ae_{i+1}\,\, …\,\, Ae_n]$$
$$AI_i(x) = A_i(b)$$
$$det\,AI_i(x) = det\,A_i(b)$$

The determinant of the product of two matrices is the product of the determinants, so:

$$det\,A \,\cdot\, det\,I_i(x) = det\,A_i(b)$$

Let’s now look at $det\,I_i(x)$, note that the determinants are the same because you can get rid of all the $x_j$ where $j\ne i$ by row reduction. Also $x$ is in the $i^{th}$ column:
$$det\,I_i(x) = det \begin{bmatrix} 1 & x_1 & \cdots & 0 \\ 0 & x_2 & 0 & 0 \\ \vdots & \vdots & \ddots & 0 \\ 0 & x_n & 0 & 1 \\ \end{bmatrix} = det \begin{bmatrix} 1 & 0 & \cdots & 0 \\ 0 & x_i & 0 & 0 \\ \vdots & \vdots & \ddots & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} = 1 \cdot 1 \cdot\cdot\cdot 1\cdot x_i \cdot 1\cdot\cdot\cdot1=x_i$$

$det\,I_i(x)$ is simply $x_i$, So we can say that:
$$x_i = \frac{det\,A_i(b)}{det\,A}$$