Find a formula for the orthogonal projection of $y \in \mathbb{R}^3$ onto the space $\{x: x_1^2 + 2 x_2^2 + 3 x_3^2 \leq 1\}$. The formula should depend on a single parameter that is a root of a strictly decreasing one-dimensional function.
It's obvious that $x = y$ when $y$ is in the set in question, so throughout assume that $y$ is not in the space onto which we are projecting (which also gives us that $y$ is non-zero).
Here's what I feel is my best attempt so far: Write $f(x) = \|x - y\|^2 = x^Tx - 2 x^T y + y^T y$ and $g(x) = x^T Q x - 1$, where
$$Q = \begin{pmatrix} 1 & 0 & 0\\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix}$$
Then $\nabla f(x) = 2x - 2y$ and $\nabla g(x) = 2Qx$. Notice that both $f$ and $g$ are strictly convex. This means that the solution to the problem can be found by solving the system of equations
$$\begin{cases} \lambda_0 \nabla f(x) + \lambda_1 \nabla g(x) = 0 \\ \lambda_1 g(x) = 0 \end{cases} = \begin{cases} \lambda_0 x - \lambda_0 y + \lambda_1 Qx = 0 \\ \lambda_1 x^T Q x = \lambda_1 \end{cases}$$
with $\lambda_1, \lambda_2 \in \mathbb{R}_+$. I cannot get past this point. I feel like I got really close when I found that this can be written as
$$\begin{cases} x = \left(I + \frac{\lambda_1}{\lambda_0}Q\right)^{-1} y \\ x^T (y - x) = \frac{\lambda_1}{\lambda_0}\end{cases}$$
After this point though I just go in circles.
The KKT conditions are $$\begin{cases} x - y + \lambda Qx = 0 \\ \lambda( x^T Q x-1) = 0 \\ x^T Q x\leq1 \\ \lambda \geq 0 \end{cases}$$ If $\lambda=0$, you get $x=y$, which is feasible only if $y^TQy \leq 1$. Therefore, $x=y$ is optimal if $y^TQy \leq 1$.
If $y^TQy > 1$, $\lambda \neq 0$, so $x^T Qx = 1$. You already mentioned $x = (I+\lambda Q)^{-1}y$, so $x_i = y_i / (1+\lambda i)$, so $x^T Qx = \sum_i i y_i^2 / (1+\lambda i)^2 = 1$, which you can solve for $\lambda$ (taking the solution with $\lambda>0$).