# Deriving the Geodesic Equation using Euler-Lagrange

I have recently been reading up on GR and I'm currently deriving the Geodesic Equation using the principle of least action.

When solving the Euler-Lagrange equation for $$L=\frac{m}{2}g_{ij}(x)\dot{x}^i\dot{x}^j$$i'm happy with step $$\frac{\partial L}{\partial \dot{x}^i}=mg_{ik}\dot{x}^k$$ What I don't understand is when we take the derivative w.r.t time. $$\frac{d}{dt}\left(\frac{\partial L}{\partial \dot{x}^i}\right)=m\frac{\partial g_{ik}}{\partial{x_j}}\dot{x}^j\dot{x}^k+mg_{ik}\ddot{x}^k$$

Where does this first term come from? I understand that the metric is dependent on $$x$$ and so by extension $$t$$, but why is the derivative w.r.t $$x^j$$ and where does $$\dot{x}^j$$ come from?

(Sorry for any formatting mistakes, I wrote this on mobile.)

This is just the multivariable chain rule. It might be easier to see if you ignore the indices on $$g_{ik}$$ and just write it as $$f$$: $$\frac{\text{d} f}{\text{d} t} = \frac{\partial f}{\partial x^j} \frac{\text{d}x^j}{\text{d}t}$$