Cramer's rule
$$5 x_{3} + \left(x_{1} + 2 x_{2}\right) = -9$$
$$3 x_{3} + \left(x_{1} - x_{2}\right) = 2$$
$$- x_{3} + \left(- 6 x_{1} + 3 x_{1}\right) = 25$$
We give the system of equations to the canonical form
$$x_{1} + 2 x_{2} + 5 x_{3} = -9$$
$$x_{1} - x_{2} + 3 x_{3} = 2$$
$$- 3 x_{1} - x_{3} = 25$$
Rewrite the system of linear equations as the matrix form
$$\left[\begin{matrix}x_{1} + 2 x_{2} + 5 x_{3}\\x_{1} - x_{2} + 3 x_{3}\\- 3 x_{1} + 0 x_{2} - x_{3}\end{matrix}\right] = \left[\begin{matrix}-9\\2\\25\end{matrix}\right]$$
- this is the system of equations that has the form
A*x = B
Let´s find a solution of this matrix equations using Cramer´s rule:
Since the determinant of the matrix:
$$A = \operatorname{det}{\left(\left[\begin{matrix}1 & 2 & 5\\1 & -1 & 3\\-3 & 0 & -1\end{matrix}\right] \right)} = -30$$
, then
The root xi is obtained by dividing the determinant of the matrix Ai. by the determinant of the matrix A.
( Ai we get it by replacement in the matrix A i-th column with column B )
$$x_{1} = - \frac{\operatorname{det}{\left(\left[\begin{matrix}-9 & 2 & 5\\2 & -1 & 3\\25 & 0 & -1\end{matrix}\right] \right)}}{30} = -9$$
$$x_{2} = - \frac{\operatorname{det}{\left(\left[\begin{matrix}1 & -9 & 5\\1 & 2 & 3\\-3 & 25 & -1\end{matrix}\right] \right)}}{30} = -5$$
$$x_{3} = - \frac{\operatorname{det}{\left(\left[\begin{matrix}1 & 2 & -9\\1 & -1 & 2\\-3 & 0 & 25\end{matrix}\right] \right)}}{30} = 2$$
Gaussian elimination
Given the system of equations
$$5 x_{3} + \left(x_{1} + 2 x_{2}\right) = -9$$
$$3 x_{3} + \left(x_{1} - x_{2}\right) = 2$$
$$- x_{3} + \left(- 6 x_{1} + 3 x_{1}\right) = 25$$
We give the system of equations to the canonical form
$$x_{1} + 2 x_{2} + 5 x_{3} = -9$$
$$x_{1} - x_{2} + 3 x_{3} = 2$$
$$- 3 x_{1} - x_{3} = 25$$
Rewrite the system of linear equations as the matrix form
$$\left[\begin{matrix}1 & 2 & 5 & -9\\1 & -1 & 3 & 2\\-3 & 0 & -1 & 25\end{matrix}\right]$$
In 1 -th column
$$\left[\begin{matrix}1\\1\\-3\end{matrix}\right]$$
let’s convert all the elements, except
3 -th element into zero.
- To do this, let’s take 3 -th line
$$\left[\begin{matrix}-3 & 0 & -1 & 25\end{matrix}\right]$$
,
and subtract it from other lines:
From 1 -th line. Let’s subtract it from this line:
$$\left[\begin{matrix}1 - - -1 & 2 - \frac{\left(-1\right) 0}{3} & 5 - - \frac{-1}{3} & -9 - \frac{\left(-1\right) 25}{3}\end{matrix}\right] = \left[\begin{matrix}0 & 2 & \frac{14}{3} & - \frac{2}{3}\end{matrix}\right]$$
you get
$$\left[\begin{matrix}0 & 2 & \frac{14}{3} & - \frac{2}{3}\\1 & -1 & 3 & 2\\-3 & 0 & -1 & 25\end{matrix}\right]$$
From 2 -th line. Let’s subtract it from this line:
$$\left[\begin{matrix}1 - - -1 & -1 - \frac{\left(-1\right) 0}{3} & 3 - - \frac{-1}{3} & 2 - \frac{\left(-1\right) 25}{3}\end{matrix}\right] = \left[\begin{matrix}0 & -1 & \frac{8}{3} & \frac{31}{3}\end{matrix}\right]$$
you get
$$\left[\begin{matrix}0 & 2 & \frac{14}{3} & - \frac{2}{3}\\0 & -1 & \frac{8}{3} & \frac{31}{3}\\-3 & 0 & -1 & 25\end{matrix}\right]$$
In 2 -th column
$$\left[\begin{matrix}2\\-1\\0\end{matrix}\right]$$
let’s convert all the elements, except
1 -th element into zero.
- To do this, let’s take 1 -th line
$$\left[\begin{matrix}0 & 2 & \frac{14}{3} & - \frac{2}{3}\end{matrix}\right]$$
,
and subtract it from other lines:
From 2 -th line. Let’s subtract it from this line:
$$\left[\begin{matrix}- \frac{\left(-1\right) 0}{2} & -1 - \frac{\left(-1\right) 2}{2} & \frac{8}{3} - \frac{\left(-1\right) 14}{2 \cdot 3} & \frac{31}{3} - - \frac{-1}{3}\end{matrix}\right] = \left[\begin{matrix}0 & 0 & 5 & 10\end{matrix}\right]$$
you get
$$\left[\begin{matrix}0 & 2 & \frac{14}{3} & - \frac{2}{3}\\0 & 0 & 5 & 10\\-3 & 0 & -1 & 25\end{matrix}\right]$$
In 3 -th column
$$\left[\begin{matrix}\frac{14}{3}\\5\\-1\end{matrix}\right]$$
let’s convert all the elements, except
2 -th element into zero.
- To do this, let’s take 2 -th line
$$\left[\begin{matrix}0 & 0 & 5 & 10\end{matrix}\right]$$
,
and subtract it from other lines:
From 1 -th line. Let’s subtract it from this line:
$$\left[\begin{matrix}- \frac{0 \cdot 14}{15} & 2 - \frac{0 \cdot 14}{15} & \frac{14}{3} - \frac{5 \cdot 14}{15} & - \frac{10 \cdot 14}{15} - \frac{2}{3}\end{matrix}\right] = \left[\begin{matrix}0 & 2 & 0 & -10\end{matrix}\right]$$
you get
$$\left[\begin{matrix}0 & 2 & 0 & -10\\0 & 0 & 5 & 10\\-3 & 0 & -1 & 25\end{matrix}\right]$$
From 3 -th line. Let’s subtract it from this line:
$$\left[\begin{matrix}-3 - \frac{\left(-1\right) 0}{5} & - \frac{\left(-1\right) 0}{5} & -1 - \frac{\left(-1\right) 5}{5} & 25 - \frac{\left(-1\right) 10}{5}\end{matrix}\right] = \left[\begin{matrix}-3 & 0 & 0 & 27\end{matrix}\right]$$
you get
$$\left[\begin{matrix}0 & 2 & 0 & -10\\0 & 0 & 5 & 10\\-3 & 0 & 0 & 27\end{matrix}\right]$$
It is almost ready, all we have to do is to find variables, solving the elementary equations:
$$2 x_{2} + 10 = 0$$
$$5 x_{3} - 10 = 0$$
$$- 3 x_{1} - 27 = 0$$
We get the answer:
$$x_{2} = -5$$
$$x_{3} = 2$$
$$x_{1} = -9$$