condition for compatible connection on a Riemannian manifold Prove that connection $\nabla $ on a Riemannian manifold $M$ is compatible with metric iff 
$$Xg(Y,Z)=g(\nabla_XY,Z)+g(Y,\nabla_XZ),$$
for every smooth vector fields $X,Y,Z$. 
I am confused about how to prove compatibility from this equation. Any help is appreciated it. By my text it should be obvious (Do Carmo). 
 A: This is somewhat delicate to do with complete detail and involves exactly the kind of issues on which Do Carmo doesn't bother to expand.
Let $\gamma : [0,1] \rightarrow M$ be a smooth curve and let $P,P'$ be two smooth parallel vector fields along $\gamma$. Define $f(t) = g(P(\gamma(t)), P'(\gamma(t)))$. The function $f : [0,1] \rightarrow M$ is smooth. We will show that the derivative $f'(t)$ is identically zero.
Let $t_0 \in [0,1]$. Choose some vector field $Z \in \Gamma(M)$ such that $Z(\gamma(t_0)) = \dot{\gamma}(t_0)$. Consider three cases:
(1) $\dot{\gamma}(t_0) \neq 0$. Then, for small enough $\epsilon > 0$, the image $\gamma([t_0 - \epsilon, t_0 + \epsilon])$ is an embedded compact submanifold of $M$ with boundary. This implies that $P,P'$ (restricted to the image) are defined on a compact submanifold of $M$ and so can be extended to vector fields $X,X' \in \Gamma(M)$, defined $\textbf{globally}$ on $M$, such that $X(\gamma(t)) = P(\gamma(t)), X'(\gamma(t)) = P'(\gamma(t))$ for $t \in [t_0 - \epsilon, t_0 + \epsilon]$. Thus,
$$ f'(t_0) = \dot{\gamma}(t_0)g(X,X') = \left. Zg(X,X')\right|_{p=\gamma(t_0)} = \left. g(\nabla_Z X, X')\right|_{p=\gamma(t_0)} +  \left. g(X, \nabla_Z X')\right|_{p=\gamma(t_0)} = g(\left. \frac{DP}{dt} \right|_{t=t_0}, X'(\gamma(t_0))) + g(X(\gamma(t_0)), \left. \frac{DP'}{dt} \right|_{t=t_0}) = 0.  $$ 
(2) $\dot{\gamma}(t_0) = 0$, but there is a sequence $t_n \rightarrow t_0$ such that $\dot{\gamma}(t_n) \neq 0$. For example, you can think about a curve $\gamma$ that traces a line segment from $t = 0$ to $t_0 = \frac{1}{2}$, slows down smoothly as $t$ approaches $\frac{1}{2}$, and then turns back on its trace. In this case, you can't necessarily extend the vector fields $P, P'$ to $\textbf{global}$ vector fields, but you get from continuity of $f'$ and from the previous analysis that $f'(t_0) = 0$.
(3) $\dot{\gamma}(t) \equiv 0$ in a neighborhood of $t_0$. This implies that $\gamma(t)$ is constant around $t_0$. Since parallel transport along a constant curve is constant, the function $f(t)$ itself is constant around $t_0$ and in particular $f'(t_0) = 0$.
