Given $M$ manifold in $\mathbb{R}^n$ and $f:\mathbb{R}^n\to\mathbb{R}$ $C^1$ function
Prove if f is constant on $M$ then $\nabla f(x)\bot T_xM$
Attempt:
we know that $f(x)=a$ for all $x\in M$ then we can assume that $a=0$ wlog(otherwise we can do some linear transformation) so we can see that $M=\{x|f(x)=0\}$ and we know that the tangent space at x is defined by $\{\nabla f(x)\}^{\bot}=T_xM \to T_xM\bot\nabla f(x)$ as required.
Am I right here?