I'm going over a proof in Differential Geometry of Curves and Surfaces by do Carmo, and I don't know why the proof can't be shortened to my proof given below. (Proposition 9 on page 130)
Proposition. Let f:U-->R be a differentiable function defined on a connected open subset U of Rn. Assume that dfp:Rn-->R is zero at every point p in U. Then f is constant on U.
A surface S is connected if any two points can be joined by a continuous curve in S.
The Attempt at a Solution
Let p and q be in U. We want to show that f(p)=f(q).
Since U is connected, there exists a continuous curve X:[a,b]-->U with X(a)=p and X(b)=q.
Since U is open, we can extend X to (a-epsilon, b+epsilon).
Now, f o X : (a-epsilon, b+epsilon) -->R is a function defined in an open interval, and d(f o X)t = (df o dX)t = 0, since df=0.
Thus d/dt(f o X) = 0 for all t in (a-epsilon, b+epsilon), and hence f o X = const.
This means that f(X(a))=f(p)=f(X(b))=f(q); that is, f is constant on U.
The book's proof is similar to mine, but it is longer and not the same as mine. So, is my proof OK, or am I missing something?