Scalar field lagrangian in curved spacetime I am studying inflation theory for a scalar field $\phi$ in curved spacetime. I want to obtain Euler-Lagrange equations for the action:
$$ I\left[\phi\right] = \int \left[\frac{1}{2}g^{\mu\nu}\partial_\mu\phi\partial_\nu\phi + V\left(\phi\right) \right]\sqrt{-g} d^4x $$
Euler-Lagrange equations for a scalar field is given by
$$\partial_\mu \frac{\partial L}{\partial\left(\partial_\mu\phi\right)} - \frac{\partial L}{\partial \phi} = 0 $$
$$\partial_\mu \frac{\partial L}{\partial\left(\partial_\mu\phi\right)} = \frac{1}{2}\partial_\mu\left(\sqrt{-g}g^{\mu\nu}\partial_\nu\phi \right) $$ 
$$ \frac{\partial L}{\partial \phi} = \frac{\partial \left[\sqrt{-g}V\left(\phi\right)\right]}{\partial \phi} $$
But according to the book the resulting equation is
$$ \frac{1}{\sqrt{-g}}\partial_\mu\left(\sqrt{-g}g^{\mu\nu}\partial_\nu\phi\right) = \frac{\partial V\left(\phi\right)}{\partial \phi} $$
What am I doing wrong?
 A: The correct Euler-Lagrangian equation for scalar in curved spacetime is
$$
\frac{\partial\mathcal{L}}{\partial\phi}=\frac{1}{\sqrt{-g}}\partial_{\mu}\left[\sqrt{-g}\frac{\partial\mathcal{L}}{\partial\left(\partial_{\mu}\phi\right)}\right],
$$
where the Lagrangian density should be 
$$
\mathcal{L}=\frac{1}{2}g^{\mu\nu}\partial_{\mu}\phi\partial_{\nu}\phi-V\left(\phi\right)
$$
and it doesn't contain the $\sqrt{-g}$ factor. Note this is the same as
$$
\frac{\partial\mathcal{L}}{\partial\phi}=\nabla_{\mu}\left[\frac{\partial\mathcal{L}}{\partial\left(\partial_{\mu}\phi\right)}\right],
$$
in terms of covariant derivative, $\nabla_{\mu}$.
The right-hand side is 
$$
\nabla_{\mu}\left[\frac{\partial\mathcal{L}}{\partial\left(\partial_{\mu}\phi\right)}\right]
= \nabla_{\mu}\left(g^{\mu\nu}\partial_{\nu}\phi\right)
= g^{\mu\nu}\nabla_{\mu}\left(\partial_{\nu}\phi\right)
\equiv \Box\phi,
$$
where the second equality is true because the covariant derivative, $\nabla_{\mu}$, commutes with the metric tensor, $g^{\mu\nu}$. The left-hand side is 
$$
\frac{\partial\mathcal{L}}{\partial\phi}=-\frac{\partial V\left(\phi\right)}{\partial\phi}.
$$
So the equation of motion for a scalar field $\phi$ in curved spacetime is
$$
\Box\phi=-\frac{\partial V\left(\phi\right)}{\partial\phi}.
$$
