**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.$$

**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

**Observation**: The first equation can be also rewritten as 

$$
x_j^T M(a)^{-1}x_j =x_l^T M(a)^{-1}x_l ,$$ is this easier to solve?

*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].$