# Thread: Separating system of equations

1. ## Separating system of equations

Hi,

Given a matrix $\displaystyle A = \begin{bmatrix} B & 0 & 0 & -XB \\ 0 & B & 0 & -YB \\ 0 & 0 & B & -ZB \end{bmatrix}$

where $\displaystyle B$ is a non-negative m x n matrix and $\displaystyle X, Y, Z$ are m x m diagonal matrices.

How would I produce the following:

$\displaystyle \begin{bmatrix} B^T{B} & 0 & 0 & -B^{T}XB \\ 0 & B^T{B} & 0 & -B^{T}YB \\ 0 & 0 & B^{T}B & -B^{T}ZB \\ 0 & 0 & 0 & M \end{bmatrix}$

where $\displaystyle M = M_x + M_y + M_z$
$\displaystyle M_x = B^{T}X^{2}B - (B^{T}XB)(B^{T}B)^{-1}(B^{T}XB)$
$\displaystyle M_y = B^{T}Y^{2}B - (B^{T}YB)(B^{T}B)^{-1}(B^{T}YB)$
$\displaystyle M_z = B^{T}Z^{2}B - (B^{T}ZB)(B^{T}B)^{-1}(B^{T}ZB)$

Starting from:

$\displaystyle A^{T}A = \begin{bmatrix} B^T{B} & 0 & 0 & -B^{T}XB \\ 0 & B^T{B} & 0 & -B^{T}YB \\ 0 & 0 & B^{T}B & -B^{T}ZB \\ -B^{T}XB & -B^{T}YB & -B^{T}ZB & B^{T}X^{2}B + B^{T}Y^{2}B + B^{T}Z^{2}B \end{bmatrix}$

I'm also wondering if the inverses could be avoided somehow, since $\displaystyle B^{T}B$ may not be invertible.