Inverse Matrices

Inverse Matrices I

Inverse II (Theory)

Inverse of Partitioned Matrices

Suppose we are given a square n×n matrix that could be partitioned as follows:
\[ {\bf A} = \begin{bmatrix} {\bf P} & {\bf Q} \\ {\bf R} & {\bf S} \end{bmatrix} , \]
where P is an r×r matrix, Q is an r×s matrix, R is an s×r matrix, and S is an s×s matrix such that r + s = n.

Assume that A−1 exists and can be partitioned in a similar way as

\[ {\bf A}^{-1} = \begin{bmatrix} {\bf X} & {\bf Y} \\ {\bf Z} & {\bf W} \end{bmatrix} , \]
where matrices Xr×r, Yr×s, Zs×r, and Ws×s are to be found. Observe that X, Y, Z, and W are of the same dimensions as P, Q, R, and S, respectively. Since A−1A = I, the identity matrix, we have
\[ {\bf A}\, {\bf A}^{-1} = \begin{bmatrix} {\bf P} & {\bf Q} \\ {\bf R} & {\bf S} \end{bmatrix}\, \begin{bmatrix} {\bf X} & {\bf Y} \\ {\bf Z} & {\bf W} \end{bmatrix} = \begin{bmatrix} {\bf I}_r & {\bf 0} \\ {\bf 0} & {\bf I}_s \end{bmatrix} , \]
where Ir and Is are identity matrices of the order r and s, respectively.

Applying the definition of the product of matrices to partitioned matrices we obtain the following equations

\[ \begin{split} {\bf P\,X} + {\bf Q\,Z} &= {\bf I}_r , \\ {\bf P\,Y} + {\bf Q\,W} &= {\bf 0} , \\ {\bf R\,X} + {\bf S\,Z} &= {\bf 0} , \\ {\bf R\,Y} + {\bf S\,W} &= {\bf I}_s . \end{split} \]
Solving for X, Y, Z, and W, gives
\[ \begin{split} {\bf W} &= \left[ {\bf S} - {\bf R\,P}^{-1}{\bf Q} \right]^{-1} , \\ {\bf Y} &= -{\bf P}^{-1} {\bf Q\,W} , \\ {\bf Z} &= -{\bf W\,R\,P}^{-1} , \\ {\bf X} &= {\bf P}^{-1} - {\bf P}^{-1}{\bf Q\,Z} . \end{split} \]
Therefore, we get
\begin{equation} \label{EqInverse.4} \begin{bmatrix} {\bf P} & {\bf Q} \\ {\bf R} & {\bf S} \end{bmatrix}^{-1} = \begin{bmatrix} \left( {\bf P} - {\bf Q} \,{\bf S}^{-1} {\bf R} \right)^{-1} & -\left( {\bf P} - {\bf Q} \,{\bf S}^{-1} {\bf R} \right)^{-1} {\bf Q}\,{\bf S}^{-1} \\ - {\bf S}^{-1} {\bf R} \left( {\bf P} - {\bf Q} \,{\bf S}^{-1} {\bf R} \right)^{-1} & {\bf S}^{-1} + {\bf S}^{-1} {\bf R} \left( {\bf P} - {\bf Q} \,{\bf S}^{-1} {\bf R} \right)^{-1} {\bf Q}\, {\bf S}^{-1} \end{bmatrix} . \end{equation}
Example 16: Upon partitioning the matrix, find its inverse. \[ {\bf A} = \begin{bmatrix} -8&-5& 6&1&-9 \\ -5& 4& -9& -8& 4 \\ 7& -9 & 5&3&0 \\ 7&-8 & 3&5&-1 \\ -9&4&0&-1&-5 \end{bmatrix} \] First, we check whether the given matrix is invertible by calculating its determinant. Since it is not zero, we conclude that matrix A is not singular.
Clear[A, Ai, At, B, Bi, B2, a, b, c, d, e, f, g, h, i, p, q, r, t, u, v, w, x, y, z, K, P, Q, R, S, W];
A = {{-8, -5, 6, 1, -9}, {-5, 4, -9, -8, 4}, {7, -9, 5, 3, 0}, {7, -8, 3, 5, -1}, {-9, 4, 0, -1, -5}};
Det[A]
-5
Of course, Mathematica is capable to find its inverse. However, our objective is to use partition of the matrix.
Inverse[A]
{{-(1054/5), 187/5, 1638/5, -(61/5), 2059/5}, {-85, 15, 132, -5, 166}, {22, -4, -34, 1, -43}, {1001/5, -(178/5), -(1557/5), 59/ 5, -(1956/5)}, {1357/5, -(241/5), -(2109/5), 78/5, -(2652/5)}}
\[ {\bf A}^{-1} = \begin{bmatrix} -(1054/5)& 187/5& 1638/5& -(61/ 5)& 2059/5 \\ -85& 15& 132& -5& 166 \\ 22& -4& -34& 1& -43 \\ 1001/5& -(178/5)& -(1557/5)& 59/5& -(1956/5) \\ 1357/5& -(241/5)& -(2109/5)& 78/5& -(2652/5) \end{bmatrix} . \] We make a partition the given matrix as follows: \[ {\bf A} = \begin{bmatrix} {\bf P} & {\bf Q} \\ {\bf R} & {\bf S} \end{bmatrix} , \] where \[ {\bf P} = \begin{bmatrix} -8& -5& \phantom{-}6 \\ -5& \phantom{-}4& -9 \\ \phantom{-}7& -9 & \phantom{-}5 \end{bmatrix} , \qquad {\bf Q} = \begin{bmatrix} \phantom{-}1& -9 \\ -8&\phantom{-}4 \\ \phantom{-}3&\phantom{-}0 \end{bmatrix} , \] \[ {\bf R} = \begin{bmatrix} \phantom{-}7&-8&3 \\ -9&\phantom{-}4&0 \end{bmatrix} , \quad {\bf S} = \begin{bmatrix} \phantom{-}5&-1 \\ -1&-5 \end{bmatrix} . \] We enter these matrices into computer.
P = {{-8, -5, 6}, {-5, 4, -9}, {7, -9, 5}};
Q = {{1, -9}, {-8, 4}, {3, 0}};
R = {{7, -8, 3}, {-9, 4, 0}};
S = {{5, -1}, {-1, -5}};
First, we calculate the common multiple in Eq.(1): \[ {\bf W} = \left( {\bf P} - {\bf Q} \,{\bf S}^{-1} {\bf R} \right)^{-1} = \begin{bmatrix} -\frac{1054}{5}& \frac{187}{5}& \frac{1638}{5} \\ -85& 15& 132 \\ \phantom{-}22& -4& -34 \end{bmatrix} . \]
W = Inverse[P - Q.Inverse[S].R]
{{-(1054/5), 187/5, 1638/5}, {-85, 15, 132}, {22, -4, -34}}
Then we calculate other terms in formula (1):
-W.Q.Inverse[S]
{{-(61/5), 2059/5}, {-5, 166}, {1, -43}}
\[ -{\bf W}\,{\bf Q}\,{\bf S}^{-1} = \begin{bmatrix} -\frac{61}{5} & \frac{2059}{5} \\ -5 & 166 \\ 1 & -43 \end{bmatrix} , \]
-Inverse[S].R.W
{{1001/5, -(178/5), -(1557/5)}, {1357/5, -(241/5), -(2109/5)}}
\[ - {\bf S}^{-1} {\bf R}\, {\bf W} = \begin{bmatrix} \frac{1001}{5} &- \frac{178}{5} & - \frac{1557}{5} \\ \frac{1357}{5} & -\frac{241}{5} & -\frac{2109}{5} \end{bmatrix} , \]
Inverse[S] + Inverse[S].R.W.Q.Inverse[S]
{{59/5, -(1956/5)}, {78/5, -(2652/5)}}
\[ {\bf S}^{-1} + {\bf S}^{-1} {\bf R}\,{\bf W}\,{\bf Q}\,{\bf S}^{-1} = \begin{bmatrix} \frac{59}{5} & - \frac{1956}{5} \\ \frac{78}{5} & -\frac{2652}{5} \end{bmatrix} . \] Substituting these expressions into formula (4), we obtain the inverse matrix.
End of Example 16


  1. Anton, Howard (2005), Elementary Linear Algebra (Applications Version) (9th ed.), Wiley International
  2. Beezer, R.A., A First Course in Linear Algebra, 2017.
  3. Dobrushkin, V.A., Applied Differential Equations. The Primary Course, second edition, CRC Press2022.
  4. Fadeev--LeVerrier algorithm, Wikipedia.
  5. Frame, J.S., A simple recursion formula for inverting a matrix, Bulletin of the American Mathematical Society, 1949, Vol. 55, p. 1045. doi:10.1090/S0002-9904-1949-09310-2
  6. Greenspan, D., Methods of matrix inversion, The American mathematical Monthly, 1955, Vol. 62, No. pp. 303--318.
  7. Karlsson, L., Computing explicit matrix inverses by recursion, Master's Thesis in Computing Science, 2006.
  8. Lightstone, A.H., Two methods of inverting matrices, Mathematics Magazine, 1968, Vol. 41, No. 1, pp. 1--7.