Solution (source code)

= Solution

The set $C$ is the <second-order cone>. Put
$$
\rho=\|u\|_2,
\qquad
\alpha=\frac12\left(1+\frac t\rho\right).
$$
When $\rho\geq|t|$ and $\rho>0$, one has $0\leq\alpha\leq1$, and the proposed point
$$
\pi=\alpha(u,\rho)
$$
lies on the boundary of $C$ because $\|\alpha u\|_2=\alpha\rho$.

Set $\delta=(\rho-t)/2\geq0$. Since
$$
(u,t)-\pi=\delta\left(\frac u\rho,-1\right),
$$
for any $(v,s)\in C$ we obtain
$$
\begin{aligned}
\bigl((u,t)-\pi\bigr)^T\bigl((v,s)-\pi\bigr)
&=\delta\left(\frac{u^Tv}{\rho}-s\right)\\
&\leq\delta(\|v\|_2-s)\\
&\leq0,
\end{aligned}
$$
where the first inequality is the <Cauchy-Schwarz inequality> and the second uses $\|v\|_2\leq s$. Part (d) therefore gives
$$
\boxed{
\pi_C(u,t)
=\frac12\left(1+\frac t{\|u\|_2}\right)
\bigl(u,\|u\|_2\bigr)
}
$$
whenever $\|u\|_2\geq|t|$ and $u\ne0$. At $(u,t)=(0,0)$ the projection is plainly $(0,0)$, consistent with the limiting formula.

If $\rho\leq-t$, then for every $(v,s)\in C$,
$$
(u,t)^T(v,s)
\leq\rho\|v\|_2+ts
\leq(\rho+t)s
\leq0.
$$
Applying part (d) with $\pi=0$ gives
$$
\boxed{\pi_C(u,t)=(0,0)}.
$$
Together with the trivial case $\rho\leq t$, this is the full <projection onto the second-order cone>.