Why does $\mathrm{tr}(\ln g_{\mu\nu})$ vary as $g^{\mu\nu}\cdot\delta g_{\mu\nu}$ under $\delta g_{\mu\nu}$? For a pseudo-Riemannian manifold, under the variation $g_{\mu\nu}\mapsto g_{\mu\nu}+\delta g_{\mu\nu}$, the determinant $g=\det g_{\mu\nu}$ varies as $$\delta g=gg^{\mu\nu}\delta g_{\mu\nu}$$
Nakahara proves this with the matrix identity $$\tag{1}\ln(\det g_{\mu\nu})=\mathrm{tr}(\ln g_{\mu\nu})$$
The LHS of (1) varies as $\delta g\cdot g^{-1}$ (which is fine), the RHS as $g^{\mu\nu}\cdot\delta g_{\mu\nu}$. I don't understand the last point.
Why does $\mathrm{tr}(\ln g_{\mu\nu})$ vary as $g^{\mu\nu}\cdot\delta g_{\mu\nu}$ under the variation $g_{\mu\nu}\mapsto g_{\mu\nu}+\delta g_{\mu\nu}$?
 A: When the matrix $X$ is symmetric $>0$, $\ln(\det(X))=tr(\ln(X))$ (use the $>0$ eigenvalues of $X$).
Let $f(X)=tr(\ln(X))$; then, by Taylor, $f(g_{\mu\nu}+\delta g_{\mu\nu})-f(g_{\mu\nu})\approx Df_{g_{\mu\nu}}(\delta g_{\mu\nu})=tr(\delta g_{\mu\nu}(g_{\mu\nu})^{-1})=tr(g^{\mu\nu}\delta g_{\mu\nu})$ (You can admit the penultimate equality). Finally the RHS varies as $tr(g^{\mu\nu}\delta g_{\mu\nu})$ .
EDIT 1. @ Bass @ Ocelo7 . Since Bass sent to me a comment, I go back... Let $G=[g_{\mu,\nu}]$ be the metric matrix, $g=\det(G)$, $G^{-1}=[g^{\mu,\nu}]$ and $\delta G=\delta g_{\mu,\nu}$. We want to show that $\delta g=g\sum_{\mu,\nu}g^{\mu,\nu}\delta g_{\mu,\nu}=g.tr(G^{-1}\delta G)$, that is $\delta g/g=tr(G^{-1}\delta G)$. I don't understand why Nakahara wants to prove this result using the $\log$ function; it is much easier to reason directly on the $\det$ function... Now we assume that the metric $G$ is $>0$, otherwise $\log(G)$ is not defined. Since $\log(g)=tr(\log(G))$, it remains to show that $\delta (tr(\log(G)))=tr(G^{-1}\delta G)$ or $tr(\delta (\log(G)))=tr(G^{-1}\delta G)$. Above, I admitted this part because it is difficult. Note that he Orcelo7 proof is absolutely false; in particular, even if $\tilde{M}$ is diagonal, $\delta(\tilde{M})$ is not diagonal! (moreover the matrix that diagonalizes $\tilde{M}$ varies). I give a proof in the particular case when $G=I+A$ where $||A||<1$. Then $\log(G)=A-A^2/2+A^3/3+\cdots$ and $\delta(\log(G))=\delta A-1/2(\delta A.A+A.\delta A)+1/3(\delta A.A^2+A.\delta A.A+A^2.\delta A)+\cdots$ is very complicated. Yet the miracle occurs when we consider the trace: $tr(\delta(\log(G))=tr(\delta A(I-A+A^2+\cdots)=tr(\delta A.(I+A)^{-1})=tr(G^{-1}\delta G)$ and we are done.
EDIT 2. @ Bass . I consider the principal $\log$ that is defined over complex numbers as follows. Let $D=\{z; z\leq 0\}$; if $z\notin D$, then $\theta(z)$ denotes the measure of the angle $(Ox,z)$ that is in $(-\pi,\pi)$ and  $\log(z)$ is, by definition, $\log(r)+i\theta(z)$. If you define $\log$ (as you did) when $z<0$ by $\log(z)=\log(r)+i\pi$, then you obtain a function that is not continuous and, consequently, $\delta(\log(M))$ is not necessarily small. Finally, $\log(A)$ is defined for a matrix $A$ that has no $<0$ eigenvalues. Clearly you may choose another definition of the argument $\theta$; yet, your new log will not be defined everywhere.
EDIT 3. Work and work again... Since $G$ is symmetric, you can choose $\theta(z)\in(-\pi/2,3\pi/2)$; the calculation about $\log(I+A)$ is still valid. All works except the equality $\log(g)=tr(\log(G))$. Assume, for example, that $G$ has some $>0$ eigenvalues and three $<0$ eigenvalues. Then $tr(\log(G))=\log(|g|)+3i\pi$ and $\log(g)=\log(|g|)+i\pi$. Thus $\log(g)-tr(\log(G))=2ki\pi$ where $k$ is locally constant integer. When we consider some $\delta(.)$, the previous constant disappears; now, I think that all works.
A: $\renewcommand{tr}[1]{\operatorname{tr}#1}$
I will try to be extremely careful with signs here.
Let $M\in\operatorname{Mat}(n,\mathbb{R})$ have eigenvalues $\{\lambda_i\}_{1\le i\le n}$. It is well known that 
$$\det M=\prod_{i=1}^n\lambda_i\quad\text{and}\quad\tr M=\sum_{i=1}^n\lambda_i$$
Suppose that $M$ is symmetric and of nonzero determinant, i.e. $\lambda_i\ne 0$ for all $i$. We now calculate: $$\log (\lvert\det M\rvert)=\log\lvert\prod_i\lambda_i\rvert=\log\prod_i\tilde\lambda_i=\sum_i\log\tilde \lambda_i$$
where $\tilde \lambda_i=\lvert\lambda_i\rvert$. One may show that the last sum is $\tr\log \tilde M$ where $\tilde M$ is a matrix with eigenvalues $\{\tilde\lambda_i\}$. This is trivial because $M$ can be diagonalized and the trace is cyclic. Note that $\det\tilde M=\lvert\det M\rvert$. So $\log \det \tilde M=\tr\log \tilde M$, as is written in the OP. 
Suppose $M$ (and therefore $\tilde M$) depends differentiably on some parameter $t$. Now we let $\delta$ be the variational derivative, i.e. the derivative wrt. $t$ evaluated at $t=0$. We now take the variational derivative of both sides of $\log\lvert\det M\rvert=\tr\log\tilde M$. The LHS is 
$$\delta\log\lvert\det M\rvert=\frac{\operatorname{sign}[\det M]}{\lvert \det M\rvert}\delta\det M$$
and the RHS is $$\delta \tr\log\tilde M=\tr\delta\log\tilde M=\tr \tilde M^{-1}\delta\tilde M$$
where the first equality comes from the fact that the trace is a linear operator that commutes with differentiation. Since the trace is basis independent, we may calculate $\tilde M^{-1}\delta \tilde M$ in whatever basis we want. We choose the basis in which $\tilde M=\operatorname{diag}\tilde\lambda_i$, thus $$\tilde M^{-1}\delta \tilde M=\operatorname{diag}(\tilde\lambda^{-1}_i\delta\tilde\lambda_i)=\operatorname{diag}(\lambda^{-1}_i\delta\lambda_i)=M^{-1}\delta M$$
These calculations give $$\delta \det M=\operatorname{sign}[\det M]\lvert\det M\rvert\tr (M^{-1}\delta M)$$
In index notation we have $M=(M_{ij})$ and $M^{-1}=(M^{ij})$. Thus $(M^{-1}\delta M)^i{}_j=M^{ik}\delta M_{kj}$ and $\tr(M^{-1}\delta M)=(M^{-1}\delta M)^i{}_i=M^{ik}\delta M_{ki}=M^{ik}\delta M_{ik}$ where the last line follows from symmetry.
Putting it all together, we have 
$$\delta \det M=\det M M^{ik}\delta M_{ik}$$
Given any pseudo-Riemannian manifold $(\mathcal{M},g)$ one can obtain a "metric matrix" in a chart $(U,x)$ by setting $g_{ij}:=g(\partial/\partial x^i,\partial/\partial x^j)$. This matrix satisfies all of the properties of $M$ above. The inverse matrix is denoted by $g^{ij}$. We thus have
$$\delta g=gg^{ij}\delta g_{ij}$$
where $g=\det g_{ij}$ is a common shorthand.
