TITLE: Geodesic distance from point to manifold
QUESTION [11 upvotes]: This is question 1 of chapter 9 from Manfredo do Carmo's Riemmanian Geometry.
$M$ is a complete Riemmanian manifold and $N\subset M$ a closed submanifold. $p_0\in M$ and $p_0\notin N$. Let $d(p_0,N)$ denote the distante of $p_0$ to $N$. Show that there exists some $q_0\in N$ such that $d(p_0,q_0)=d(p_0,N)$ and the minimizing geodesic connecting $p_0$ and $q_0$ is orthogonal to $N$ in $q_0$.
I solved the first part of the problem. How can I prove the orthogonality property?

REPLY [7 votes]: I think i have a answer too. Please verify if it is correct.
Let $\gamma: [0,a]\rightarrow M$ be the geodesic joining the points $p_0$ and $q_0$. Let $v\in T_{q_0}N$ and $\phi: (-\epsilon,\epsilon)\rightarrow N$ be a differentiable curve such that $\phi(0)=q_0$ and $\phi'(0)=v$ (note that the image of $\phi$ is contained in N). 
Consider a variation $f:(-\epsilon,\epsilon)\times [0,a]\rightarrow M$ such that $f(s,0)=p_0$ and $f(s,a)=\phi(s)$. Let $E$ be the energy associated with $f$. By the first variation of energy formula, we have that $$\frac{E'(0)}{2}=\langle v,\gamma'(a)\rangle$$
Now, because $\phi$ is contained in $N$, we can conclude that $E'(0)=0$. This is true because $\gamma$ is the curve that minimizes the distance between $p_0$ and $N$ which implies that the curves $f(s,t)$ for fixed $s$ have more energy/length than $\gamma$.