If $$A = \begin{bmatrix} 1 & -1 & 1 \\ 2 & 1 & -3 \\ 1 & 1 & 1 \end{bmatrix}$$, find $$A^{-1}$$ and hence solve the equation : $x+2y+z=4, -x+y+z=0 ,x-3y+z = 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:
Let us find the determinant of matrix A.
$|A|=1(1\times 1-1\times -3)-(-1)(2\times 1-1\times -3)+1(2\times 1-1\times 1)$
$\;\;=4+5+1=10 \neq 0$
Therefore matrix A is a non-singular matrix and hence $A^{-1}$ exists.
Step 2:
Next let us find the cofactors of the elements of matrix A
$A_{11}=(-1)^{1+1}\begin{vmatrix}1 & -3\\1 & 1\end{vmatrix}$=1+3=4.
$A_{12}=(-1)^{1+2}\begin{vmatrix}2 & -3\\1 & 1\end{vmatrix}$=-(2+3)=-5.
$A_{13}=(-1)^{1+3}\begin{vmatrix}2 & 1\\1 & 1\end{vmatrix}$=2-1=1.
$A_{21}=(-1)^{2+1}\begin{vmatrix}-1 & 1\\1 & 1\end{vmatrix}$=-(-1-1)=2.
$A_{22}=(-1)^{2+2}\begin{vmatrix}1 & 1\\1 & 1\end{vmatrix}$=0
$A_{23}=(-1)^{2+3}\begin{vmatrix}1 & -1\\1 & 1\end{vmatrix}$=-(1+1)=-2.
$A_{31}=(-1)^{3+1}\begin{vmatrix}-1 & 1\\1 & -3\end{vmatrix}$=3-1=2.
$A_{32}=(-1)^{3+2}\begin{vmatrix}1 & 1\\2 & -3\end{vmatrix}$=-(-3-2)=5.
$A_{33}=(-1)^{3+3}\begin{vmatrix}1 & -1\\2 & 1\end{vmatrix}$=1+2=3.
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}4 & 2 & 2\\-5 & 0 & 5\\1& -2& 3\end{bmatrix}$
$A^{-1}=\frac{1}{|A|}adj(A)$,we know |A|=10.
$A^{-1}=\frac{1}{10}\begin{bmatrix}4 & 2 & 2\\-5 & 0 & 1\\1 & -2 & 3\end{bmatrix}$
Step 3:
The given system of equation is of the form AX=B.
(i.e)$\begin{bmatrix}1 & 2& 1\\-1&1 & 1\\1 & -3 & 1\end{bmatrix}\begin{bmatrix}x\\y\\z\end{bmatrix}=\begin{bmatrix}4\\0\\2\end{bmatrix}$
Where $A=\begin{bmatrix}1 & 2&1\\-1 & 1 & 1\\1 & -3 &1\end{bmatrix},X=\begin{bmatrix}x\\y\\z\end{bmatrix}$ and $B=\begin{bmatrix}4\\0\\2\end{bmatrix}$
Let us rearrange the rows and columns of A
$A=\begin{bmatrix}1 & -1& 1\\2 & 1 &-3\\1 & 1& 1\end{bmatrix}$
The inverse of the above matrix is found to be
$A^{-1}=\frac{1}{10}\begin{bmatrix}4 & 2& 2\\-5 & 0 & 5\\1 & -2 & 3\end{bmatrix}$
Step 4:
$A^{-1}B=X$,substituting for $A^{-1}$,B and X we get
$\begin{bmatrix}x\\y\\z\end{bmatrix}=\frac{1}{10}\begin{bmatrix}4 & 2& 2\\-5 &0 & 5\\1 & -2 & 3\end{bmatrix}\begin{bmatrix}4\\0\\2\end{bmatrix}$
$\begin{bmatrix}x\\y\\z\end{bmatrix}=\frac{1}{10}\begin{bmatrix}16+0+4\\-20+0+10\\4+0+6\end{bmatrix}=\begin{bmatrix}\frac{20}{10}\\\frac{-10}{10}\\\frac{10}{10}\end{bmatrix}$
$\begin{bmatrix}x\\y\\z\end{bmatrix}=\begin{bmatrix}2\\-1\\1\end{bmatrix}$
Therefore x=2,y=-1 and z=1.