# Cramer's Rule for $n$ unknowns?

I know Cramer's rule for $2$ and $3$ unknowns.

Is there a Cramer's Rule for $n≥4$? (where $n$ is the number of unknowns)

I'm not able to find it on the net.

What is the idea behind the Cramer's rule? How can I write the Cramer's rule for $n$ equations with $n$ unknowns without memorising any sequence?

EDIT : I did check the Wikipedia and I couldn't understand anything :(

• Did you try Wikipedia? – Robert Israel Jun 29 '18 at 18:18
• @RobertIsrael I was just about to post the very same comment, word for word, with the same link. – saulspatz Jun 29 '18 at 18:19
• The Cramer rule only contains determinants. It works for every matrix size, if the matrix is an invertible square matrix guaranteeing a unique solution. – Peter Jun 29 '18 at 18:21
• The matrices emerge by substituting the columns (one by one) by the solution vector $b$ in the equation $Ax=b$. Not difficult to memorize. Divide the determinants of these matrices by the determinant of $A$, that's all. – Peter Jun 29 '18 at 18:24
• @RobertIsrael the proof is rather intuitive, I was actually scared over nothing. I feel stupid now cuz I saw those symbols and discontinued reading. That was actually way lot easier than it looked :-) Took me a while but O well. – William Jun 29 '18 at 21:13

I'm not sure if I fully understand the question, but if you want some compact expression for Cramer's rule, probably I can help and provide you with one -- the only thing it requires you to memorize is how to calculate determinants.

SOLUTION

Consider the following equation $$\underbrace{ \begin{pmatrix} \begin{matrix} a_{1,1} \\ a_{2,1} \\ \cdots \\ a_{n,1} \\ \end{matrix} & % \begin{matrix} a_{1,2} \\ a_{2,2} \\ \cdots \\ a_{n,2} \\ \end{matrix} & % \begin{matrix} \cdots \\ \cdots \\ \cdots \\ \cdots \\ \end{matrix} & % \begin{matrix} a_{1,n} \\ a_{2,n} \\ \cdots \\ a_{n,n} \\ \end{matrix} \end{pmatrix} }_{\hat{A}} \underbrace{ \begin{pmatrix} x_{1} \vphantom{x_{1}^{(1)}} \\ x_{2} \vphantom{x_{1}^{(1)}} \\ \cdots \\ x_{n} \vphantom{x_{1}^{(1)}} \\ \end{pmatrix} }_{\vec{x}} = \underbrace{ \begin{pmatrix} b_{1} \vphantom{x_{1}^{(1)}} \\ b_{2} \vphantom{x_{1}^{(1)}} \\ \cdots \\ b_{n} \vphantom{x_{1}^{(1)}} \\ \end{pmatrix} }_{\vec{b}},$$ where $$\hat{A}$$ and $$\vec{b}$$ are given and we aim to find $$\vec{x}$$. Solution may be written as $$\begin{pmatrix} x_{1} \vphantom{x_{1}^{(1)}} \\ x_{2} \vphantom{x_{1}^{(1)}} \\ \cdots \\ x_{n} \vphantom{x_{1}^{(1)}} \\ \end{pmatrix} = (-1) \frac{ \det \begin{pmatrix} 0 & \vec{e}_{1} & \vec{e}_{2} & \dots & \vec{e}_{n} \\ \begin{matrix} b_{1} \vphantom{x_{1}^{(1)}} \\ b_{2} \vphantom{x_{1}^{(1)}} \\ \cdots \\ b_{n} \vphantom{x_{1}^{(1)}} \\ \end{matrix} & % \begin{matrix} a_{1,1} \\ a_{2,1} \\ \cdots \\ a_{n,1} \\ \end{matrix} & % \begin{matrix} a_{1,2} \\ a_{2,2} \\ \cdots \\ a_{n,2} \\ \end{matrix} & % \begin{matrix} \cdots \\ \cdots \\ \cdots \\ \cdots \\ \end{matrix} & % \begin{matrix} a_{1,n} \\ a_{2,n} \\ \cdots \\ a_{n,n} \\ \end{matrix} \end{pmatrix} }{ \det \begin{pmatrix} \begin{matrix} a_{1,1} \\ a_{2,1} \\ \cdots \\ a_{n,1} \\ \end{matrix} & % \begin{matrix} a_{1,2} \\ a_{2,2} \\ \cdots \\ a_{n,2} \\ \end{matrix} & % \begin{matrix} \cdots \\ \cdots \\ \cdots \\ \cdots \\ \end{matrix} & % \begin{matrix} a_{1,n} \\ a_{2,n} \\ \cdots \\ a_{n,n} \\ \end{matrix} \end{pmatrix} },$$ where $$\vec{e}_1$$, $$\dots$$, $$\vec{e}_n$$ are unitary vetors along coordinate axes.

STRUCTURE OF THE SOLUTION

I'll rewrite the equation once more to show how it's built $$\begin{pmatrix} x_{1} \vphantom{x_{1}^{(1)}} \\ x_{2} \vphantom{x_{1}^{(1)}} \\ \cdots \\ x_{n} \vphantom{x_{1}^{(1)}} \\ \end{pmatrix} = (-1) \frac{ \det \begin{pmatrix} 0 & \boxed{\begin{matrix} \vec{e}_{1} & \vec{e}_{2} & \dots & \vec{e}_{n} \end{matrix}} \\ \boxed{ \begin{matrix} b_{1} \vphantom{x_{1}^{(1)}} \\ b_{2} \vphantom{x_{1}^{(1)}} \\ \cdots \\ b_{n} \vphantom{x_{1}^{(1)}} \\ \end{matrix}} & % \boxed{ \begin{matrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n}\\ a_{2,1} & a_{2,2} & \cdots & a_{2,n}\\ \cdots & \cdots & \cdots & \cdots\\ a_{n,1} & a_{n,2} & \cdots & a_{n,n}\\ \end{matrix} } \end{pmatrix} }{ \det \begin{pmatrix} \boxed{ \begin{matrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n}\\ a_{2,1} & a_{2,2} & \cdots & a_{2,n}\\ \cdots & \cdots & \cdots & \cdots\\ a_{n,1} & a_{n,2} & \cdots & a_{n,n}\\ \end{matrix} } \end{pmatrix} } = (-1) \frac{ \det \begin{pmatrix} 0 & \boxed{\begin{matrix} \vec{e}_{1} \dots & \vec{e}_{n} \end{matrix}} \\ \boxed{\vec{b}\\} & \boxed{\hspace{1cm}\hat{A}\hspace{1cm}\\} \end{pmatrix} }{ \det \begin{pmatrix} \boxed{\hat{A}} \end{pmatrix} }$$

EXAMPLE

Consider following equations \left\{ \begin{aligned} -2 x_1 + 3 x_2 + x_3 &= 2, \\ - x_1 - x_2 + 4 x_3 &= 1, \\ x_1 + x_2 + x_3 &= 1, \end{aligned} \right. or in matrix form $$\begin{pmatrix} -2 & 3 & 1 \\ -1 & -1 & 4 \\ 1 & 1 & 1 \end{pmatrix} \begin{pmatrix} x_{1} \\ x_{2} \\ x_{3} \\ \end{pmatrix} = \begin{pmatrix} 2 \\ 1 \\ 1 \\ \end{pmatrix}.$$

Solution is written as $$\vec{x} = (-1) \frac{ \det \begin{pmatrix} 0 & \vec{e}_1 & \vec{e}_2 & \vec{e}_3 \\ 2 & -2 & 3 & 1 \\ 1 & -1 & -1 & 4 \\ 1 & 1 & 1 & 1 \end{pmatrix} }{ \det \begin{pmatrix} -2 & 3 & 1 \\ -1 & -1 & 4 \\ 1 & 1 & 1 \end{pmatrix} } = \frac{1}{25} \vec{e}_1 + \frac{14}{25} \vec{e}_2 + \frac{2}{5}\vec{e}_3 =\begin{pmatrix} \frac{1}{25} \\ \frac{14}{25} \\ \frac{2}{5} \\ \end{pmatrix},$$ thus $$x_1=1/25$$, $$x_2=14/25$$, and $$x_3=2/5$$.

REFERENCES

To read more on the theory everything relies on, you may want to check "Beginner's guide to mapping simplexes affinely" that is written by authors of the formula. Besides they have "Workbook on mapping simplexes affinely" that contains different examples with similar determinants.