Inconsistency in variation of the metric tensor in an action While doing some exercises on the variation of the metric tensor $g_{\mu\nu}$ and of its inverse $g^{\mu\nu}$, I came across the following identity:
$$\begin{align} & \delta(g_{\mu\nu}g^{\mu\nu})=\delta g_{\mu\nu} g^{\mu\nu} + g_{\mu\nu}\delta g^{\mu\nu} \overset{!}{=} 0 \\ \iff & \delta g_{\mu\nu} g^{\mu\nu} = - g_{\mu\nu}\delta g^{\mu\nu} \tag{1} \end{align}$$
This has the following consequence for the variation of the square root of the determinant of the metric:
$$\begin{align}\delta\sqrt{-g} &= \frac{1}{2} \sqrt{-g} g^{\mu\nu} \delta g_{\mu\nu} \tag{2} \\ & \overset{!}{=} - \frac{1}{2} \sqrt{-g} g_{\mu\nu} \delta g^{\mu\nu}. \tag{3}\end{align}$$
Then say I have a non-linear action, which I want to expand around $\eta_{\mu\nu}$ (with $g_{\mu\nu} = \eta_{\mu\nu} + h_{\mu\nu}(x)$). I observe a contradiction which I couldn't resolve so far, and I would be very thankful if somebody could indicate me where I am (probably) making a mistake.
Let's take the following term:
$$S = \partial_\mu g^{\mu\nu} \partial_\nu \sqrt{-g}. \tag{4}$$
I can expand using $(2)$, and I get:
$$\begin{align} \partial_\mu g^{\mu\nu} \partial_\nu \sqrt{-g} &= \partial_\mu g^{\mu\nu} \frac{1}{2} \sqrt{-g} g^{\alpha\beta} \partial_\nu g_{\alpha\beta} \\ &= \frac{1}{2} \partial_\mu h^{\mu\nu} \eta^{\alpha\beta} \partial_\nu h_{\alpha\beta} + \mathcal{O}(h^3) \\ & = \frac{1}{2} \partial_\mu h^{\mu\nu} \partial_\nu h  + \mathcal{O}(h^3) \end{align}$$
where I defined $h=\eta^{\alpha\beta} h_{\alpha\beta}$. Now doing the same using $(3)$, I get:
$$\begin{align} \partial_\mu g^{\mu\nu} \partial_\nu \sqrt{-g} & =  \partial_\mu g^{\mu\nu} \left( -\frac{1}{2} \right) \sqrt{-g} g_{\alpha\beta} \partial_\nu g^{\alpha\beta} \\ &= -\frac{1}{2} \partial_\mu h^{\mu\nu} \eta_{\alpha\beta} \partial_\nu h^{\alpha\beta} + \mathcal{O}(h^3) \\  &= -\frac{1}{2} \partial_\mu h^{\mu\nu} \partial_\nu h  + \mathcal{O}(h^3) \end{align}$$
So I get the same result with an extra minus sign. Which one is right, and why?
Thank you very much in advance!
 A: I know you basically said this, but here is the answer. If you have a metric which is a sum of a background metric and a small perturbation,
$$
g_{\mu \nu} = \overline{g}_{\mu \nu} + h_{\mu \nu}
$$
then the inverse metric is
$$
g^{\mu \nu} = \overline{g}^{\mu \nu} - h^{\mu \nu}
$$
which can be confirmed by checking $g_{\mu \nu} g^{\nu \rho} = \delta_\mu^\rho$ to the first order in $h$. Note that $h_{\mu \nu}$ is a regular tensor which is raised and lowered using $g_{\mu \nu}$, which, to the first order in $h$, is the same as raising and lowering it using $\overline{g}_{\mu \nu}$. No funny business or stray signs in raising and lowering $h_{\mu \nu}$. Just a plain old regular tensor.
The funny business is all contained in
\begin{align*}
\delta g_{\mu \nu} &= h_{\mu \nu} \\
\delta g^{\mu \nu} &= - h^{\mu \nu}.
\end{align*}
which is apparent from the first two equations.
(You said this of course but I thought I would take a stab at putting it in my own words.)
A: So here is what I gathered from other posts such as the one that @Qmechanic posted in the comments. In my expansion, one must not only consider $\delta \sqrt{-g}$ but also $\delta g^{\mu\nu}$ for the derivatives. The variation $\delta g^{\mu\nu}$ can be determined as follows (using (1) in OP):
$$\begin{align} \delta g^{\mu\nu} g_{\mu\nu} & = - g^{\mu\nu} \delta g_{\mu\nu} \\ & = - g^{\mu\nu} \delta h_{\mu\nu} \\ & = -g^{\mu\nu} \delta h^{\alpha\beta} g_{\alpha\mu} g_{\beta\nu} \\ &= - g^{\beta\nu} \delta h^{\alpha\mu}g_{\alpha\beta} g_{\mu\nu} \\ & = -\delta h^{\mu\nu} g_{\mu\nu} \end{align}$$
$$\iff \delta g^{\mu\nu} = - \delta h^{\mu\nu} \tag{*}$$
In the step going from the 3rd to the 4th line, I have renamed the contracted indices so that I could have a $g_{\mu\nu}$ like in the LHS. (*) means that the derivatives behave this way:
$$\partial_\mu g_{\alpha\beta} = \frac{\delta g_{\alpha\beta}}{\delta x^\mu} = \frac{\delta h_{\alpha\beta}}{\delta x^\mu} = \partial_\mu h_{\alpha\beta} \tag{**}$$
$$\partial_\mu g^{\alpha\beta} = \frac{\delta g^{\alpha\beta}}{\delta x^\mu} = - \frac{\delta h^{\alpha\beta}}{\delta x^\mu} = - \partial_\mu h^{\alpha\beta} \tag{***}$$
Now I can go on and perform my expansion of $\partial_\mu g^{\mu\nu} \partial_\nu \sqrt{-g}$ of the OP. First using $(2)$, $(**)$ and $(***)$:
$$\begin{align} \partial_\mu g^{\mu\nu} \partial_\nu \sqrt{-g} &= - \partial_\mu h^{\mu\nu} \frac{1}{2} \sqrt{-g} g^{\alpha\beta} \partial_\nu g_{\alpha\beta} \\ &= -\frac{1}{2} \partial_\mu h^{\mu\nu} \partial_\nu h + \mathcal{O}(h^3) \end{align}$$
Now using $(3)$, $(**)$ and $(***)$:
$$\begin{align} \partial_\mu g^{\mu\nu} \partial_\nu \sqrt{-g} &= - \partial_\mu h^{\mu\nu} \left(- \frac{1}{2} \right) \sqrt{-g} g_{\alpha\beta} \partial_\nu g^{\alpha\beta} \\ &= - \partial_\mu h^{\mu\nu} \left(- \frac{1}{2} \right) \sqrt{-g} g_{\alpha\beta} \left( - \partial_\nu h^{\alpha\beta} \right) \\ &= - \frac{1}{2} \partial_\mu h^{\mu\nu} \partial_\nu h + \mathcal{O}(h^3) \end{align}$$
And now the results are consistent, no matter if one uses $(2)$ or $(3)$.
