# Variation of the metric w.r.t. the metric in derivation of stress tensor

Consider massless free scalar theory $$S = \int d^4x \sqrt{-g}L = \int d^4x \sqrt{-g} \;g^{cd}\nabla_c\phi \nabla_d \phi.\tag{1}$$ To compute the Hilbert stress-energy tensor we require $$\sim\delta S/\delta g_{ab}$$. I want to focus on $$\delta L/ \delta g_{ab}$$. $$\frac{\delta L}{\delta g_{ab}} = \frac{\delta g^{cd}}{\delta g_{ab}} \nabla_c\phi \nabla_d \phi = - g^{ac} g^{db}\nabla_c\phi \nabla_d \phi= -\nabla^a\phi \nabla^b \phi,\tag{2}$$ where I have used $$\delta (g_{ab}g^{bc})=0$$ to derive the implied expression for $$\delta g^{ab}$$ in terms of $$\delta g_{ab}$$. This is correct according to H. Reall's notes: (eq. 10.31) http://www.damtp.cam.ac.uk/user/hsr1000/part3_gr_lectures_2017.pdf .

However $$L=g^{cd}\nabla_c\phi \nabla_d \phi=g_{cd}\nabla^c\phi \nabla^d \phi\tag{3}$$ so I could also have $$\frac{\delta L}{\delta g_{ab}} = \frac{\delta g_{cd}}{\delta g_{ab}} \nabla^c\phi \nabla^d \phi.\tag{4}$$ For the two results to match, it would seem that we need $$\frac{\delta g_{cd}}{\delta g_{ab}} \sim - \frac{1}{2}(\delta^a_c \delta^b_d +\delta^a_d \delta^b_c )\;?\tag{5}$$ but I'm pretty sure there should be no minus sign!

The error in OP's differentiation (4) wrt. the metric is instead the missing contributions coming from the fact that $$\nabla^c \phi=g^{cd}\partial_d\phi$$ implicitly depends on the metric.
Let me show you a similar mistake. For simplicity, let us consider Maxwell theory because it is manifest where the metric hides, $$\begin{equation} S = \frac{1}{4}\int d^4x \sqrt{-g} F_{\rho\sigma}F^{\rho\sigma}, \end{equation}$$ where $$F_{\mu\nu} := \partial_\mu A_\nu - \partial_\nu A_\mu$$. Notice that the definition of $$F_{\mu\nu}$$ involves no metric. OK, now we try to derive stress-energy tensor by varying the action with respect to the metric. Naively, one may write $$\begin{equation} \frac{\delta S}{\delta g_{\mu\nu}} \ni \frac{1}{4}\int d^4x \sqrt{-g} \frac{\delta (g_{\alpha\rho}g_{\beta\sigma})}{\delta g_{\mu\nu}} F^{\alpha\beta}F^{\rho\sigma}, \end{equation}$$ where I just showed one term in the variation. On the other hand, one may write $$\begin{equation} \frac{\delta S}{\delta g_{\mu\nu}} \ni \frac{1}{4}\int d^4x \sqrt{-g} \frac{\delta (g^{\alpha\rho}g^{\beta\sigma})}{\delta g_{\mu\nu}} F_{\alpha\beta}F_{\rho\sigma}. \end{equation}$$ Then one finds exactly your puzzle if you work out the variations above -- the sign difference. The sign of the last equation above is correct actually. (To check this, you can compute the trace of stress-energy tensor. Maxwell theory in 4d should have a traceless stress-energy tensor).
The tricky part is, when you write $$\begin{equation} F_{\rho\sigma}F^{\rho\sigma} = g_{\alpha\rho}g_{\beta\sigma}F^{\alpha\beta}F^{\rho\sigma}, \end{equation}$$ you are hiding some factors of metric into the $$F^{\alpha\beta}F^{\rho\sigma}$$ part. Recall that $$F_{\mu\nu}$$ is defined without metric while $$F^{\mu\nu}$$ is, because it equals $$F^{\mu\nu} = g^{\mu\alpha}g^{\nu\beta}F_{\alpha\beta}$$.