# Solve Matrix Equations

I have a system of equations I'm trying to solve:

\begin{align}Q &= MP \\ Q^\prime &= M\Pi P\end{align}

$Q$, $Q^\prime$, and $P$ are all $4\times n$ matrices, and $M$ and $\Pi$ are both $4\times4$ matrices. Unfortunately, $M$ is not invertible because it has a zero determinant, and neither are $Q$, $Q^\prime$, or $P$ because they are not square. $\Pi$ should be invertible.

Given that I know $Q$, $Q^\prime$, and $M$, how can I find $\Pi$ and $P$?

Note the problem is over determined, so I'm looking for a least squares type solution.

-

## 1 Answer

Let $M^+$ denote the Moore-Penrose psuedoinverse of $M$

Solving $MP=Q$ gives:

$P=M^+Q$

Then to find $\Pi$ we can left multiply by $M^+$ and right multiply by $Q^+M=P^+$

$\Pi=M^+Q'Q^+M+(I-M^+M)X + Y(I-M^+QQ^+M)$

For arbitrary $4\times4$ matrices $X,Y$

The extra terms add a matrix whose columns are in the nullspace of $M$ and one who's rows are in the left nullspace of $P$. It represents our freedom in choosing $\Pi$

Note: This will be the least squares solution relative to the vectorized version of the system.

-
Thanks! Two questions: how do I solve for pi? it's also unknown. How do I calculate the Moore-Penrose psuedo-inverse? –  Jason Jan 20 '13 at 16:34
I think I can figure out my second question (en.wikipedia.org/wiki/…), but how do I solve for PI? –  Jason Jan 20 '13 at 16:36
Sorry, I misread your question. I thought $\Pi$ was also known. –  Tim Seguine Jan 20 '13 at 16:36
@Jason I edited the question. Are you familiar with the Singular Value Decomposition? That is usually the first step. The requirement that $\Pi$ is invertible is not exactly satisfied by this solution, but we can always find a matrix that is arbitrarily close to it which is invertible. –  Tim Seguine Jan 20 '13 at 16:53
@Jason I need to make another change. –  Tim Seguine Jan 20 '13 at 17:06