note:rg7fe5w5

Let $(M,g)$ be a manifold $M$ with pseudo-Riemannian metric $g$ and equipped with a connection $\nabla$ such that $\nabla g=0$, i.e. $\nabla$ is Levi-Civita. Let $p,q\in M$ and consider a smooth one-parameter family of timeline curves $\psi_\alpha(t)$ from $p$ to $q$, where the curve parameter $t$ is chosen so that for all $\alpha$ we have $\psi_\alpha(a)=p$, $\psi_\alpha(b)=q$. We denote the tangent vectors $\partial/\partial t$ by $T$ and the deviation vectors, $\partial/\partial \alpha$, by $X$. Then $X$ vanishes at both $p$ and $q$.

Recall the definition of the torsion of a connection:
$$T(X,Y)=\nabla_X Y-\nabla_Y X-[X,Y]$$
For a Levi-Civita connection this implies
$$\nabla_X Y-\nabla_Y X=[X,Y]$$
Inserting the tangent and deviation vectors from above, we get
$$\nabla_TX-\nabla_XT=[T,X]=0$$
where the second equality follows from both vectors being partial derivatives. Thus $\nabla_TX=\nabla_XT$ everywhere.

The length of each curve is given by
$$\tau(\alpha)=\int_a^b f(\alpha,t)\,dt$$
where $f=\sqrt{-\langle T,T\rangle}$. We shall now show that the necessary and sufficient condition for the curve $\gamma=\psi_0$ to extremize $\tau$ is for $\gamma$ to satisfy the geodesic equation. We simply perform the first derivative test:
\begin{align*}
\frac{d \tau}{d\alpha}&=\int_a^b\frac{\partial f}{\partial \alpha}\,dt=\int_a^b\nabla_X\sqrt{-\langle T,T\rangle}\,dt=-\frac{1}{2}\int_a^b\frac{1}{f}\nabla_X\langle T,T\rangle\,dt\\
&=-\int_a^b\frac{1}{f}\langle\nabla_XT,T\rangle\,dt=-\int_a^b\frac{1}{f}\langle\nabla_TX,T\rangle\,dt\\
&=-\int_a^b\nabla_T\left[\frac{1}{f}\langle T,X\rangle\right]\,dt+\int_a^b\langle X,\nabla_T(T/f)\rangle\,dt\\
&=\int_a^b\langle X,\nabla_T(T/f)\rangle\,dt
\end{align*}
since $\nabla_T(f^{-1}\langle T,X\rangle)=\partial(f^{-1}\langle T,X\rangle)/\partial t$ and $X=0$ at the endpoints. Thus, setting $\alpha=0$ we see that $d\tau/d\alpha=0$ for arbitrary $X$ if and only if $\nabla_T(T/f)=0$ at $\alpha=0$, which is just the geodesic equation for an arbitrary parameterization. Choosing an appropriate affine parameter $\ell$, we arrive the geodesic equation
$$\nabla_{\dot\gamma}\dot\gamma=0$$
where $\dot\gamma=\partial/\partial \ell$ since for an affine parameterization we have $\langle\dot\gamma,\dot\gamma\rangle=-f^2=\text{const}$.