# Cramer’s Rule

Consider a system of $n$ linear equations in $n$ unknowns
$$x_1A^1+\cdots+x_nA^n=B,$$
where $x_1,\cdots,x_n$ are variables and $A^1,\cdots,A^n,B$ are column vectors of dimension $n$. Suppose that $\det(A^1,\cdots,A^n)\ne 0$. Recall that this condition ensures that the linear system has a unique solution as seen here. Let us consider the determinant of the matrix obtained by replacing $j$-th column $A^j$ by $B$. Then using the properties of determinants studied here
\begin{align*}
\det (A^1,\cdots,B,\cdots,A^n)&=\det (A^1,\cdots,x_1A^1+\cdots+x_nA^n,\cdots,A^n)\\
&=\det (A^1,\cdots,x_1A^1,\cdots,x^nA^n)+\cdots+\det (A^1,\cdots,x_jA^j,\cdots,x_nA^n)\\
&+\cdots+\det (A^1,\cdots,x_nA^n,\cdots,x_nA^n)\\
&=x_1\det (A^1,\cdots,A^1,\cdots,A^n)+\cdots+x_j\det (A^1,\cdots,A^j,\cdots,A^n)\\
&+\cdots+x_n\det (A^1,\cdots,A^n,\cdots,A^n).
\end{align*}
Two column vectors are the same in every term except the $j$-th term, and so every term except the $j$-th term. Hence, we have
$$\det (A^1,\cdots,B,\cdots,A^n)=x_j\det (A^1,\cdots,A^j,\cdots,A^n),$$
i.e.
\begin{align*}
x_j&=\frac{\det (A^1,\cdots,B,\cdots,A^n)}{\det (A^1,\cdots,A^j,\cdots,A^n)}\\
&=\frac{\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|}{\left|\begin{array}{ccccc}
a_{11} & \cdots & a_{1j} & \cdots & a_{1n}\\
a_{21} & \cdots & a_{2j} & \cdots & a_{2n}\\
\vdots & &\vdots& &\vdots\\
a_{n1} & \cdots & a_{nj} & \cdots & a_{nn}
\end{array}\right|}
\end{align*}
for $j=1,\cdots,n$. This is called the Cramer’s Rule.

Example. Solve the system of Linear equations:
\begin{align*}
3x+2y+4z&=1,\\
2x-y+z&=0,\\
x+2y+3z&=1.
\end{align*}

Solution. By the Caramer’s Rule, we have
$$x=\frac{\left|\begin{array}{ccc} 1 & 2 & 4\\ 0 & -1 & 1\\ 1 & 2 & 3 \end{array}\right|}{\left|\begin{array}{ccc} 3 & 2 & 4\\ 2 & -1 & 1\\ 1 & 2 & 3 \end{array}\right|}=-\frac{1}{5},\ y=\frac{\left|\begin{array}{ccc} 3 & 1 & 4\\ 2 & 0 & 1\\ 1 & 1 & 3 \end{array}\right|}{\left|\begin{array}{ccc} 3 & 2 & 4\\ 2 & -1 & 1\\ 1 & 2 & 3 \end{array}\right|}=0,\ z=\frac{\left|\begin{array}{ccc} 3 & 2 & 0\\ 2 & -1 & 1\\ 1 & 2 & 0 \end{array}\right|}{\left|\begin{array}{ccc} 3 & 2 & 4\\ 2 & -1 & 1\\ 1 & 2 & 3 \end{array}\right|}=\frac{2}{5}.$$