Examples of using Mathematica to solve matrix equations symbolically

Suppose we want to solve a linear system like

$$\left\lbrack\begin{array}{cc}M& S\\ -S^\mathrm{T}&0 \end{array} \right\rbrack \left\lbrack \begin{array}{c} x\\y\end{array}\right\rbrack = \left\lbrack\begin{array}{c} f\\g \end{array} \right\rbrack$$ for $x$ and $y$. Where $M\in \mathbb{R}^{n\times n}$ is symmetric positive definite, $S\in \mathbb{R}^{n\times m}$ is full rank and $x,y,f,g$ are all vectors of compatible size. It is straightforward to find the solution of this system by hand as

$$y =(S^\mathrm{T} M^{-1} S)^{-1}(S^\mathrm{T} M^{-1} f + g)$$ \begin{align*} x=& M^{-1}(f-S y)\\ =& (I- M^{-1}(S^\mathrm{T} M^{-1} S)^{-1} S^{\mathrm{T}})M^{-1}f\\ &-M^{-1}(S^\mathrm{T} M^{-1} S)^{-1} g. \end{align*}

Is there a way I can make Mathematica do this? I ask because I would like closed forms of more complicated block matrix systems.

• NCAlgebra might be what you are looking for — see here . – Stephen Luttrell Oct 7 '15 at 16:36