Why is the geodesic with the shortest length to the boundary perpendicular to the boundary, i.e.
Let $M$ be a Riemannian manifold with boundary $\partial M$, $x\in M$. Let $p\in\partial M$ such that ${\rm d}(x,p)={\rm d}(x,\partial M)$. Let $\gamma:[0,l]\to M$ be a shortest geodesic joining $x$ to $p$. Then $\gamma'(l)~\bot~T_p(\partial M)$.
I'm sure that this result comes from the first variation formula because I encountered this question while reading a paper and the paper states "by the first variation formula, we have $\gamma'(l)~\bot~T_p(\partial M)$". But so far I haven't come up with a rigorous and complete proof. Here is my attempt:
Let $\alpha:[0,l]\times(-\varepsilon,\varepsilon)\to M$ be a smooth variation of $\gamma$ with fixed endpoints. Set $\displaystyle V(t,s)=\frac{\partial\alpha}{\partial s}$, $\displaystyle T(t,s)=\frac{\partial\alpha}{\partial t}$. By the first variation formula, we have: $$\frac{d}{ds}\bigg|_{s=0} {\rm length}(\gamma_s) = -\int_0^l\left\langle V(t,0),\nabla_T\frac{T}{||T||}\right\rangle dt,$$ where $\gamma_s(t)$ is the variation of $\gamma$ with parameter $s$ and $t$.
Since $\gamma$ is a shortest geodesic, the length of $\gamma_s$ is minimized at $s=0$. Therefore, the derivative of the length with respect to $s$ is zero at $s=0$. This gives us: $$\int_0^l\left\langle V(t,0),\nabla_T\frac{T}{||T||}\right\rangle dt = 0.$$
How to resolve it next? Any help would be appreciated!