$$X\_{solution}=\arg\min\_X \|XAX-B|\_F \quad\mathrm{subject\ to}$$


X is square and diagonal


A is square and positive semi-definite


B is square and positive semi-definite


Any pointers or relevant search terms?



Matrix equation XAX=B where the solution must be diagonal
@Robert, we can assume that $A$ is diagonal and $X$ is symmetric, that I shall do in the sequel. We suppose that the matrices are real. You seek the argmin of the function $f:X\in Sym\rightarrow trace(UU^T)$ where $U=XAX-B$. Then $D\_Xf=0$ iff, for every symmetric matrix $H$, 
$trace((AX^2AX+XAX^2A-AXB-BXA)H)=0$. Therefore,
any symmetric candidate $X$ satisfies $AX^2AX+XAX^2A-AXB-BXA=0$ (system of equations of degree $3$), that is equivalent to $AX(XAX-B)$ is skew symmetric.


EDIT: Federico, you are right, but, in my mind, the OP assumed $X$ diagonal in order to simplify the problem. Yet, if $X$ is a unknown symmetric matrix, then we cannot assume that it is diagonal. Of course, if the OP correctly stated his question, then I considered a distinct problem.


Now we assume that $X=diag((x\_i)\_i)$. Let $Z=AX^2AX+XAX^2A-AXB-BXA$. In the same way, we obtain: for every $H$ diagonal, $trace(ZH)=0$. Therefore, for every $i$, $Z\_{i,i}=0$ and we have a system of $n$ equations of degree $3$ in the $n$ unknowns $(x\_i)\_i$. More precisely, if $A=[a\_{i,j}],B=[b\_{i,j}]$, then for every $i$, $\sum\_j a\_{i,j}^2x\_i{x\_j}^2-\sum\_ja\_{i,j}b\_{i,j}x\_j=0$.


