Solution (source code)

= Solution

If $X$ is tangent to $N$ and $f|_N=0$, then the restriction of $f$ to every curve in $N$ is zero, so $(Xf)|_N=0$.

Conversely, use a <slice chart for an embedded submanifold>. The functions $x^{n+1},\ldots,x^m$ vanish on $N$. Writing $X=X^i\partial_i$, the hypothesis gives
$$
Xx^\alpha=X^\alpha=0\quad\text{on }N,\qquad \alpha>n.
$$
Thus $X$ has no normal component and is tangent to $N$. Equivalently, $X$ preserves the <vanishing ideal of an embedded submanifold>.