# How to Solve the Matrix Equation $WB = AV$?

We have the matrix equation $WB=AV$ where $B,A$ are given and $W,V$ are to be solved. Obviously the solution is not unique. Is there a possible way of computing it?

-
It seems like there's a lot of non-uniqueness: If one of $A$ or $B$ is invertible (say $A$), then $A^{-1}WB = V$, and for any $W$, there's a $V$ so that $WB = AV$. If neither is invertible, I don't think the situation is much improved. Or am I completely misunderstanding the question? – BaronVT Sep 13 '12 at 8:34
An obvious solution is to take $W$ and $V$ zero matrices of appropriate sizes. Do you want to find all solutions? – Marc van Leeuwen Sep 13 '12 at 10:07

I'm not sure exactly how to compute this efficiently, but I know that a result for the general form of the solution. A solution only exists if the range of $WB$ is contained in the range of $A$, so the first step is to pick any $W$ such that the range of $WB$ is contained in the range of $A$. Clearly this is possible with basically no computation, but perhaps there are some choices that would be numerically wise - I can't help you there. Then it is known that $V$ will exist and the general solution for $V$ will be of the form $$V = A^{\dagger}WB + (I - A^{\dagger}A)Y$$ where $A^{\dagger}$ is the Moore-Penrose pseudoinverse of $A$, and $Y$ is any matrix where the number of rows of $Y$ is equal to the number of columns of $A$, and the number of columns of $Y$ is equal to the number of columns of $B$. So you can basically just pick any $Y$.
For any $C$, let $W=AC$, $V=CB$ then $WB=ACB=AV$