Originally Posted by

**HallsofIvy** The best thing to do is work one column at a time, working from left to right. You want to get a "1" at the pivot position (the main diagonal element for that particular column) so divide the entire row by that number. (Unless, of course, it is 0. If so, swap with a lower row. If the pivot and all lower numbers in that column are 0, the matrix is not invertible). Then, to get a 0 in that column in rows both above and below that pivot row, subtract that number times the pivot row from the row.

Here, you have

$\displaystyle \begin{bmatrix}1 & 1 & 0 \\ 1 & 1 & 1 \\ 0 & 2 & 1\end{bmatrix}\begin{bmatrix}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1\end{bmatrix}$

Since there is already a 1 in the pivot position (first row first column) you don't have to do anything to the first row (divide by 1). There is a 1 in second row, first column so subtract (1 times) the first row from the second column. There is already a 0 in the first column of the third row so you don't have to do anything to the third row (subtract 0 times the first row from the third row).

$\displaystyle \begin{bmatrix}1 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 2 & 1\end{bmatrix}\begin{bmatrix}1 & 0 & 0 \\ -1 & 1 & 0 \\ 0 & 0 & 1\end{bmatrix}$

Now, we have a 0 in the pivot position (second row of the second column) so we have to swap the second and third rows

$\displaystyle \begin{bmatrix}1 & 1 & 0 \\ 0 & 2 & 1\\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix}1 & 0 & 0 \\ 0 & 0 & 1\\ -1 & 1 & 0 \end{bmatrix}$

Since there is a 2 in the pivot position now, divide the second row by 2. Since there is a 1 in the first row of the second column, subtract 1 times the new second row from the first row. Since there is a 0 in the third row of the second column, subtract 0 times the new second row from the first row (in other words, don't change it).

$\displaystyle \begin{bmatrix}1 & 0 & -\frac{1}{2} \\ 0 & 1 & \frac{1}{2}\\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix}1 & 0 & -\frac{1}{2} \\ 0 & 0 & \frac{1}{2}\\ -1 & 1 & 0 \end{bmatrix}$

The pivot position is now the third row of the third column. There is a 1 there so we don't have to do anything to the third row. There is a $\displaystyle -\frac{1}{2}$ in the first row of the third column so we add $\displaystyle \frac{1}{2}$ the third row to the first row. There is a $\displaystyle \frac{1}{2}$ in the second row of the third column so we subtract $\displaystyle \frac{1}{2}$ the third row from the second row.

$\displaystyle \begin{bmatrix}1 & 0 & 0 \\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix}\frac{1}{2} & \frac{1}{2} & -\frac{1}{2} \\ \frac{1}{2} & -\frac{1}{2} & \frac{1}{2}\\ -1 & 1 & 0 \end{bmatrix}$

That is, the inverse to $\displaystyle \begin{bmatrix}1 & 1 & 0 \\ 1 & 1 & 1 \\ 0 & 2 & 1\end{bmatrix}$ is $\displaystyle \begin{bmatrix}\frac{1}{2} & \frac{1}{2} & -\frac{1}{2} \\ \frac{1}{2} & -\frac{1}{2} & \frac{1}{2}\\ -1 & 1 & 0 \end{bmatrix}$