How to derive the Euler Lagrange equation for geodesics? In my book, it says a geodesic is associated to the functional $\int_0^l |\gamma'|^2$ , with a metric g.
It then jumps to  $\ddot{\gamma}^k + \Gamma^k_{ij}\dot{\gamma}^i\dot{\gamma}^j = 0$ where $\Gamma^k_{ij} := \frac{1}{2}g^{kl}\left( \frac{\partial g_{jl}}{\partial x^i} + \frac{\partial g_{il}}{\partial x^j} - \frac{\partial g_{ij}}{\partial x^l}\right).$
I'm trying to find out how it gets there.
My functional is $L(t, \gamma, \dot \gamma) = g_{ij}(\gamma(t)) \dot\gamma ^i \dot\gamma ^j$
From wikipedia Euler-Lagrange, $\frac{\partial L}{\partial \gamma ^k}  - \frac{d}{dt} \frac{\partial L}{\partial \dot \gamma ^k} = 0$
but this only leads me to $\partial_k g_{ij} \gamma' ^i \gamma' ^j -  \frac{d}{dt} (g_{kj} \sum_j \gamma '^j + g_{kk}\gamma '^k)=0 $
There are lots of more developments to if I derive this last thing with regard to t (since $g$ is $g(\gamma(t))$). Am I on the right direction or is there something I'm missing?
 A: Let $(M, g=g_{ij}dx^idx^j)$ be a Riemannian manifold. In particular, this implies that $(g_{ij})$ is a symmetric matrix. We consider as the functional the kinetic energy
\begin{equation*}
   \begin{split}
       K:\mathbf{T}M &\rightarrow\mathbb{R} \\
       (x,\dot{x}) & \mapsto K(x,\dot{x}) =\frac{1}{2}g_{ij}(x)\dot{x}^i\dot{x}^j
   \end{split} 
\end{equation*}
and we want to compute its extremal curves. To do so, $K$ must satisfy Euler-Lagrange equations at this curves:
\begin{equation*}
    \frac{\partial K}{\partial x^k}-\frac{d}{dt}\frac{\partial K}{\partial \dot{x}^k}=0,
\end{equation*}
for $k=1,\ldots,n$ and where $x^i=x^i(t)$ y $\dot{x}^i=\dot{x}^i(t)$. It is easy to show that (just see the case $k=1$ to understand it)
\begin{equation*}
    \frac{\partial K}{\partial \dot{x}^k}=g_{ik}\dot{x}^i.
\end{equation*}
On the other hand
\begin{equation*}
    \frac{d}{dt}\frac{\partial K}{\partial \dot{x}^k}=\frac{\partial g_{ik}}{\partial x^j}\dot{x}^i\dot{x}^j+g_{ik}\ddot{x}^i.
\end{equation*}
By convinience, we can express the first term of the right-hand side as 
\begin{equation*}
    \frac{\partial g_{ik}}{\partial x^j}\dot{x}^i\dot{x}^j=\frac{1}{2}\frac{\partial g_{ik}}{\partial x^j}\dot{x}^i\dot{x}^j+\frac{1}{2}\frac{\partial g_{ik}}{\partial x^j}\dot{x}^i\dot{x}^j=\frac{1}{2}\frac{\partial g_{ik}}{\partial x^j}\dot{x}^i\dot{x}^j+\frac{1}{2}\frac{\partial g_{jk}}{\partial x^i}\dot{x}^i\dot{x}^j,
\end{equation*}
where we have interchanged the indexes $i$ and $j$ in the last term. Finally, the first term of the Euler-Lagrange equation is 
\begin{equation*}
    \frac{\partial K}{\partial x^k}=\frac{1}{2}\frac{\partial g_{ij}}{\partial x^k}\dot{x}^i\dot{x}^j.
\end{equation*}
Thus, Euler-Lagrange equations are
\begin{equation*}
    g_{ik}\ddot{x}^i+\frac{1}{2}\left(\frac{\partial g_{ik}}{\partial x^j}+\frac{\partial g_{jk}}{\partial x^i}-\frac{\partial g_{ij}}{\partial x^k}\right)\dot{x}^i\dot{x}^j=0,\quad k=1,\ldots,n.
\end{equation*}
The coefficients in $\dot{x}^i\dot{x}^j$ are denoted as 
\begin{equation*}
    \Gamma_{kij}=\frac{1}{2}\left(\frac{\partial g_{ik}}{\partial x^j}+\frac{\partial g_{jk}}{\partial x^i}-\frac{\partial g_{ij}}{\partial x^k}\right).
\end{equation*}
With this notation, Euler-Lagrange equations can be written as
\begin{equation}
\label{3_eq_EEL_K_1especie}
    g_{ik}\ddot{x}^i+\Gamma_{kij}\dot{x}^i\dot{x}^j=0,\quad k=1,\ldots,n
\end{equation}
or in a matrix form as
\begin{equation*}
    (g_{ij})\begin{pmatrix}
    \ddot{x}^1\\
    \vdots\\
    \ddot{x}^n
    \end{pmatrix}=-\begin{pmatrix}
    \Gamma_{1ij}\dot{x}^i\dot{x}^j\\
    \vdots\\
    \Gamma_{nij}\dot{x}^i\dot{x}^j
    \end{pmatrix}.
\end{equation*}
Now, if we define 
\begin{equation*}
    (g^{hk})=(g_{ij})^{-1},\quad\Gamma_{ij}^k=g^{kh}\Gamma_{hij},
\end{equation*}
we get
\begin{equation*}
    \begin{pmatrix}
    \ddot{x}^1\\
    \vdots\\
    \ddot{x}^n
    \end{pmatrix}=-(g^{hk})\begin{pmatrix}
    \Gamma_{1ij}\dot{x}^i\dot{x}^j\\
    \vdots\\
    \Gamma_{nij}\dot{x}^i\dot{x}^j
    \end{pmatrix}=-\begin{pmatrix}
    \Gamma_{ij}^1\dot{x}^i\dot{x}^j\\
    \vdots\\
    \Gamma_{ij}^n\dot{x}^i\dot{x}^j
    \end{pmatrix}
\end{equation*}
or 
\begin{equation}
    \label{3_eq_EEL_K_2especie}
    \ddot{x}^k+\Gamma_{ij}^k\dot{x}^i\dot{x}^j=0,\quad k=1,\ldots,n.
\end{equation}
