# Simplify calculation of geodesics from action principle

I don't understand a step with the calculation of geodesics equations from action principle on this link :

demo geodesics equations

My issue is the following step :

$$\int \bigg(\dfrac{dx^{\mu}}{d\tau}\dfrac{dx^{\nu}}{d\tau}\partial_{\alpha}g_{\mu\nu}\delta x^{\alpha}+2 g_{\mu\nu}\dfrac{d\delta x^{\mu}}{d\tau}\dfrac{d x^{\nu}}{d\tau}\bigg)d\tau=0$$

Then, it says that : "Integrating by-parts the last term and dropping the total derivative (which equals to zero at the boundaries) we get that:"

$$\int d\tau \bigg(\dfrac{dx^{\mu}}{d\tau}\dfrac{dx^{\nu}}{d\tau}\partial_{\alpha}g_{\mu\nu}\delta x^{\alpha}-2\delta x^{\mu}\dfrac{d}{d\tau}\bigg( g_{\mu\nu}\dfrac{d x^{\nu}}{d\tau}\bigg)\bigg)=0$$

But I can't get the expression of the second term (I can't see how to do integration by-parts).

Anyone could give more details about the transition between these two equations above ?

Just rearrange and use the middle factor as the starting derivative: $$\int{\left(2g_{\mu\nu}\frac{dx_\nu}{d\tau}\right)\frac{d\delta x_\mu}{d\tau}d\tau} = \int{\left[ \frac{d}{d\tau}\left(2g_{\mu\nu}\frac{dx_\nu}{d\tau}\delta x_\mu\right) - \delta x_\mu \frac{d}{d\tau}\left( 2g_{\mu\nu}\frac{dx_\nu}{d\tau}\right)\right]d\tau} = \\ = - \int{2\delta x_\mu \frac{d}{d\tau}\left( g_{\mu\nu}\frac{dx_\nu}{d\tau}\right)d\tau}$$ where the total derivative term vanishes for $\delta x_\mu = 0$ on the boundary.