Standard solution to semidefinite program I have an optimization problem of the following form
$$\text{minimize} \,\|Qa-b\|_2 \quad \text{ subject to } Q \succeq 0$$ 
where $a,b \in \mathbb{R}^n$ are given and the $n \times n$ square matrix $Q$ is the variable. 


*

*It is most probably a semidefinite programming problem. Is there a standard answer to this problem? 

*If not, which algorithm is best suited to solve this problem?
 A: $$\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. 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}$$
A: I will assume throughout that the definition of positive semidefiniteness includes symmetry.  The problem is to find the Euclidean projection of $b$ onto the convex set $R = \{Qa \mid Q\succeq 0\}$.  Let $S = \{c \mid c^Ta \geq 0\}$, which is closed.  We first show that $S$ is the closure of $R$.  If $c\in R$ then $c=Qa$ for some $Q\succeq 0$ so $c^Ta = a^TQa \geq 0$ and $c\in S$.  Conversely if $c$ is in the interior of $S$, so $c^Ta > 0$, then let $Q = bb^T$ for $b = \frac{c}{\sqrt{c^Ta}}$, so $Q$ is positive semidefinite and $Qa = c\frac{c^Ta}{c^Ta} = c\in R$.  Therefore $\overline{R}=S$.
Projecting $b$ onto the closed set $S$ is easy: if $b^Ta \geq 0$ then the projection is $b$, otherwise the projection is $b - \frac{b^Ta}{a^Ta}a$.
This leaves the question of whether this infimum is actually achieved by some $Q$, i.e. whether the projection is in $R$.  In general it may not be: for example take $a = \begin{bmatrix}1 \\ 0\end{bmatrix}$ and $b = \begin{bmatrix}0 \\ 1\end{bmatrix}$.  Then $b^Ta = 0$, so the projection of $b$ onto $S$ is $b$.  But now suppose there is some positive semidefinite $Q$ with $Qa = b$.  By symmetry this means $Q = \begin{bmatrix}0 & 1 \\ 1 & q\end{bmatrix}$ for some $q\geq 0$.  But then $\det Q = -1$, contradicting positive semidefiniteness.
