I am trying to calculate
$$ \frac{\partial \sqrt{- g}}{\partial g^{\mu \nu}},$$
where $g = \text{det} g_{\mu \nu}$. We have
$$ \frac{\partial \sqrt{- g}}{\partial g^{\mu \nu}} = - \frac{1}{2 \sqrt{-g}}\frac{\partial g}{\partial g^{\mu \nu}},$$ so the problem becomes how to calculate $\frac{\partial g}{\partial g^{\mu \nu}}.$
I have used the identity $\text{Tr}( \text{ln} M) = \text{ln} (\text{det} M)$ to obtain, applying it with $M = g^{\mu \nu}$ and varying it:
$$\delta (\text{Tr} (\text{ln} (g^{\mu \nu}))) = \frac{\delta g}{g} $$
but then I am stuck. How can I go on? I know the result should be $ -\frac{1}{2} g_{\mu \nu} \sqrt{-g}$