# matrix regression under side conditions

I want to solve the folowing problem B*M=V, where B is the unknown of size 3x3, M of size 3xN and V of size 3xN. The difficulty is, that B has to be unitary.

N is in the range of 500. All matrices are real.

Solving the problem by multiplying from right with the pseudoinverse of M gives a solution that is close to being unitary.

Does somebody have a hint how to solve it? Best would be a solution by aid of Matlab or a C++ library like Eigen.

For this to work, the singular value decompositions of $V$ and $M$ can be written in the form $$V = U_1 \Sigma U_2^*, \ M = U_3 \Sigma U_2^*$$ with the same $\Sigma$ and $U_2$, and you have $B = U_1 U_3^*$.
• Thank you, that worked! It's a really elegant solution! But I still have some questions =) Since for me, the equality sign in $BM=V$ does not hold (but the error has to be minimized), I have $$V = U_1 \Sigma_1 U_2^*, M = U_3\Sigma_2 U_4^*$$ I have reordered $\Sigma_2$ and $U_4^*$ in a way that they are closest to $\Sigma_1$ and $U_2^*$. Of course $U_3$ was reordered accordingly to that. Now the question is: Is the resulting $B$ the best possible unitary solution to $BM=V$ or is it just one close solution? And if so: why?