TITLE: Maximal solution of a differential equation belongs to manifold $M$.
QUESTION [5 upvotes]: I'm trying to prove the following:

Let $U\subseteq\mathbb R^n$ be an open set and $g\colon U\to\mathbb R^n$ be a (continuous) vector field.
  Suppose that for every $p\in U$ the equation
  $$x' = g(x), \quad x\in U,$$
  admits a unique maximal solution $x(\cdot)$ satisfying $x(0)=p$.
  Now, let $M\subseteq U$ be a (at least) $C^1$ manifold closed in $U$.
  If $g$ is tangent to $M$, that is, if $g(x) \in T_xM$ for every $x\in M$, then every maximal solution of $x' = g(x)$ that intercepts $M$ "lives" entirely in $M$.

I have no clue on how to attack this problem. The first thing I've thought is to use that $M$ is locally a level set of a $C^1$ function $f\colon U\to\mathbb R^m$, say $f^{-1}(0)$, but working "locally" is not compatible with "maximal solution", so I'm stuck.
I really don't know how to proceed.
Any help would be appreciated.
Thanks in advance.

REPLY [4 votes]: Let's follow your idea, because "working locally" can be, in a sense, compatible with "maximal solution" due to connectivity of the interval.
Explicitly, it suffices to prove that (given a maximal solution $c$ of the differential equation):

If $c(t_0) \in M$, then $c(t)$ belongs to $M$ for all $t$ in a neighbourhood of $t_0$.
The set of $t$'s such that $c(t)$ belongs to $M$ is closed.

Since $M$ is a closed manifold, the second bullet point is obvious (the set of such $t$'s is $c^{-1}(M)$). The first bullet point amounts precisely to working locally, and showing both shows that $c$ belongs to $M$ in the whole interval (!) of its definition if it has any point at all that is in $M$, since intervals are connected.
To prove the first bullet, let $t_0$ be such that $c(t_0) \in M$. Take a neighbourhood $U$ of $c(t_0)$ such that $M \cap U \simeq W_1 \times \{0\}$, where $W_1 \subset \mathbb{R}^{\dim(M)} $ (local form of immersions). Under this diffeomorphism, the vector field $g$ becomes horizontal on $W_1$. In particular, you can consider its restriction to $W_1 \subset \mathbb{R}^{\dim(M)}$, which gives a flow there. By uniqueness of the trajectories, we then have that the flow of points  in $W_1 \times \{0\}$ must belong there. Therefore, the flow of points in $M \cap U$ must belong there.