A derivation of Euler–Lagrange equations with a general metric $g_{\mu \nu}(x)$ is a metric of a space and $X^{\mu}(\lambda)$ a curve with $\lambda$ a parameter that varies monotonically along the curve:
$$0 = \delta \int d\lambda L = \int d\lambda \delta L = \\ \int d\lambda (\sqrt{g_{\mu \nu}(X(\lambda) + \delta X(\lambda)) \frac{d(X^{\mu} + \delta X^{\mu})}{d\lambda} \frac{d(X^{\nu} + \delta X^{\nu})}{d\lambda}} - \sqrt{g_{\mu \nu}(X(\lambda)) \frac{dX^{\mu}}{d\lambda} \frac{dX^{\nu}}{d\lambda}}) = \\ \int d\lambda \frac{1}{L} (2 g_{\mu \nu}(X(\lambda)) \frac{dX^{\mu}}{d\lambda} \frac{d \delta X^{\nu}}{d\lambda} + \partial_{\sigma} g_{\mu \nu}(X(\lambda)) \frac{dX^{\mu}}{d \lambda} \frac{dX^{\nu}}{d\lambda} \delta X^{\sigma})$$
I don't understand the last equality. (How to derive the 3rd line from the 2nd line)
Any help would be appreciated.
 A: I sketch a proof. We introduce
$$f(X(\lambda)):=g_{\mu\nu}(X(\lambda))\frac{dX^\mu}{d\lambda}\frac{dX^\nu}{d\lambda} $$
and  $\delta X^\mu(\lambda):=\epsilon \varphi^\mu(\lambda)$, where $\epsilon >0$. Then
$$f(X(\lambda)+\epsilon\varphi(\lambda))-f(X(\lambda))=\frac{f^2(X(\lambda)+\epsilon\varphi^\mu(\lambda))-f^2(X(\lambda))}{f(X(\lambda)+\epsilon\varphi(\lambda))+f(X(\lambda))}, $$
where we suppose $f(X(\lambda)+\epsilon\varphi^\mu(\lambda))+f(X(\lambda))\neq 0$.
Then (if $f(X(\lambda)+\epsilon\varphi(\lambda))>0$ and $f(X(\lambda))>0$)
$$f(X(\lambda)+\epsilon\varphi(\lambda))-f(X(\lambda))=\frac{g_{\mu\nu}(X(\lambda)+\epsilon\varphi(\lambda))\frac{dX^\mu+\epsilon\varphi(\lambda)}{d\lambda}\frac{dX^\nu+\epsilon\varphi(\lambda)}{d\lambda}-g_{\mu\nu}(X(\lambda))\frac{dX^\mu}{d\lambda}\frac{dX^\nu}{d\lambda}}{\sqrt{g_{\mu\nu}(X(\lambda)+\epsilon\varphi(\lambda))\frac{dX^\mu}{d\lambda}\frac{dX^\nu}{d\lambda}+O(\epsilon)}+\sqrt{g_{\mu\nu}(X(\lambda))\frac{dX^\mu}{d\lambda}\frac{dX^\nu}{d\lambda}}}; $$
we need to group the terms in the numerator. Let us do it. We suppose that $g$ is differentiable, i.e.
$$g_{\mu\nu}(X(\lambda)+\epsilon\varphi(\lambda))-g_{\mu\nu}(X(\lambda)) = \epsilon\langle  \nabla g_{\mu\nu}(X(\lambda)), \varphi(\lambda)\rangle + O(\epsilon^2),$$
or
$$g_{\mu\nu}(X(\lambda)+\epsilon\varphi(\lambda))-g_{\mu\nu}(X(\lambda)) = \epsilon  \partial_\sigma g_{\mu\nu}(X(\lambda))\varphi^\sigma(\lambda) + O(\epsilon^2).$$
Then, formally:
$$0=\delta S:=\lim_{\epsilon\rightarrow 0}\frac{1}{\epsilon}\int d\lambda
f(X(\lambda)+\epsilon\varphi(\lambda))-f(X(\lambda))= \lim_{\epsilon\rightarrow 0} \int d\lambda
\frac{ g_{\mu\nu}(X(\lambda))\frac{dX^\mu}{d\lambda}\frac{d\varphi^\nu}{d\lambda}+
g_{\mu\nu}(X(\lambda))\frac{dX^\nu}{d\lambda}\frac{d\varphi^\mu}{d\lambda}+
 \partial_\sigma g_{\mu\nu}(X(\lambda))\varphi^\sigma(\lambda)
\frac{dX^\mu}{d\lambda}\frac{dX^\nu}{d\lambda} + O(\epsilon) }{
\sqrt{g_{\mu\nu}(X(\lambda))\frac{dX^\mu}{d\lambda}\frac{dX^\nu}{d\lambda}+O(\epsilon)}+\sqrt{g_{\mu\nu}(X(\lambda))\frac{dX^\mu}{d\lambda}\frac{dX^\nu}{d\lambda}}}=
\int d\lambda
\frac{ 2g_{\mu\nu}(X(\lambda))\frac{dX^\mu}{d\lambda}\frac{d\varphi^\nu}{d\lambda}+
\partial_\sigma g_{\mu\nu}(X(\lambda))\varphi^\sigma(\lambda)
\frac{dX^\mu}{d\lambda}\frac{dX^\nu}{d\lambda} }{2f(X(\lambda))}.$$
A: I think that it basically goes like this:
$$I = g_{\mu \nu}(X(\lambda) + \delta X(\lambda)) \frac{d(X^{\mu} + \delta X^{\mu})}{d\lambda} \frac{d(X^{\nu} + \delta X^{\nu})}{d\lambda} = \\g_{\mu \nu}(X(\lambda)) \frac{d(X^{\mu})}{d\lambda} \frac{d(X^{\nu})}{d\lambda}+\\   4 g_{\mu \nu}(X(\lambda)) \frac{dX^{\mu}}{d\lambda} \frac{d \delta X^{\nu}}{d\lambda} + 2\partial_{\sigma} g_{\mu \nu}(X(\lambda)) \frac{dX^{\mu}}{d \lambda} \frac{dX^{\nu}}{d\lambda} \delta X^{\sigma} \tag{1}$$
Which can be symbolically rewritten as:
$$\delta_1=\frac{d \delta X^{\nu}}{d\lambda}, \delta_2=\delta X^{\sigma} $$
$$I=A+4B\delta_1+2C \delta_2\tag{2}$$
Now we can do Taylor expansion for $\sqrt{I}$ as:
$$\sqrt{I}=\sqrt{A}+2(B/A)\delta_1+(C/A) \delta_2\tag{3}$$
