$$D=X-M(X\circ P)$$ Solve for $X$


$D, X, P$ are vectors of size $n$.

$M$ is a matrix of size $n \times n$.

$X\circ P$ indicates element wise multiplication of $X$ and $P$ such that $(X \circ P)_i = X_i P_i$

I am aware that in general, some values of $M$ would support multiple solutions of $X$. But I suspect that in my cases there are unique solutions, so a strategy that finds any solution in the general case would suffice. Even some iterative algorithm would be acceptable.

For extra credit, is it possible to determine, based on $M$, when a unique solution exists?

  • 4
    $\begingroup$ If you consider the data of $P$ as "inside your matrix" $M$, you can go back to the standard theory of linear systems. Explicitly, $X\circ P$ is equal to the matrix multiplication $diag(P) X$, where $diag(P)$ is simply the diagonal matrix with entries the coefficients of $P$, so you're asking how to solve $D= (I_n - M diag(P))X$. $\endgroup$ Commented Apr 26 at 9:10
  • 1
    $\begingroup$ @AntonioLorenzin this is an awesome trick to know. I should be able to take it from here. $\endgroup$ Commented Apr 26 at 9:26

1 Answer 1


Rewrite your equation as $D= X - M \mathcal{D}_P X$ where $\mathcal{D}_P = \begin{pmatrix} p_1 & 0 & \ldots \\ 0 & p_2 & \ldots \\ \ldots & 0 & p_n \end{pmatrix}$

So the problem becomes a standard system of equations $D=(I-M\mathcal{D}_P)X$.

If $I-M\mathcal{D}_P$ is invertible, you find $X= (I-M\mathcal{D}_P)^{-1}D$. In this case (1 is not an eigenvalue of $M\mathcal{D}_P$) you have unique solution of the problem.

Otherwise, use standard linear algebra theorems to find solutions (if any, they will be infinite).


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .