Formula for the inverse of a block-matrix Let $A, B, C, D ∈ R^{n×n}$. Show that if $A, B, C − D(B^{−1})A$, and $D − C(A^{−1}B$ are nonsingular then
$$\begin{bmatrix}
    \mathbf{A} & \mathbf{B} \\
    \mathbf{C} & \mathbf{D}
  \end{bmatrix}^{-1} = \begin{bmatrix}
     \mathbf{A}^{-1} + \mathbf{A}^{-1}\mathbf{B}\left(\mathbf{D} - \mathbf{CA}^{-1}\mathbf{B}\right)^{-1}\mathbf{CA}^{-1} &
      -\mathbf{A}^{-1}\mathbf{B}\left(\mathbf{D} - \mathbf{CA}^{-1}\mathbf{B}\right)^{-1} \\
    -\left(\mathbf{D}-\mathbf{CA}^{-1}\mathbf{B}\right)^{-1}\mathbf{CA}^{-1} &
       \left(\mathbf{D} - \mathbf{CA}^{-1}\mathbf{B}\right)^{-1}
  \end{bmatrix}$$
 A: Let $\begin{bmatrix}\mathbf{X}_1 & \mathbf{X}_2 \\\mathbf{X}_3 & \mathbf{X}_4 \end{bmatrix} \in \mathbb{R}^{2n\times2n}$ be a matrix such that,
$$\begin{bmatrix}\mathbf{A} & \mathbf{B} \\\mathbf{C} & \mathbf{D} \end{bmatrix} \begin{bmatrix}\mathbf{X}_1 & \mathbf{X}_2 \\\mathbf{X}_3 & \mathbf{X}_4 \end{bmatrix} = \mathbf{I}_{2n\times2n}.$$
Then, we have four matrix equations in four matrix unknowns,
\begin{align}
 \mathbf{A}\mathbf{X}_1 + \mathbf{B}\mathbf{X}_3 &= \mathbf{I}_{n\times n}, \tag{1}\\
 \mathbf{A}\mathbf{X}_2 + \mathbf{B}\mathbf{X}_4 &= \mathbf{0}_{n\times n}, \tag{2}\\
 \mathbf{C}\mathbf{X}_1 + \mathbf{D}\mathbf{X}_3 &= \mathbf{0}_{n\times n},\tag{3}\\
 \mathbf{C}\mathbf{X}_2 + \mathbf{D}\mathbf{X}_4 &= \mathbf{I}_{n\times n} \tag{4}.
\end{align}
Solve for $\mathbf{X}_1, \mathbf{X}_2, \mathbf{X}_3$ and $\mathbf{X}_4$, and use the Woodbury identity,
$$\left(\mathbf{A} + \mathbf{U}\mathbf{B}\mathbf{V} \right)^{-1} = \mathbf{A}^{-1} - \mathbf{A}^{-1}\mathbf{U}\left(\mathbf{B}^{-1}+\mathbf{V}\mathbf{A}^{-1}\mathbf{U}\right)^{-1}\mathbf{V}\mathbf{A}^{-1}.$$
