$$\begin{array}{ll} \text{minimize} & \| \mathrm X \mathrm a - \mathrm b \|_2 \\ \text{subject to} & \mathrm X \succeq \mathrm O_n\end{array}$$ where $\mathrm a, \mathrm b \in \mathbb R^n \setminus \{0_n\}$ are given. If $\color{blue}{\mathrm a^{\top} \mathrm b \geq 0}$, a (non-symmetric) solution would be $$\boxed{\bar{\mathrm X} := \frac{ \,\,\, \mathrm b \mathrm a^{\top} }{ \mathrm a^{\top} \mathrm a}}$$ as $$\bar{\mathrm X} \mathrm a - \mathrm b = \left(\frac{ \,\,\, \mathrm b \mathrm a^{\top} }{ \mathrm a^{\top} \mathrm a}\right) \mathrm a - \mathrm b = \mathrm b \left(\frac{ \mathrm a^{\top} \mathrm a }{ \mathrm a^{\top} \mathrm a}\right) - \mathrm b = \mathrm b - \mathrm b = 0_n$$ and $\bar{\mathrm X} \succeq \mathrm O_n$. Note that $\bar{\mathrm X}$ is a rank-$1$ matrix and, thus, its *nonzero* eigenvalue is equal to its trace $$\mbox{tr} (\bar{\mathrm X}) = \frac{1}{\| \mathrm a \|_2^2} \, \mbox{tr} ( \, \mathrm b \mathrm a^{\top}) = \frac{1}{\| \mathrm a \|_2^2} \, \mbox{tr} ( \mathrm a^{\top} \mathrm b ) = \frac{\mathrm a^{\top} \mathrm b}{\| \mathrm a \|_2^2} \geq 0$$ ---------- ###The least-norm solution Let us try to find a solution to the matrix equation $$\mathrm X \mathrm a = \mathrm b$$ Vectorizing, we obtain the following *underdetermined* linear system $$(\mathrm a^{\top} \otimes \mathrm I_n) \, \mbox{vec} (\mathrm X) = \mathrm b$$ where $\mathrm a^{\top} \otimes \mathrm I_n$ has full row rank. The *least-norm* solution is $$\begin{array}{rl} \mbox{vec} (\mathrm X_{\text{LN}}) &= (\mathrm a^{\top} \otimes \mathrm I_n)^{\top} \left( (\mathrm a^{\top} \otimes \mathrm I_n) (\mathrm a^{\top} \otimes \mathrm I_n)^{\top} \right)^{-1} \mathrm b\\ &= (\mathrm a \otimes \mathrm I_n) \left( (\mathrm a^{\top} \otimes \mathrm I_n) (\mathrm a \otimes \mathrm I_n) \right)^{-1} \mathrm b\\ &= (\mathrm a \otimes \mathrm I_n) \left( \mathrm a^{\top} \mathrm a \otimes \mathrm I_n \right)^{-1} \mathrm b\\ &= \left( \frac{\mathrm a}{\| \mathrm a \|_2^2} \otimes \mathrm I_n \right) \mathrm b\\ &= \frac{\mathrm a}{\| \mathrm a \|_2^2} \otimes \mathrm b\end{array}$$ Un-vectorizing, we obtain $$\mathrm X_{\text{LN}} = \frac{\,\mathrm b \mathrm a^{\top}}{\| \mathrm a \|_2^2} = \frac{\,\,\mathrm b \mathrm a^{\top}}{\mathrm a^{\top} \mathrm a}$$ which is the solution we initially obtained using intuition. ---------- ###SDP formulation The general case can be formulated as a semidefinite program (SDP). Minimizing the squared $2$-norm of $\mathrm X \mathrm a - \mathrm b$, and writing in epigraph form, we obtain a minimization problem in $\rm X$ and $t$ $$\begin{array}{ll} \text{minimize} & t\\ \text{subject to} & \| \mathrm X \mathrm a - \mathrm b \|_2^2 - t \leq 0 \\ & \mathrm X \succeq \mathrm O_n\end{array}$$ Using the Schur complement, the inequality $$\| \mathrm X \mathrm a - \mathrm b \|_2^2 - t = (\mathrm X \mathrm a - \mathrm b)^{\top} (\mathrm X \mathrm a - \mathrm b) - t \leq 0$$ can be written as the following linear matrix inequality (LMI) $$\begin{bmatrix} \mathrm I_n & \mathrm X \mathrm a - \mathrm b\\ (\mathrm X \mathrm a - \mathrm b)^{\top} & t\end{bmatrix} \succeq \mathrm O_{n+1}$$ Thus, we have the following SDP in $\rm X$ and $t$ $$\begin{array}{ll} \text{minimize} & t\\ \text{subject to} & \begin{bmatrix} \mathrm I_n & \mathrm X \mathrm a - \mathrm b & \mathrm O_n\\ (\mathrm X \mathrm a - \mathrm b)^{\top} & t & 0_n^{\top}\\ \mathrm O_n & 0_n & \mathrm X\end{bmatrix} \succeq \mathrm O_{2n+1}\end{array}$$