# Find the inverse of a $4\times4$ matrix

My matrix looks like this: $$\left(\begin{array}{rrrr} 1& 1 & 1 & 1\\ 1& -1 & 1 & 0\\ 1& 1 & 0 & 0\\ 1& 0 & 0 & 0 \end{array}\right)$$

The right lower half are all zeros.

Is there a quick way to find an inverse of this matrix?

I have the solution, but I'm unable to find the algorithm to get the inverse.

• Take a $4\times 8$ matrix whose first 4 columns are your matrix, and the last 4 columns are the identity. Then row-reduce until you get the identity on the first 4 columns. The matrix you get on the last four columns is the inverse of your matrix. – Arturo Magidin May 6 '12 at 21:06

Given an invertible $n\times n$ matrix, an inverse can be obtain through Gaussian elimination. Take an $n\times 2n$ matrix of the form $(A|I_n)$ ($I_n$ is the $n\times n$ identity matrix); row reduce until you get the identity in the first $n$ columns; the last $n$ columns are the inverse. Here: \begin{align*} \left(\begin{array}{rrrr|rrrr} 1&1&1&1& 1& 0 & 0& 0\\ 1& -1 & 1 & 0 & 0 & 1 & 0 & 0\\ 1 & 1 & 0 & 0& 0 & 0 & 1 & 0\\ 1 & 0 & 0 & 0 & 0 &0 & 0 & 1 \end{array}\right) &\to \left(\begin{array}{rrrr|rrrr} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1\\ 1 & 1 & 0 & 0 & 0 & 0 & 1 & 0\\ 1 & -1 & 1 & 0 & 0 & 1 & 0 & 0\\ 1 & 1 & 1 & 1 & 1 & 0 & 0 & 0 \end{array}\right)\\ &\to \left(\begin{array}{rrrr|rrrr} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1\\ 0 & 1 & 0 & 0 & 0 & 0 & 1 & -1\\ 0 & -1 & 1 & 0 & 0 & 1 & 0 & -1\\ 0 & 1 & 1 & 1 & 1 & 0 & 0 & -1 \end{array}\right)\\ &\to \left(\begin{array}{rrrr|rrrr} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1\\ 0 & 1 & 0 & 0 & 0 & 0 & 1 & -1\\ 0 & 0 & 1 & 0 & 0 & 1 & 1 & -2\\ 0 & 0 & 1 & 1 & 1 & 0 & -1 & 0 \end{array}\right)\\ &\to \left(\begin{array}{rrrr|rrrr} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1\\ 0 & 1 & 0 & 0 & 0 & 0 & 1 & -1\\ 0 & 0 & 1 & 0 & 0 & 1 & 1 & -2\\ 0 & 0 & 0& 1 & 1 & -1 & -2 & 2 \end{array} \right) \end{align*}

So the inverse of your matrix is $$\left(\begin{array}{rrrr} 0 & 0 & 0 & 1\\ 0 & 0 & 1 & -1\\ 0 & 1 & 1 & -2\\ 1 & -1 & -2 & 2 \end{array}\right).$$

Added. The method can also be used if you don't know whether your matrix is invertible. Perform row reduction; if you get a row that has zeros on the first $n$ columns, then your original matrix was not invertible. Otherwise, you get the identity matrix on the left and obtain an inverse.

Added 2. It is also possible to figure out the inverse in an ad hoc manner because $A$ is fairly simple: interpret it as a linear transformation. The linear transformation maps $e_4$ to $e_1$, so the inverse must map $e_1$ to $e_4$, giving the first column.

$A$ maps $e_3$ to $e_1+e_2$, so the inverse must map $e_1+e_2$ to $e_3$; since it maps $e_1$ to $e_4$, the inverse maps $e_2 = (e_1+e_2)-e_1$ to $e_3-e_4$. That's the second column.

$A$ maps $e_2$ to $e_1-e_2+e_3$, so $A^{-1}$ maps $e_1-e_2+e_3$ to $e_2$; therefore, it maps $e_3 = (e_1-e_2+e_3) +(e_1+e_2) - 2e_1$ to $e_2 + e_3 -2e_4$. This gives the third column.

And finally, since $A$ maps $e_1$ to $e_1+e_2+e_3+e_4$, $A^{-1}$ maps $e_1+e_2+e_3+e_4$ to $e_1$. Hence it maps $e_4= (e_1+e_2+e_3+e_4) - (e_1-e_2+e_3)-2(e_1+e_2)+2e_1$ to $e_1-e_2-2e_3+2e_4$.

Of course, this amounts to just doing the row-reduction in an ad hoc manner...

Another way. Let your matrix be $A$. Then $A = J B$ where $$J = \pmatrix{0&0&0&1\cr 0 & 0 & 1 & 0\cr 0 & 1 & 0 & 0\cr 1 & 0 & 0 & 0\cr}, \ B = JA = \pmatrix{1 & 0 & 0 & 0\cr 1 & 1 & 0 & 0\cr 1 & -1 & 1 & 0\cr 1 & 1 & 1 & 1\cr}$$ since multiplying by $J$ on the left flips the matrix vertically (interchanging first and fourth rows and second and third rows).

Now $B$ is a lower triangular matrix. We can write it as $I + N$ where the nonzero entries of $N$ are all below the main diagonal. Thus $N^4 = 0$ and $$B^{-1} = I - N + N^2 - N^3 =\pmatrix{ 1 & 0 & 0 & 0 \cr 0 & 1 & 0 & 0 \cr 0 & 0 & 1 & 0 \cr 0 & 0 & 0 & 1 \cr} - \pmatrix{ 0 & 0 & 0 & 0 \cr 1 & 0 & 0 & 0 \cr 1 & -1 & 0 & 0 \cr 1 & 1 & 1 & 0 \cr} + \pmatrix{ 0 & 0 & 0 & 0 \cr 0 & 0 & 0 & 0 \cr -1 & 0 & 0 & 0 \cr 2 & -1 & 0 & 0 \cr} - \pmatrix{ 0 & 0 & 0 & 0 \cr 0 & 0 & 0 & 0 \cr 0 & 0 & 0 & 0 \cr -1 & 0 & 0 & 0 \cr} = \pmatrix{ 1 & 0 & 0 & 0 \cr -1 & 1 & 0 & 0 \cr -2 & 1 & 1 & 0 \cr 2 & -2 & -1 & 1 \cr}$$

We'll then have $$A^{-1} = B^{-1} J^{-1} = B^{-1} J = \pmatrix{ 0 & 0 & 0 & 1 \cr 0 & 0 & 1 & -1 \cr 0 & 1 & 1 & -2 \cr 1 & -1 & -2 & 2 \cr}$$ where multiplying by $J$ on the right flips the matrix horizontally (interchanging first and fourth columns and second and third columns).

You can also do it by inspection. Let $X$ be the inverse, and $\overline{x_i}$ the i-th row. Then

$$\left(\begin{array}{rrrr} 1 & 1 & 1 & 1\\ 1 & -1 & 1 & 0\\ 1 & 1 & 0 & 0\\ 1 & 0 & 0 & 0 \end{array}\right) X = I$$

So, considering first the last row, we get

$$(1 \; \phantom{-}0 \; \phantom{-}0 \; \phantom{-}0) \left(\begin{array}{r} \overline{x_1} \\ \overline{x_2} \\ \overline{x_3} \\ \overline{x_4} \end{array}\right) = \overline{x_1} = (0 \; \phantom{-}0 \; \phantom{-}0 \; \phantom{-}1)$$

Then, from row 3 we get

$$(1 \; \phantom{-}1 \; \phantom{-}0 \; \phantom{-}0) \left(\begin{array}{r} \overline{x_1} \\ \overline{x_2} \\ \overline{x_3} \\ \overline{x_4} \end{array}\right) = \overline{x_1} + \overline{x_2} = (0 \; \phantom{-}0 \; \phantom{-}1 \; \phantom{-}0) \Rightarrow \overline{x_2} = (0 \; \phantom{-}0 \; \phantom{-}1 \; -1)$$

and

$$(1 \; -1 \; \phantom{-}1 \; \phantom{-}0) \left(\begin{array}{r} \overline{x_1} \\ \overline{x_2} \\ \overline{x_3} \\ \overline{x_4} \end{array}\right) = \overline{x_1} - \overline{x_2} + \overline{x_3} = (0 \; \phantom{-}1 \; \phantom{-}0 \; \phantom{-}0) \Rightarrow \overline{x_3} = (0 \; \phantom{-}1 \; \phantom{-}1 \; -2)$$

$$(1 \; \phantom{-}1 \; \phantom{-}1 \; \phantom{-}1) \left(\begin{array}{r} \overline{x_1} \\ \overline{x_2} \\ \overline{x_3} \\ \overline{x_4} \end{array}\right) = \overline{x_1} + \overline{x_2} + \overline{x_3} + \overline{x_4} = (1 \; \phantom{-}0 \; \phantom{-}0 \; \phantom{-}0) \Rightarrow \overline{x_4} = (1 \; -1 \; -2 \; \phantom{-}2)$$