My question is the following:


Suppose $M$ is an $n \times n$ symmetric real matrix. I want to find an $n \times n$ symmetric real matrix X such that $|| X -M||\_F$ is minimized with the constraint that $U^T X U \succeq 0$ (positive semidefinite), where $U$ is an $n \times d$ matrix, $U^TU = I\_d$ and $n > d$. $|| \cdot ||\_F$ is the Frobenius norm of matrix. In short:
\begin{equation}
 X^\* = \displaystyle \operatorname{argmin}\_{X:U^TXU\succeq 0}||X-M ||\_F, X, M \in \mathcal{S\_n} 
\end{equation}


Some useful information may be: $U$ can be obtained from eigenvalue decomposition of $BB^T$ or QR decomposition of $B$ in the sense that there exists $Q = [U,V]$ such that $Q^TQ = QQ^T = I\_n, U^TB = 0$. 


I would like to find a formula or construction based on eigenvalue decomposition or singular value decomposition for M. For example, if the constraint is $X \succeq 0$ instead of $U^T X U \succeq 0$, we can first apply eigenvalue decomposition to $M$ such that $M = Q \operatorname{diag}(\lambda\_1,\cdots, \lambda\_n) Q^T$, then $X^\* =Q \operatorname{diag}(\max\{\lambda\_1,0\},\cdots, \max\{\lambda\_n,0\}) Q^T $ would minimize $|| X-M ||\_F$. 


I used CVX package to compute $X^\*$ for some examples and I found some interesting facts: $ (X^\*-M) B = 0$ where $U^TB=0$ and $X^\* -M$ is always positive semidefinite while $M$ and $X^\*$ may not be positive semidefinite. Any help or suggestion of what method or tools I should use for these kind of problems would be much appreciated! Thanks~



Minimize Frobenius norm
Here's one approach to solve this problem.


Since $U$ is a thin matrix with orthogonal columns each of which has unit norm it spans a $d$ dimensional subspace within the $n$ dimensional ambient subspace. Now we can see that the constraint that $U^TXU \succeq 0$ is a looser constraint than $X \succeq 0$ since $X$ only needs to be positive definite for vectors $v \in \mathbb{R}^n$ lying in the span of columns of $U$.
Clearly, the solution to this problem is guaranteed to be a better minima than the solution obtained by setting negative eigen values to zero.


Essentially we are saying that eigen-values corresponding to those eigen-vectors of $X$ that are orthogonal to $U$ can be anything. And Eigen-values for those eigen-vectors of$X$ that lie in the span of $U$ must be positive. 


So immediately we get the following procedure for solving this problem.


1. Do Eigen decomposition of $M$ to get $n$ eigen-vectors $q\_i$
2. If $U^Tq\_i \ne 0$ then modify the corresponding eigen-value $\lambda\_i$ to $\max(0, \lambda\_i)$, Otherwise the sign does not matter, we can leave as is.


This is guaranteed to be a feasible solution, and its guaranteed to be better than the vanilla algorithm outlined in the question. 


Although this procedure is an improvement its not guaranteed to be minima of the original problem. To get a true minima some more thought is needed. I will update when I get a chance to think more about this.


