Solve the following system of equation by matrix method : $u-2v+w=1, 2u+v+w=1 , u+v-2w=-2$

Toolbox:
• If the value of the determinant of a $3\times 3$ matrix is not equal to zero,then it is a non-singular matrix.
• If it is a non-singular matrix,then inverse exists.
• $A^{-1}=\frac{1}{|A|}$adjoint of A
• $A^{-1}B=X$
Step 1:
The given system of equation is of the form AX=B.
(i.e)$\begin{bmatrix}1 & -2& 1\\2 &1 & 1\\1 & 1 & -2\end{bmatrix}\begin{bmatrix}u\\v\\w\end{bmatrix}=\begin{bmatrix}1\\1\\-2\end{bmatrix}$
Where $A=\begin{bmatrix}1 & -2&1\\2 & 1 & 1\\1 & 1 &-2\end{bmatrix},X=\begin{bmatrix}u\\v\\w\end{bmatrix}$ and $B=\begin{bmatrix}1\\1\\-2\end{bmatrix}$
Let us now find the determinant value of determinant A
|A|=$\begin{bmatrix}1 & -2 & 1\\2 & 1 &1\\1 & 1 & -2\end{bmatrix}$
$\;\;=1(1\times -2-1\times 1)-(-2)(2\times -2-1\times 1)+1(2\times 1-1\times 1)$
$\;\;=-3-10+1=-12\neq 0.$
Hence $A^{-1}$ exists.
Step 2:
Next let us find the cofactors of A,
$A_{11}=(-1)_{1+1}\begin{vmatrix}1 & 1\\1 & -2\end{vmatrix}$=-2-1=-3.
$A_{12}=(-1)_{1+2}\begin{vmatrix}2 & 1\\1 & -2\end{vmatrix}$=-(-4-1)=5.
$A_{13}=(-1)_{1+3}\begin{vmatrix}2 & 1\\1 & 1\end{vmatrix}$=2-1=1.
$A_{21}=(-1)_{2+1}\begin{vmatrix}-2 & 1\\1 & -2\end{vmatrix}$=-(4-1)=-3.
$A_{22}=(-1)_{2+2}\begin{vmatrix}1 & 1\\1 & -2\end{vmatrix}$=-2-1=-3.
$A_{23}=(-1)_{2+3}\begin{vmatrix}1 & -2\\1 & 1\end{vmatrix}$=-(1+2)=-3.
$A_{31}=(-1)_{3+1}\begin{vmatrix}-2 & 1\\1 & 1\end{vmatrix}$=-2-1=-3.
$A_{32}=(-1)_{3+2}\begin{vmatrix}1 & 1\\2 & 1\end{vmatrix}$=-(1-2)=1.
$A_{33}=(-1)_{3+3}\begin{vmatrix}1 & -2\\2 & 1\end{vmatrix}$=1+4=5.
Hence the adjoint of A is $\begin{bmatrix}A_{11} & A_{21} & A_{31}\\A_{12} & A_{22} & A_{32}\\A_{13} & A_{23} & A_{33}\end{bmatrix}$
$\qquad\qquad\qquad\qquad=\begin{bmatrix}-3 & -3 & -3\\5 & -3 & 1\\1& -3& 5\end{bmatrix}$
$A^{-1}=\frac{1}{|A|}adj(A)$,we know |A|=-12.
$A^{-1}=\frac{1}{-12}\begin{bmatrix}-3 & -3 & -3\\5 & -3 & 1\\1 & -3 & 5\end{bmatrix}$
Step 3:
$A^{-1}B=X$,substituting for $A^{-1}$,B and X we get
$\begin{bmatrix}u\\v\\w\end{bmatrix}=\frac{1}{-12}\begin{bmatrix}-3 & -3& -3\\5 &-3 & 1\\1 & -3 & 5\end{bmatrix}\begin{bmatrix}1\\1\\-2\end{bmatrix}$
$\qquad=\frac{1}{-12}\begin{bmatrix}-3-3+6\\5-3-2\\1-3-10\end{bmatrix}=\begin{bmatrix}0\\0\\\frac{-12}{-12}\end{bmatrix}$
$\begin{bmatrix}u\\v\\w\end{bmatrix}=\begin{bmatrix}0\\0\\1\end{bmatrix}$
u=0,v=0,w=1.