**Problem:** Let $x_i\in\mathbb{R}^d$ and $a_i\in [0,1]$, for all $i = 1,\dots, k$ (with $k\geq d$). Define $$M(a) = \sum_{i = 1}^k a_i x_ix_i^T,$$ and assume $M(a) \succ 0.$ 

**Question:** Is there any closed-form solution (for $a$) to this set of equations? If not, there is at least an efficient way to solve it?

$$\begin{cases}\text{trace}\left(M(a)^{-1}x_jx_j^T\right) = \text{trace}\left(M(a)^{-1}x_lx_l^T\right), \forall j \neq l,\\  \sum_{i =1}^k a_i= 1.\end{cases}$$

*Related question:* [here][1].


  [1]: https://mathoverflow.net/questions/389311/derivative-of-log-determinant

*Solution* for the simple case $d=1$ (by Carlo Beenakker):
$a_i=\frac{x_i^2}{\sum_{j = 1}^kx_j^2}, \forall i \in[k].$


**Attempted solution**: Note that the first equation can be rewritten as 

$$
x_j^T M(a)^{-1}x_j =x_l^T M(a)^{-1}x_l ,
$$
and $M(a) = X^TAX$, where $X: col(X) = \{x_i\}_{i\in[k]}$, and $A = diag(a)$.

Hence we have 

$$
(x_j^TX^{-T})A^{-1}(X^{-1}x_j) = (x_l^TX^{-T})A^{-1}(X^{-1}x_l)
$$

By denoting $\tilde{x}_i = x_i^TX^{-T}$, for all $i\in[k]$, and for a vector $x$, its n-th component $x(n)$, we can write 

$$
\sum_{i = 1}^k \frac{\tilde{x_j}(i)^2}{a_i} = \sum_{i = 1}^k \frac{\tilde{x_l}(i)^2}{a_i}.
$$

Any hint on the correctness of this procedure would be greatly appreciated.