How do i find the inverse of a 3 x 3 matrix? $$
       A= \begin{bmatrix}
        2 & 1 & -1 \\
        -2 & -2 & 1 \\
        0 & -2 & 1 \\
        \end{bmatrix}
$$
Can someone show me the best way to approach this? Should I use pivoting? I tried using the formula, but I think that only works for 2 x 2 matrices. 
 A: As an easy-to-understand process, you can note that $A.A^{-1} = I$ and then undertake parallel row operations on $A$ and $I$ to transform this into $I.A^{-1}=X$, where $X$ is the result of the same operations on $I$ that transformed $A$ into $I$. You can check, through considering the action of matrix multiplication, that the effect of row scaling or combinations maintains the equality through each transformation.
For convenience during the elimination process this can be written as an augmented matrix $[A\mid I]$:
$$\begin{align}
& \left[ \begin{array}{ccc|ccc}
2 & 1 & -1 & 1 & 0 & 0 \\
-2 & -2 & 1 & 0 & 1 & 0 \\
0 & -2 & 1 & 0 & 0 & 1 \\
  \end{array} \right] \tag{$A\mid I$}\\
& \left[ \begin{array}{ccc|ccc}
2 & 1 & -1 & 1 & 0 & 0 \\
0 & -1 & 0 & 1 & 1 & 0 \\
0 & -2 & 1 & 0 & 0 & 1 \\
  \end{array} \right] \tag{add r1 to r2}\\
& \left[ \begin{array}{ccc|ccc}
2 & 0 & -1 & 2 & 1 & 0 \\
0 & -1 & 0 & 1 & 1 & 0 \\
0 & -2 & 1 & 0 & 0 & 1 \\
  \end{array} \right] \tag{add r2 to r1}\\
& \left[ \begin{array}{ccc|ccc}
2 & 0 & -1 & 2 & 1 & 0 \\
0 & 1 & 0 & -1 & -1 & 0 \\
0 & -2 & 1 & 0 & 0 & 1 \\
  \end{array} \right] \tag{mult r2 by -1}\\
& \left[ \begin{array}{ccc|ccc}
2 & 0 & -1 & 2 & 1 & 0 \\
0 & 1 & 0 & -1 & -1 & 0 \\
0 & 0 & 1 & -2 & -2 & 1 \\
  \end{array} \right] \tag{add 2xr2 to r3}\\
& \left[ \begin{array}{ccc|ccc}
2 & 0 & 0 & 0 & -1 & 1 \\
0 & 1 & 0 & -1 & -1 & 0 \\
0 & 0 & 1 & -2 & -2 & 1 \\
  \end{array} \right] \tag{add r3 to r1} \\
& \left[ \begin{array}{ccc|ccc}
1 & 0 & 0 & 0 & -0.5 & 0.5 \\
0 & 1 & 0 & -1 & -1 & 0 \\
0 & 0 & 1 & -2 & -2 & 1 \\
  \end{array} \right] \tag{mult r1 by 0.5}\\
\text{so }&A^{-1} = \begin{bmatrix}
 0 & -0.5 & 0.5 \\
 -1 & -1 & 0 \\
-2 & -2 & 1 \\
\end{bmatrix}
\end{align}$$
There are plenty of more sophisticated methods but I think this is a good basic tool to get started with.
A: $\begin {bmatrix} 2&1&-1\\-2&-2&1\\0&-2&1 \end {bmatrix}$
We can also solve it using determinants-
Calculating determinant of the matrix 
Let $A=2[-2+2]-1[-2]-1[4]$
$=2-4=-2$
Calculating matrix of minors
$\begin {bmatrix} -2+2&&-2-0&&4-0\\1-2&&2-0&&-4-0\\1-2&&2-2&&-4+2 \end {bmatrix}$
$\begin {bmatrix} 0&-2&4\\-1&2&-4\\-1&0&-2 \end {bmatrix}$
Turning matrix of minor into matrix of cofactors.
$\begin {bmatrix} 0&2&4\\1&2&4\\-1&-2&-2 \end {bmatrix}$
Finding adjoint (Franspose) of a matrix.
$\begin {bmatrix} 0&1&-1\\2&2&0\\4&4&-2 \end {bmatrix}$
Finding inverse of matrix
Inverse $=\dfrac{1}{Det\,A}\;Adj\,A$
$\Rightarrow\dfrac{1}{-2}\begin {bmatrix} 0&1&-1\\2&2&0\\4&4&-2 \end {bmatrix}$
$\Rightarrow\begin {bmatrix} 0&&-0.5&&0.5\\-1&&-1&&0\\-2&&-2&&1 \end {bmatrix}$
