# How do you solve x - 2y + z = - 2, 2x - 3y + 2z = 2, and 4x - 8y + 5z = - 5 using matrices?

Sep 8, 2017

The solution is:

$x = 7 , y = 6 , z = 3$

#### Explanation:

We have:

$x - 2 y + z = - 2$
$2 x - 3 y + 2 z = 2$
$4 x - 8 y + 5 z = - 5$

Which we can write in vector matrix form:

$\left(\begin{matrix}1 & - 2 & 1 \\ 2 & - 3 & 2 \\ 4 & - 8 & 5\end{matrix}\right) \left(\begin{matrix}x \\ y \\ z\end{matrix}\right) = \left(\begin{matrix}- 2 \\ 2 \\ - 5\end{matrix}\right)$

Or:

$\boldsymbol{A} \boldsymbol{\underline{x}} = \boldsymbol{\underline{b}} \implies \boldsymbol{\underline{x}} = {\boldsymbol{A}}^{- 1} \boldsymbol{\underline{b}}$

Where

$\boldsymbol{A} = \left(\begin{matrix}1 & - 2 & 1 \\ 2 & - 3 & 2 \\ 4 & - 8 & 5\end{matrix}\right)$; $\boldsymbol{\underline{x}} = \left(\begin{matrix}x \\ y \\ z\end{matrix}\right)$; $\boldsymbol{\underline{b}} = \left(\begin{matrix}- 2 \\ 2 \\ - 5\end{matrix}\right)$

We can find ${\boldsymbol{A}}^{- 1}$, or solve this linear system via any of several methods:

Method 1 - Gaussian Elimination

Here we form an augmented matrix of the equation coefficients.

( (1, -2, 1, |, -2), (2, -3, 2, |, 2), (4, -8, 5, |, -5) )

We can now perform elementary row operations with the aim of getting leading zeros in progresisve rows:

( (1, -2, 1, |, -2), (2, -3, 2, |, 2), (4, -8, 5, |, -5) ) stackrel(R_2-2R_1 rarr R_2)(rarr) ( (1, -2, 1, |, -2), (0, 1, 0, |, 6), (4, -8, 5, |, -5) )

( (1, -2, 1, |, -2), (0, 1, 0, |, 6), (4, -8, 5, |, -5) ) stackrel(R_3-4R_1 rarr R_3)(rarr) ( (1, -2, 1, |, -2), (0, 1, 0, |, 6), (0, 0, 1, |, 3) )

We can now use back substitution to get the values of $x$, $y$, and $z$:

Row $3 \implies z = 3$
Row $2 \implies y = 6$
Row $1 \implies x - 2 y + z = - 2$

$\therefore x - 12 + 3 = - 2 \implies x = 7$

Thus we have a unique solution:

$x = 7 , y = 6 , z = 3$

Method 2 - Matrix Inversion

A matrix, $\boldsymbol{A}$, is invertible if and only if its determinant $\left\mid \boldsymbol{A} \right\mid \ne 0$. There are several ways to invert a matrix inclining finding the adjoint, row reduction or even a calculator. I will use the adjoint method, which has several steps;

• Calculating the Matrix of Minors,
• Form the Matrix of Cofactors, $c o f \left(\boldsymbol{A}\right)$
• Form the adjoint matrix, $a \mathrm{dj} \left(\boldsymbol{A}\right)$
• Multiply $a \mathrm{dj} \left(\boldsymbol{A}\right)$ by $\frac{1}{\left\mid \boldsymbol{A} \right\mid}$ to form the inverse ${\boldsymbol{A}}^{-} 1$

At some point we need to calculate $\left\mid \boldsymbol{A} \right\mid$, or $\det \left(\boldsymbol{A}\right)$, and this can also be used to test if the matrix is actually invertible so I prefer to do this first;

$\boldsymbol{A} = \left(\begin{matrix}1 & - 2 & 1 \\ 2 & - 3 & 2 \\ 4 & - 8 & 5\end{matrix}\right)$

If we expand about the first row and "strike out" the row and column to form a smaller determinant and alternate signs we get;

$\left\mid \boldsymbol{A} \right\mid = + \left(1\right) | \left(- 3 , 2\right) , \left(- 8 , 5\right) | - \left(- 2\right) | \left(2 , 2\right) , \left(4 , 5\right) | + \left(1\right) | \left(2 , - 3\right) , \left(4 , - 8\right) |$
$\setminus \setminus \setminus \setminus \setminus = \left\{\left(- 3\right) \left(5\right) - \left(- 8\right) \left(2\right)\right\} + 2 \left\{\left(2\right) \left(5\right) - \left(4\right) \left(2\right)\right\} + \left\{\left(2\right) \left(- 8\right) - \left(4\right) \left(- 3\right)\right\}$
$\setminus \setminus \setminus \setminus \setminus = \left\{- 15 + 16\right\} + \left\{10 - 8\right\} + \left\{- 16 + 12\right\}$
$\setminus \setminus \setminus \setminus \setminus = 1 + 4 - 4$
$\setminus \setminus \setminus \setminus \setminus = 1$

As $\left\mid \boldsymbol{A} \right\mid \ne 0 \implies \boldsymbol{A}$ is invertible, so we now calculate the matrix of minors by systematically working through each element in the matrix and "strike out" that row and columns and form the determinant of the remaining elements, as follows:

"minors"(bb(A))=( ( |(-3, 2), (-8, 5)|, |(2, 2), (4, 5)|, |(2, -3), (4, -8)| ), ( |(-2, 1), (-8, 5)|, |(1, 1), (4, 5)|, |(1, -2), (4, -8)| ), ( |(-2, 1), (-3, 2)|, |(1, 1), (2, 2)|, |(1, -2), (2, -3)| ) )
$\setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}- 15 + 16 & 10 - 8 & - 16 + 12 \\ - 10 + 8 & 5 - 4 & - 8 + 8 \\ - 4 + 3 & 2 - 2 & - 3 + 4\end{matrix}\right)$
$\setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}1 & 2 & - 4 \\ - 2 & 1 & 0 \\ - 1 & 0 & 1\end{matrix}\right)$

We now form the matrix of cofactors, $c o f \left(A\right)$, by taking the above matrix of minors and applying the alternating sign matrix as in

$\left(\begin{matrix}+ & - & + \\ - & + & - \\ + & - & +\end{matrix}\right)$

Where we change the sign of those elements with the minus sign to get;

$c o f \left(\boldsymbol{A}\right) = \left(\begin{matrix}1 & - 2 & - 4 \\ 2 & 1 & 0 \\ - 1 & 0 & 1\end{matrix}\right)$

Then we form the adjoint matrix by transposing the matrix of cofactors, $c o f \left(A\right)$, so;

$a \mathrm{dj} \left(A\right) = c o f {\left(A\right)}^{T}$
$\setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus = {\left(\begin{matrix}1 & - 2 & - 4 \\ 2 & 1 & 0 \\ - 1 & 0 & 1\end{matrix}\right)}^{T}$
$\setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}1 & 2 & - 1 \\ - 2 & 1 & 0 \\ - 4 & 0 & 1\end{matrix}\right)$

And then finally we multiply by the reciprocal of the determinant to get:

${\boldsymbol{A}}^{-} 1 = \frac{1}{\left\mid \boldsymbol{A} \right\mid} a \mathrm{dj} \left(\boldsymbol{A}\right)$
$\setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(1\right) \left(\begin{matrix}1 & 2 & - 1 \\ - 2 & 1 & 0 \\ - 4 & 0 & 1\end{matrix}\right)$
$\setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}1 & 2 & - 1 \\ - 2 & 1 & 0 \\ - 4 & 0 & 1\end{matrix}\right)$

So then we get the solution the linear equations as:

$\boldsymbol{\underline{x}} = {\boldsymbol{A}}^{- 1} \boldsymbol{\underline{b}}$ ..... $\left[\star\right]$

$\therefore \left(\begin{matrix}x \\ y \\ z\end{matrix}\right) = \left(\begin{matrix}1 & 2 & - 1 \\ - 2 & 1 & 0 \\ - 4 & 0 & 1\end{matrix}\right) \left(\begin{matrix}- 2 \\ 2 \\ - 5\end{matrix}\right)$
$\setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}\left(1\right) \left(- 2\right) + \left(2\right) \left(2\right) + \left(- 1\right) \left(- 5\right) \\ \left(- 2\right) \left(- 2\right) + \left(1\right) \left(2\right) + \left(0\right) \left(2\right) \\ \left(- 4\right) \left(- 2\right) + \left(0\right) \left(2\right) + \left(1\right) \left(- 5\right)\end{matrix}\right)$

$\setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}- 2 + 4 + 5 \\ 4 + 2 \\ 8 - 5\end{matrix}\right)$
$\setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}7 \\ 6 \\ 3\end{matrix}\right)$

Thus we have a unique solution:

$x = 7 , y = 6 , z = 3$

Method 3 - Cayley Hamilton Theorem

The CH-Theorem states that any square matrix satisfies its own characteristic equation. We can exploit this property to find a the inverse.

We have:

$\boldsymbol{A} = \left(\begin{matrix}1 & - 2 & 1 \\ 2 & - 3 & 2 \\ 4 & - 8 & 5\end{matrix}\right)$

So, the characteristic equation is given by:

$\left\mid \boldsymbol{A} - l a m \mathrm{da} \boldsymbol{I} \right\mid = 0 \implies \left\mid \begin{matrix}1 - l a m \mathrm{da} & - 2 & 1 \\ 2 & - 3 - l a m \mathrm{da} & 2 \\ 4 & - 8 & 5 - l a m \mathrm{da}\end{matrix} \right\mid = 0$

If we expand about row 1 then we get:

$\left\mid \begin{matrix}1 - l a m \mathrm{da} & - 2 & 1 \\ 2 & - 3 - l a m \mathrm{da} & 2 \\ 4 & - 8 & 5 - l a m \mathrm{da}\end{matrix} \right\mid = 0$

$\left(1 - l a m \mathrm{da}\right) | \left(- 3 - l a m \mathrm{da} , 2\right) , \left(- 8 , 5 - l a m \mathrm{da}\right) | - \left(- 2\right) | \left(2 , 2\right) , \left(4 , 5 - l a m \mathrm{da}\right) | + \left(1\right) | \left(2 , - 3 - l a m \mathrm{da}\right) , \left(4 , - 8\right) | = 0$

$\therefore \left(1 - l a m \mathrm{da}\right) \left\{\left(- 3 - l a m \mathrm{da}\right) \left(5 - l a m \mathrm{da}\right) - \left(- 8\right) \left(2\right)\right\} + 2 \left\{\left(2\right) \left(5 - l a m \mathrm{da}\right) - \left(4\right) \left(2\right)\right\} + \left\{\left(2\right) \left(- 8\right) - \left(4\right) \left(- 3 - l a m \mathrm{da}\right)\right\} = 0$

$\therefore \left(1 - l a m \mathrm{da}\right) \left\{- 15 - 2 l a m \mathrm{da} + l a m {\mathrm{da}}^{2} + 16\right\} + 2 \left\{10 - 2 l a m \mathrm{da} - 8\right\} + \left\{- 16 + 12 + 4 l a m \mathrm{da}\right\} = 0$

$\therefore \left(1 - l a m \mathrm{da}\right) \left\{l a m {\mathrm{da}}^{2} - 2 l a m \mathrm{da} + 1\right\} + 2 \left\{2 - 2 l a m \mathrm{da}\right\} + \left\{4 l a m \mathrm{da} - 4\right\} = 0$

$\therefore l a m {\mathrm{da}}^{2} - 2 l a m \mathrm{da} + 1 - l a m {\mathrm{da}}^{3} + 2 l a m {\mathrm{da}}^{2} - l a m \mathrm{da} + 4 - 4 l a m \mathrm{da} + 4 l a m \mathrm{da} - 4 = 0$

$\therefore - l a m {\mathrm{da}}^{3} + 3 l a m {\mathrm{da}}^{2} - 3 l a m \mathrm{da} + 1 = 0$
$\therefore l a m {\mathrm{da}}^{3} - 3 l a m {\mathrm{da}}^{2} + 3 l a m \mathrm{da} - 1 = 0$

(Side Note - If we solve this characteristic equation we get ${\left(l a m \mathrm{da} - 1\right)}^{3} = 0$ yielding three identical solutions $l a m \mathrm{da} = 1$, which are the eigenvalues of the given matrix).

Then By CH-Theorem we have:

${\boldsymbol{A}}^{3} - 3 {\boldsymbol{A}}^{2} + 3 \boldsymbol{A} - \boldsymbol{I} = 0 \implies \boldsymbol{A} \left({\boldsymbol{A}}^{2} - 3 \boldsymbol{A} + 3 \boldsymbol{I}\right) = \boldsymbol{I}$
$\therefore {\boldsymbol{A}}^{- 1} \boldsymbol{A} \left({\boldsymbol{A}}^{2} - 3 \boldsymbol{A} + 3 \boldsymbol{I}\right) = {\boldsymbol{A}}^{- 1} \boldsymbol{I}$
$\therefore {\boldsymbol{A}}^{- 1} = {\boldsymbol{A}}^{2} - 3 \boldsymbol{A} + 3 \boldsymbol{I}$

And we can readily calculate this matrix product ${\boldsymbol{A}}^{2}$:

${\boldsymbol{A}}^{2} = \left(\begin{matrix}1 & - 2 & 1 \\ 2 & - 3 & 2 \\ 4 & - 8 & 5\end{matrix}\right) \left(\begin{matrix}1 & - 2 & 1 \\ 2 & - 3 & 2 \\ 4 & - 8 & 5\end{matrix}\right)$
$\setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}1 - 4 + 4 & - 2 + 6 - 8 & 1 - 4 + 5 \\ 2 - 6 + 8 & - 4 - 9 - 16 & 2 - 6 + 10 \\ 4 - 16 + 20 & - 8 + 24 - 40 & 4 - 16 + 25\end{matrix}\right)$
$\setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}1 & - 4 & 2 \\ 4 & - 11 & 6 \\ 8 & - 24 & 13\end{matrix}\right)$

And so we have:

${\boldsymbol{A}}^{- 1} = {\boldsymbol{A}}^{2} - 3 \boldsymbol{A} + 3 \boldsymbol{I}$
$\setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}1 & - 4 & 2 \\ 4 & - 11 & 6 \\ 8 & - 24 & 13\end{matrix}\right) - 3 \left(\begin{matrix}1 & - 2 & 1 \\ 2 & - 3 & 2 \\ 4 & - 8 & 5\end{matrix}\right) + 3 \left(\begin{matrix}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1\end{matrix}\right)$

$\setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}1 & - 4 & 2 \\ 4 & - 11 & 6 \\ 8 & - 24 & 13\end{matrix}\right) - \left(\begin{matrix}3 & - 6 & 3 \\ 6 & - 9 & 6 \\ 12 & - 24 & 15\end{matrix}\right) + \left(\begin{matrix}3 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 3\end{matrix}\right)$

$\setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}1 - 3 + 3 & - 4 + 6 & 2 - 3 \\ 4 - 6 & - 11 + 9 + 3 & 6 - 6 \\ 8 - 12 & - 24 + 24 & 13 - 15 + 3\end{matrix}\right)$

$\setminus \setminus \setminus \setminus \setminus \setminus \setminus \setminus = \left(\begin{matrix}1 & - 2 & - 1 \\ - 2 & 1 & 0 \\ - 4 & 0 & 1\end{matrix}\right)$, as above and we proceed with $\left[\star\right]$ in Method 2.

Sep 8, 2017

I got $x = 7 , y = 6 , z = 3$ using Cramer's Method: