Finding the inverse of a matrix by Gaussian elimination
I spent last hours trying to figure out how to solve the inverse matrix to this matrix: $$\begin{pmatrix} 2 &-3 & 1 \\ 1 & 2 &-1 \\ 2 & 1 & 1 \end{pmatrix}$$
The correct result should be $$\begin{pmatrix} 0.250 & 0.333 & 0.083 \\ -0.250 & 0.000 & 0.250 \\ -0.250 & -0.667 & 0.583 \end{pmatrix}$$
However, I am still unable to get there. Here how I tried it (with using the Gaussian Elimination Rule):
$$\begin{multline} \left( \begin{array}{ccc|ccc} 2 & -3 & 1 & 1 & 0 & 0 \\ 1 & 2 & -1 & 0 & 1 & 0 \\ 2 & 1 & 1 & 0 & 0 & 1 \end{array} \right) \overset{[1] - 2[2] \rightarrow [2]}{\Longrightarrow} \left( \begin{array}{ccc|ccc} 2 & -3 & 1 & 1 & 0 & 0 \\ 0 & -7 & 2 & 1 & -2 & 0 \\ 2 & 1 & 1 & 0 & 0 & 1 \end{array} \right) \overset{[1] - [3] \rightarrow [3]}{\Longrightarrow} \\ \left( \begin{array}{ccc|ccc} 2 & -3 & 1 & 1 & 0 & 0 \\ 0 & -7 & 2 & 1 & -2 & 0 \\ 0 & -4 & 0 & 1 & 0 & -1 \end{array} \right) \overset{4[2] - 7[3] \rightarrow [3]}{\Longrightarrow} \left( \begin{array}{ccc|ccc} 2 & -3 & 1 & 1 & 0 & 0 \\ 0 & -7 & 2 & 1 & -2 & 0 \\ 0 & 0 & 8 & -3 & -8 & 7 \end{array} \right) \overset{4[2] - [3] \rightarrow [2]}{\Longrightarrow} \\ \left( \begin{array}{ccc|ccc} 2 & -3 & 1 & 1 & 0 & 0 \\ 0 & -28 & 0 & 7 & 0 & -7 \\ 0 & 0 & 8 & -3 & -8 & 7 \end{array} \right) \overset{8[1] - 3[2] \rightarrow [1]}{\Longrightarrow} \left( \begin{array}{ccc|ccc} 16 & -24 & 0 & 11 & 8 & -7 \\ 0 & -28 & 0 & 7 & 0 & -7 \\ 0 & 0 & 8 & -3 & -8 & 7 \end{array} \right) \Longrightarrow \\ \left( \begin{array}{ccc|ccc} 2 & -3 & 0 & \tfrac{11}{8} & 1 & \tfrac{-7}{8} \\ 0 & -7 & 0 & \tfrac{7}{4} & 0 & \tfrac{-7}{4} \\ 0 & 0 & 8 & -3 & -8 & 7 \end{array} \right) \overset{7[1] - 3[2] \rightarrow [1]}{\Longrightarrow} \left( \begin{array}{ccc|ccc} 14 & 0 & 0 & \tfrac{35}{8} & 7 & \tfrac{-7}{8} \\ 0 & -7 & 0 & \tfrac{7}{4} & 0 & \tfrac{-7}{4} \\ 0 & 0 & 8 & -3 & -8 & 7 \end{array} \right) \Longrightarrow \\ \left( \begin{array}{ccc|ccc} 1 & 0 & 0 & 0.3125 & 0.5 & -0.0625 \\ 0 & 1 & 0 & -0.25 & 0 & 0.25 \\ 0 & 0 & 1 & -0.375 & -1 & 0.875 \end{array} \right) \end{multline}$$
I would be very grateful guys for helping me to figure out what I am doing wrong, there's always something why the whole inverse matrix is not correct.
Thank you very much
$\endgroup$ 22 Answers
$\begingroup$At first step [1]-2[2], i think the entry (2,3) is 3, while you wrote 2.
$\endgroup$ 7 $\begingroup$It's very hard to avoid unimportant bugs in this process. Here's a corrected version. (I'm not keen on performing more than one row operaion at once.) The first error is what BTTD pointed out (purely arithmetic) and it leads to other problems down the track.
\begin{align*} \begin{bmatrix} 2 & -3 & 1 & 1 & 0 & 0 \\ 1 & 2 & -1 & 0 & 1 & 0 \\ 2 & 1 & 1 & 0 & 0 & 1 \\ \end{bmatrix} &\xrightarrow{R_2 \gets -2 R_2} \begin{bmatrix} 2 & -3 & 1 & 1 & 0 & 0 \\ -2 & -4 & 2 & 0 & -2 & 0 \\ 2 & 1 & 1 & 0 & 0 & 1 \\ \end{bmatrix} \\ &\xrightarrow{R_2 \gets R_2+R_1} \begin{bmatrix} 2 & -3 & 1 & 1 & 0 & 0 \\ 0 & -7 & 3 & 1 & -2 & 0 \\ 2 & 1 & 1 & 0 & 0 & 1 \\ \end{bmatrix} \\ &\xrightarrow{R_3 \gets -R_3} \begin{bmatrix} 2 & -3 & 1 & 1 & 0 & 0 \\ 0 & -7 & 3 & 1 & -2 & 0 \\ -2 & -1 & -1 & 0 & 0 & -1 \\ \end{bmatrix} \\ &\xrightarrow{R_3 \gets R_3+R_1} \begin{bmatrix} 2 & -3 & 1 & 1 & 0 & 0 \\ 0 & -7 & 3 & 1 & -2 & 0 \\ 0 & -4 & 0 & 1 & 0 & -1 \\ \end{bmatrix} \\ &\xrightarrow{R_3 \gets 7 R_3} \begin{bmatrix} 2 & -3 & 1 & 1 & 0 & 0 \\ 0 & -7 & 3 & 1 & -2 & 0 \\ 0 & -28 & 0 & 7 & 0 & -7 \\ \end{bmatrix} \\ &\xrightarrow{R_3 \gets R_3-4R_2} \begin{bmatrix} 2 & -3 & 1 & 1 & 0 & 0 \\ 0 & -7 & 3 & 1 & -2 & 0 \\ 0 & 0 & -12 & 3 & 8 & -7 \\ \end{bmatrix} \\ &\xrightarrow{R_2 \gets 4 R_2} \begin{bmatrix} 2 & -3 & 1 & 1 & 0 & 0 \\ 0 & -28 & 12 & 4 & -8 & 0 \\ 0 & 0 & -12 & 3 & 8 & -7 \\ \end{bmatrix} \\ &\xrightarrow{R_2 \gets R_2+R_3} \begin{bmatrix} 2 & -3 & 1 & 1 & 0 & 0 \\ 0 & -28 & 0 & 7 & 0 & -7 \\ 0 & 0 & -12 & 3 & 8 & -7 \\ \end{bmatrix} \\ &\xrightarrow{R_1 \gets 12 R_1} \begin{bmatrix} 24 & -36 & 12 & 12 & 0 & 0 \\ 0 & -28 & 0 & 7 & 0 & -7 \\ 0 & 0 & -12 & 3 & 8 & -7 \\ \end{bmatrix} \\ &\xrightarrow{R_1 \gets R_1+R_3} \begin{bmatrix} 24 & -36 & 0 & 15 & 8 & -7 \\ 0 & -28 & 0 & 7 & 0 & -7 \\ 0 & 0 & -12 & 3 & 8 & -7 \\ \end{bmatrix} \\ &\xrightarrow{R_1 \gets 7 R_1} \begin{bmatrix} 168 & -252 & 0 & 105 & 56 & -49 \\ 0 & -28 & 0 & 7 & 0 & -7 \\ 0 & 0 & -12 & 3 & 8 & -7 \\ \end{bmatrix} \\ &\xrightarrow{R_1 \gets R_1-9R_2} \begin{bmatrix} 168 & 0 & 0 & 42 & 56 & 14 \\ 0 & -28 & 0 & 7 & 0 & -7 \\ 0 & 0 & -12 & 3 & 8 & -7 \\ \end{bmatrix} \\ &\xrightarrow{R_1 \gets \tfrac{1}{168} R_1} \begin{bmatrix} 1 & 0 & 0 & 1/4 & 1/3 & 1/12 \\ 0 & -28 & 0 & 7 & 0 & -7 \\ 0 & 0 & -12 & 3 & 8 & -7 \\ \end{bmatrix} \\ &\xrightarrow{R_2 \gets -\tfrac{1}{28} R_2} \begin{bmatrix} 1 & 0 & 0 & 1/4 & 1/3 & 1/12 \\ 0 & 1 & 0 & -1/4 & 0 & 1/4 \\ 0 & 0 & -12 & 3 & 8 & -7 \\ \end{bmatrix} \\ &\xrightarrow{R_3 \gets -\tfrac{1}{12} R_3} \begin{bmatrix} 1 & 0 & 0 & 1/4 & 1/3 & 1/12 \\ 0 & 1 & 0 & -1/4 & 0 & 1/4 \\ 0 & 0 & 1 & -1/4 & -2/3 & 7/12 \\ \end{bmatrix} \\ \end{align*}
$\endgroup$