[Math] Easy way to calculate inverse of an LU decomposition.

linear algebramatricesmatrix decomposition

I have a matrix A and a lower triangular matrix L (with 1's along the diagonal) and an upper triangular matrix U. These are constructed such that $A=LU$. I know that $A^{-1} = L^{-1}U^{-1}$ and I know that the inverse of L is simply the non-diagonal entries with their signs flipped.

Question: Is there an easy way to find the inverse of U?

example: $$\begin{bmatrix}8 & 1 &6\\3 & 5 & 7\\4&9&2\end{bmatrix}^{-1} = \begin{bmatrix}1 & 0 &0\\-.5 & 1 & 0\\-.375 & -.544 & 1\end{bmatrix}\begin{bmatrix}8 & 1 &6\\0 & 8.5 & -1\\0&0&5.294\end{bmatrix}^{-1}$$

I need to find an algorithm for computing the inverse of the far right upper triangular matrix.

Best Answer

A better aproach might be the following.

\begin{equation} \tag{1} \label{inverse} A \cdot A^{-1} = I_3 \end{equation}

Consider $A = L \cdot U$ the $LU$ decomposition of $A$. Then, because of \eqref{inverse},

\begin{equation*} L \cdot U \cdot A^{-1} = I \end{equation*}

or

\begin{equation*} \begin{bmatrix} 1 & 0 & 0 \\ -.5 & 1 & 0 \\ -.375 & -5.44 & 1 \end{bmatrix} \cdot \begin{bmatrix} 8 & 1 & 6 \\ 0 & 8.5 & -1 \\ 0 & 0 & 5.294 \end{bmatrix} \cdot \begin{bmatrix} v_1 & v_2 & v_3 \end{bmatrix} = \begin{bmatrix} e_1 & e_2 & e_3 \end{bmatrix} \end{equation*}

Where

  • $v_i$ are the colum vectors of $A^{-1}$
  • $e_i$ are standard unit vectors so that the right hand side of the equation represents the identity matrix.

Now you know you can easily calculate $v_i$ in the equation $L \cdot U \cdot v_i = e_i$ for every $i$ and you will have calculated $A^{-1}$.