Schur's Theorem (Exercise 8, Chapter 4; Do Carmo, Riemannian Geometry) 
In the picture (P106 Do Carmo, Riemannian Geometry), why the red line implies $K = const$.
I have two questions about this.

*

*I have seen in another answers, which strictly follows the hint in the book. It says $X(K)=0, \forall X \in TpM $ implies $K=const$ in a neighborhood of $p$.
Why does $K=const$ in a neighborhood of $p$?
I think, from $X(K)=0, \forall X \in TpM $, we only can say that in any coordinate neighborhoods $U$ about $p$, all partial derivatives of $K$ at $p$ (not $U$) are zero.
But how could we say that $K=const$ in a neighborhood of $p$?


*Starting from the blue arrow, I think, by the arbitrariness of $p$, we have for any $p\in M$, $X_p(K)=0, \forall X_p \in T_pM$.
So the partial derivatives of $K$ are identically zeros on $M$, which means that $K=const$.
But, in this way, the connectedness of $M$ would be redundant.
So where did I miss?
Edit
Why does $(df)_p=0, \forall p \in M$ only implies $f$ is locally constant (why is $f$ not globally constant).
The following is my thinking.
In Euclidean space, if all partial derivatives of $f:R^n \rightarrow R^m$ are identically zero on $R^n$, then $f$ is constant on $R^n$ (no need for connectedness).
Back to this exercise, for the "locally constant", is it because the coordinate neighborhoods?
More precisely, at any point $q \in M$, for a chart $\{\phi, U\}$ ($\phi : U \in M \rightarrow R^n$) about $q$, $df=0$ on $U$ implies $f \circ \phi^{-1}$ is constant on $\phi(U)$.
This in turn means $f$ is constant on $U$.
So, the "$f$ is locally constant" you mentioned is that $f$ is constant on every charts.
 A: If a smooth function on a connected manifold $M$, and $X$ is a vector field, then the condition $Xf = 0$ is equivalent to the fact that $f$ is constant on the integral curves of $X$.
Indeed:
$$
Xf = 0 \iff df(X)=0 \iff \forall \gamma \text{ integral curve of } X, (f\circ \gamma)' = 0.
$$
Let $p$ and $q$ be any two distinct points and let $\gamma\colon [0,1]\to M$ be any smooth injective path jointing $p$ and $q$ (here comes the connectedness!).
Consider $Y = \gamma'$ along $\gamma$, and extend it arbitrarily on all of $M$.
Assume that $Xf=0$ for all $X$.
Then $Yf = 0$, which implies that $f(p) = f(q)$.
Finally, $f$ is constant.
Apply this to $f = K$, which is supposed to be independent of the tangent plane $\sigma \subset T_pM$, and therefore, is assumed to be a function on $M$.

Edit
Here is what I think do Carmo has in mind.

*

*For $p\in M$ and $X_p\in T_pM$, he shows that $X_p K = 0$.

*This being true for all $X_p\in T_pM$, one can conclude that $d_pK = 0$.

*This being true for all $p\in M$, one can conclude that $dK = 0$ on all of $M$.

*For a smooth function $f$ on a manifold $M$, $df = 0$ implies that $f$ is locally constant, and if $M$ is connected, then $f$ is constant.
This implies that $K$ is constant.

