[step:Compute the first variation of the Dirichlet energy]Let $F:(-\varepsilon,\varepsilon)\times M\to N$ be a smooth variation of $u$, meaning $F(0,x)=u(x)$ for every $x\in M$. For each $t\in(-\varepsilon,\varepsilon)$, define the smooth map $u_t:M\to N$ by
\begin{align*}
u_t(x)=F(t,x).
\end{align*}
Define the variation field $V\in \Gamma(u^{-1}TN)$ by
\begin{align*}
V(x):=\left.\frac{\partial F}{\partial t}\right|_{(0,x)}\in T_{u(x)}N.
\end{align*}
We claim that
\begin{align*}
\left.\frac{d}{dt}\right|_{t=0} E(u_t)
=
-\int_M h_{u(x)}(\tau(u)(x),V(x))\,d\operatorname{vol}_g(x).
\end{align*}
Let $m=\dim M$. Since the identity is local on $M$, fix an [open set](/page/Open%20Set) $U\subset M$ and a smooth local $g$-orthonormal frame $e_1,\dots,e_m\in \Gamma(TU)$. On $U$, the energy density is
\begin{align*}
|du_t|_{g,h}^2=\sum_{i=1}^m h_{u_t(x)}(du_t(e_i),du_t(e_i)).
\end{align*}
Using the metric compatibility of the Levi-Civita connection of $h$, differentiating under the integral sign, and evaluating at $t=0$, we obtain
\begin{align*}
\left.\frac{d}{dt}\right|_{t=0}E(u_t)
&=
\int_M \sum_{i=1}^m h_{u(x)}\left(\nabla^N_{\partial_t}du_t(e_i)\big|_{t=0},du(e_i)\right)\,d\operatorname{vol}_g(x).
\end{align*}
The coordinate vector fields $\partial_t$ and $e_i$ commute on $(-\varepsilon,\varepsilon)\times U$, and the Levi-Civita connection of $h$ is torsion-free. Therefore
\begin{align*}
\nabla^N_{\partial_t}du_t(e_i)\big|_{t=0}
=
\nabla^{u^{-1}TN}_{e_i}V.
\end{align*}
Thus
\begin{align*}
\left.\frac{d}{dt}\right|_{t=0}E(u_t)
&=
\int_M \sum_{i=1}^m h_{u(x)}\left(\nabla^{u^{-1}TN}_{e_i}V,du(e_i)\right)\,d\operatorname{vol}_g(x).
\end{align*}
Define the smooth vector field $X\in \Gamma(TM)$ locally by
\begin{align*}
X:=\sum_{i=1}^m h_{u(x)}(V,du(e_i))\,e_i.
\end{align*}
At a chosen point of $U$, take the frame $e_1,\dots,e_m$ to be normal for $g$ at that point. Then $\nabla^M_{e_i}e_i=0$ at that point, and the divergence of $X$ at that point is
\begin{align*}
\operatorname{div}_g X
=
\sum_{i=1}^m e_i\left(h_{u(x)}(V,du(e_i))\right).
\end{align*}
By metric compatibility of the pullback connection,
\begin{align*}
\operatorname{div}_g X
=
\sum_{i=1}^m h_{u(x)}\left(\nabla^{u^{-1}TN}_{e_i}V,du(e_i)\right)
+
h_{u(x)}\left(V,\sum_{i=1}^m \nabla^{u^{-1}TN}_{e_i}du(e_i)\right)
\end{align*}
at that point. Since the frame is normal there, the second sum is exactly $h_{u(x)}(V,\tau(u))$ at that point. Because the point was arbitrary, the coordinate-invariant identity is
\begin{align*}
\sum_{i=1}^m h_{u(x)}\left(\nabla^{u^{-1}TN}_{e_i}V,du(e_i)\right)
=
\operatorname{div}_g X
-
h_{u(x)}(V,\tau(u)).
\end{align*}
Integrating this identity over $M$ with respect to $\operatorname{vol}_g$ gives
\begin{align*}
\left.\frac{d}{dt}\right|_{t=0}E(u_t)
&=
\int_M \operatorname{div}_g X\,d\operatorname{vol}_g(x)
-
\int_M h_{u(x)}(V,\tau(u))\,d\operatorname{vol}_g(x).
\end{align*}
Since $M$ is compact and has no boundary, the divergence term integrates to zero. Therefore
\begin{align*}
\left.\frac{d}{dt}\right|_{t=0}E(u_t)
=
-\int_M h_{u(x)}(\tau(u)(x),V(x))\,d\operatorname{vol}_g(x).
\end{align*}[/step]