Consider
$$E := \{ x \in \Bbb R^n \mid x^T D x = 1 \}$$
an ellipsoid constructed by the diagonal matrix $D = \mbox{diag}(d_1, d_2, \dots, d_n)$ with $d_i > 0,\ \forall i \in [n]$. Suppose that $z$ is inside the ellipsoid, $z^T D z < 1$. What is the projection of $z$ on the surface of the ellipsoid $E$? Does the following nonconvex problem have a closed-form solution? \begin{equation} \min_{x\in \mathbb{R}^n} \ \|x-z\|_2^2 \qquad \textrm{subject to} \qquad x^TDx=1. \end{equation}
I doubt that there is a closed-form solution, following the standard procedure of KKT conditions. My inquiries on finding effective numerical methods show that there are numerical methods to solve the following related problem, for $z$ with $z^TDz>1$
\begin{equation} \min_{x\in\mathbb R^n}\ \|x-z\|_2^2 \qquad \mbox{subject to} \qquad x^TDx\le 1. \end{equation}
See this paper, for example. Any ideas on how I can probably use these methods? Or are there papers that discuss how to find a projection of a point inside an ellipsoid onto it?
I appreciate any useful information.
The fact that the $D$ matrix is diagonal makes the problem much easier. The Lagrangian is: $$L(x,y) = ||x-z||_2^2 + y\left(x^TDx-1\right)$$ so the KKT conditions are: $$(x_i-z_i) + yd_i x_i = 0 \quad \forall i$$ $$x^TDx = 1$$ The stationarity condition can also be expressed as: $$x_i = \frac{z_i}{1+yd_i}.$$ This simple expression is only possible because $D$ is diagonal, which gave rise to the term $yd_ix_i$. Due to symmetry, you know $x_i^*$ has the same sign as $z_i$, so $y\geq -1/(\max_i d_i)$. Note that $y=0$ is impossible (it leads to $x^T D x = z^TDz <1$), and that $y>0$ implies $|x_i| \leq |z_i| \; \forall i$ which is also not possible, so $y<0$ All that's left is finding $y$ for which $-1/(\max_i d_i) \leq y < 0$ and $$\sum_i d_i \left( \frac{z_i}{1+y d_i}\right)^2 = 1.$$ Since the left hand side is monotonously decreasing in $y$, you can use bisection search.