Solving linear algebra expressions with vectors

Assume I have the expression $A \vec{a} = B \vec{b}$, where $A$, $B$ are both $(N \times N)$ matrices, and $\vec{a},\vec{b}$ and both $(N \times 1)$ vectors. Everything is known except for $B$. Is there a definitive way to solve this system? I'm trying to solve for $B$ in case that isn't clear.

I guess I'm a bit rusty on my linear algebra, or never came across this problem.

Thanks

• It depends on the value space of $A$ and which subspaces $a$ and $b$ may lie in. In general you can express it as $\min\{\|A\vec a - B\vec b\|_2^2\}$ and then express "multiplication from left" as a matrix working on a vectorization of $B$. All this can be done with the Kronecker product. – mathreadler Aug 13 '17 at 16:05
• Sorry, I meant represent multiplication from right by $\vec b$ as a matrix. – mathreadler Aug 13 '17 at 16:14

If $\vec b = \vec 0$, then $A\vec a = B\vec b$ is solveable if and only if $A\vec a = 0$, and in this case any matrix $B$ works.

On the other hand if $\vec b\neq \vec 0$ then a solution is always given by

$$B = A\frac{\;\;\vec a \cdot \vec {b}^T}{\vec b^T \cdot \vec b}$$

Hint.

take the simple case: $N=2$. You can see that your problem gives four unknowns (the entries of the matrix $B$) and two linear equations.

So: what you know about the solutions of a linear system?

Consider $A\vec{a}\vec{b}^t = B\vec{b}\vec{b}^t$. Let $A\vec{a}\vec{b}^T = c$, an $N \times N$ matrix of known values. We now have $c = B\vec{b}\vec{b}^T$, so the question boils down to "is $\vec{b}\vec{b}^T$invertible? If so, you're just solving a few different linear system simultaneously with $c(\vec{b}\vec{b}^T)^{-1} = B$. Unfortunately, it isn't ever: prove that the product of a vector $\vec a$ and the transpose of a vector $\vec b$ is a $n \times n$ matrix with rank $1$