I am looking at the following optimization problem $$\begin{align} \underset{{\bf X}}{\text{maximize}} \qquad&\mathrm{tr}({\bf AX})\\ \text{subject to} \qquad& \mathrm{tr}({\bf X}) = 1,\\ &\mathrm{tr}({\bf BX})=0,\\ &{\bf X}\succeq 0, \end{align}$$ where ${\bf A}$ is a positive semidefinite matrix, and ${\bf B}$ is a symmetric matrix. I've noticed (through experiments) that when the solution is finite, it always has a rank 1. Any idea why that is the case? Can we prove that a rank-1 solution always exists? Is there a closed-form solution to this problem that I am missing?
Note: It is clear that when the second constraint $(\mathrm{tr}({\bf BX})=0)$ is not there, the problem has a rank-1 solution, and a maximizer is ${\bf X}^* = {\bf vv}^T$, where ${\bf v}$ is the eigenvector of ${\bf A}$ corresponding to the largest eigenvalue. In the question, I am wondering about the case when there are two equality trace constraints.