Varying the action with respect to the metric in one dimension I am reading Witten's interesting article What every physicist should know about string theory. On page 39 he gives the general relativistic action in one spacetime dimension of a scalar fields $X_I$, with $I=1\ldots D$:
$$
I=\int d t \sqrt{g}\left[\frac{1}{2} \sum_{I=1}^{D} g^{t t}\left(\frac{d X_{I}}{d t}\right)^{2}-\frac{1}{2} m^{2}\right]\tag{1}
$$
where $m$ is a constant and $g_{tt}$ is a $1\times1$metric tensor. He then introduces the canonical momentum, $P_{I}=d X_{I} / d t$, and goes onto give the equation of motion which he says is obtained by varying the action $I$ with respect to $g$:
$$g^{t t} \sum_{I=1}^{D} P_{I}^{2}+m^{2}=0.\tag{2}$$
I am having trouble deriving this equation. I am assuming that $g=g^{tt}$ and getting
$$3g^{t t} \sum_{I=1}^{D} P_{I}^{2}-m^{2}=0.\tag{3}$$
I would be very grateful if someone could explain how to get the correct answer.
 A: Here are the key points, which I'll express for an arbitrary number of spacetime dimensions because that makes the pattern more clear:

*

*Inside $\sqrt{g}$, the thing denoted $g$ is the magnitude of the determinant of the metric tensor $g_{ab}$.


*$g^{ab}$ are the components of the inverse of the metric tensor, defined by the condition $\sum_b g^{ab}g_{bc}=\delta^a_c$.
Specialized to one-dimensional spacetime, that general pattern reduces to this: $g^{tt}$ is the inverse of the quantity $g$ inside the square root. To make this explicit, we can write the metric tensor as $g$ (because it only has one component), and then $g^{tt}\equiv g^{-1} = 1/g$.
Now that we've deciphered the notation, we can do the calculation. To reduce clutter, I'll write the action as
$$
 I \propto \int dt\ g^{1/2} (g^{-1} K - m^2)
$$
with $K\equiv \sum_n (dX_n/dt)^2$. This gives
\begin{align}
\frac{\delta I}{\delta g} 
 &\propto (g^{-1} K - m^2)\frac{\delta }{\delta g}g^{1/2}
 + g^{1/2}\frac{\delta}{\delta g} (g^{-1}K-m^2)
\\ 
 &= (g^{-1} K - m^2)\frac{g^{-1/2}}{2}
 - g^{1/2}g^{-2}K
\\ 
 &= -\frac{g^{-1/2}}{2}(g^{-1}K+m^2),
\end{align}
so setting $\delta I/\delta g=0$ gives the desired equation of motion.
A: *

*In the 1D world-line, the square root
$$\sqrt{g_{tt}}~=~e~>~0$$
of the metric $g_{tt}$ is an einbein. And the inverse metric is
$$g^{tt}~=~\frac{1}{e^2}.$$


*Therefore Witten's Lagrangian (1) is
$$L~=~\frac{\dot{x}^2}{2e}-\frac{e m^2}{2}.\tag{1'}$$
Variation wrt. the einbein $e$ leads to
$$\frac{\dot{x}^2}{e^2}+  m^2~\approx~0,\tag{2'}$$
which is Witten's eq. (2).


*For more information, see e.g. this related Phys.SE post.
