Solution (source code)

= Solution

Let $\overline\nabla f$ and $\overline{\operatorname{Hess}}f$ be the ambient gradient and Hessian. The <Laplacian of a restricted ambient function> is
$$
\Delta_M(f|_M)
=\operatorname{tr}_{TM}(\overline{\operatorname{Hess}}f)
+\langle\overline\nabla f,\mathbf H\rangle.
$$
To prove it, choose a local orthonormal tangent frame $e_1,\ldots,e_n$ with $\nabla^M_{e_i}e_j=0$ at the point under consideration. There,
$$
\begin{aligned}
\Delta_M(f|_M)
&=\sum_i e_i(e_i f)\\
&=\sum_i\left(\overline{\operatorname{Hess}}f(e_i,e_i)
+\langle\overline\nabla f,\overline\nabla_{e_i}e_i\rangle\right)\\
&=\sum_i\overline{\operatorname{Hess}}f(e_i,e_i)
+\left\langle\overline\nabla f,\sum_iA(e_i,e_i)\right\rangle.
\end{aligned}
$$
Both sides are intrinsic scalars, so the pointwise calculation proves the formula everywhere.