A super Matrix $M={{M1, M2}, {M3, M4}}$ is invertible, if both the diagonal blocks, $M_1$ and $M_4$ are invertible.
In this case, the inverse is given by a blocked matrix, $T=\begin{pmatrix} T1&T2\\ T3&T4\end{pmatrix}$, where $T_1=(M_1 − M_2M^{-1}_4 M_3)^{-1}$, $T_2=−M^{-1}_1 M_2(M_4 − M_3M^{-1}_1 M_2)^{-1}$, $T_3=−M^{-1}_4 M_3(M_1 − M_2M^{-1}_4 M_3)^{-1}$, and $T_4=(M_4 − M_3M^{-1}_1 M_2)^{-1}$.
i1 : M1 = matrix{{5, 7}, {1, 2}}; 2 2 o1 : Matrix ZZ <--- ZZ |
i2 : M2 = matrix{{1, 2, 3}, {4, 5, 6}}; 2 3 o2 : Matrix ZZ <--- ZZ |
i3 : M3 = matrix{{3, 4}, {5, 6}, {7, 8}}; 3 2 o3 : Matrix ZZ <--- ZZ |
i4 : M4 = matrix{{2, 3, 11}, {4, 5, 6}, {7, 8, 9}}; 3 3 o4 : Matrix ZZ <--- ZZ |
i5 : G = superMatrixGenerator(M1, M2, M3, M4); |
i6 : inverseSuperMatrix(G, QQ) o6 = | -1 -3/4 0 11/4 -1 | | 1 1/2 0 -5/2 1 | | 1 5/84 1/7 -139/28 58/21 | | -1 11/84 -2/7 131/28 -53/21 | | 0 -1/42 1/7 -3/14 2/21 | 5 5 o6 : Matrix QQ <--- QQ |
The object inverseSuperMatrix is a method function.