Linear Algebra/Matrix Inverses

An n-by-n matrix A is the inverse of n-by-n matrix B (and B the inverse of A) if BA = AB = I, where I is an identity matrix.

The inverse of an n-by-n matrix can be calculated by creating an n-by-2n matrix which has the original matrix on the left and the identity matrix on the right. Row reduce this matrix and the right half will be the inverse. If the matrix does not row reduce completely it does not have an inverse.

Example
Let $$ \mathrm{A} = \begin{bmatrix} 1 & 4 & 4\\ 2 & 5 & 8\\   3 & 6 & 9 \end{bmatrix}$$

We begin by expanding and partitioning A to include the identity matrix, and then proceed to row reduce A until we reach the identity matrix on the left-hand side.



\begin{bmatrix} 1 & 4 & 4 & \big| & 1 & 0 &0\\ 2 & 5 & 8 & \big| & 0 & 1 &0\\ 3 & 6 & 9 & \big| & 0 & 0 &1 \end{bmatrix}

\rightsquigarrow

\begin{bmatrix} 1 & 4 & 4 & \big| & 1 & 0 &0\\ 0 & -3 & 0 & \big| & -2 & 1 &0\\ 0 & -6 & -3 & \big| & -3 & 0 &1 \end{bmatrix}

\rightsquigarrow

\begin{bmatrix} 1 & 4 & 4 & \big| & 1 & 0 &0\\ 0 & 1 & 0 & \big| & 2/3 & -1/3 &0\\ 0 & -6 & -3 & \big| & -3 & 0 &1 \end{bmatrix}

\rightsquigarrow

$$

\begin{bmatrix} 1 & 0 & 4 & \big| & -5/3 & 4/3 &0\\ 0 & 1 & 0 & \big| & 2/3 & -1/3 &0\\ 0 & 0 & -3 & \big| & 1 & -2 &1 \end{bmatrix}

\rightsquigarrow

\begin{bmatrix} 1 & 0 & 4 & \big| & -5/3 & 4/3 &0\\ 0 & 1 & 0 & \big| & 2/3 & -1/3 &0\\ 0 & 0 & 1 & \big| & -1/3 & 2/3 &-1/3 \end{bmatrix}

\rightsquigarrow

\begin{bmatrix} 1 & 0 & 0 & \big| & -1/3 & -4/3 &4/3\\ 0 & 1 & 0 & \big| & 2/3 & -1/3 &0\\ 0 & 0 & 1 & \big| & -1/3 & 2/3 &-1/3 \end{bmatrix}

$$ The matrix $$ \mathrm{B} = \begin{bmatrix} -1/3 & -4/3 & 4/3\\ 2/3 & -1/3 & 0\\   -1/3 & 2/3 & -1/3 \end{bmatrix} $$ is then the inverse of the original matrix A.