Solve for matrix trace equation

82 Views Asked by At

How to solve for $\mathbf X \in \mathbb R^{m \times n}$ given:

$$ \operatorname{tr}(\mathbf P\mathbf X) = q\,, $$

where $\operatorname{tr}$ is matrix trace, with $\mathbf P \in \mathbb R^{n \times m}$ and $q$ known? I'm aware of the existing question Solving a matrix equation with unknown inside trace. The difference is that $q$ is not limited to zero. Thanks!

1

There are 1 best solutions below

3
On BEST ANSWER

If $q=0$, choose $X=0$. Otherwise, let $P= U D V^T$ be the SVD with $D$ diagonal. Now simply choose $X=V Z U^T$ where $Z$ is also diagonal but $Z_{ii} = q/mD_{ii}$. This ensures that $$\operatorname{tr}(PX) = \operatorname{tr}(UDV^T VZU^T) = \operatorname{tr}(DZ) = q$$ where we used the cyclic property of the trace and the fact that $U^T U = I$ and $V^T V = I$.