[Math] Inverse 4×4 matrix

linear algebramatrices

If I have a 4×4 matrix (consists of a lot of irrational numbers) and want to calculate the inverse, what is the easiest/fastest way? The calculator I am allowed to use (casio fx991 es plus) can handle matrices up to 3×3 (determinant, inverse, …)
I know that i could use gauss, but it could be very error prone if I do a mistake during calculation. An other approach is to calculate the inverse with the adjugate. Its a lot saver, as the calculator does the work but also very slow.

Best Answer

One can do an "in-place" inversion of the $4\times 4$ matrix $A$ as a bordering of the $3\times 3$ submatrix in the upper left corner, if that submatrix is itself invertible. The general technique is described by In-place inversion of large matrices.

Suppose we have:

$$ A = \begin{bmatrix} B & u \\ v' & z \end{bmatrix} $$

where $B$ is the $3\times 3$ invertible submatrix, $u$ is a $3\times 1$ "column" block, $v'$ is a $1\times 3$ "row" block, and $z$ is a single entry in the lower right corner.

We have the following steps to compute:

(1) Invert $B$, overwriting it with $B^{-1}$:

$$ \begin{bmatrix} B^{-1} & u \\ v' & z \end{bmatrix} $$

(2) Multiply column $u$ by $B^{-1}$ and replace $u$ with the negation of that matrix-vector product:

$$ \begin{bmatrix} B^{-1} & -B^{-1}u \\ v' & z \end{bmatrix} $$

(3) Next, multiply the row $v'$ times the column result from the previous step, which gives a scalar, and add this to the lower right entry:

$$ \begin{bmatrix} B^{-1} & -B^{-1}u \\ v' & z - v'B^{-1}u \end{bmatrix} $$

(4) To keep the expressions simple, let's define $s = z - v'B^{-1}u$, so that is just the current lower right entry. Take its reciprocal:

$$ \begin{bmatrix} B^{-1} & -B^{-1}u \\ v' & s^{-1} \end{bmatrix} $$

(5) Multiply the row $v'$ on the right by $B^{-1}$:

$$ \begin{bmatrix} B^{-1} & -B^{-1}u \\ v'B^{-1} & s^{-1} \end{bmatrix} $$

(6) Multiply that row result by the negative scalar reciprocal $-s^{-1}$:

$$ \begin{bmatrix} B^{-1} & -B^{-1}u \\ -s^{-1}v'B^{-1} & s^{-1} \end{bmatrix} $$

(7) Construct a $3\times 3$ matrix (simple tensor) by multiplying the column $-B^{-1}u$ and the row $-s^{-1}v'B^{-1}$, adding this to the upper left corner submatrix:

$$ \begin{bmatrix} B^{-1} + B^{-1}u s^{-1}v'B^{-1} & -B^{-1}u \\ -s^{-1}v'B^{-1} & s^{-1} \end{bmatrix} $$

(8) The last step is an easy one, we simply multiply the upper right column entries $-B^{-1}u$ by $s^{-1}$:

$$ A^{-1} = \begin{bmatrix} B^{-1} + B^{-1}u s^{-1}v'B^{-1} & -s^{-1} B^{-1}u \\ -s^{-1}v'B^{-1} & s^{-1} \end{bmatrix} $$