Does the gradient always point outward of a level surface? Let $f:\mathbb{R}^n\to \mathbb{R}$ be a differentiable function, with $a\in \mathbb{R}$ a regular value of $f$.
Let $M=f^{-1}((-\infty,a])$. Then $M$ is an $n$-manifold with boundary, whose boundary is $\partial M=f^{-1}(a)$.
Let $p\in \partial M$. Then $T_p\partial M=\{\nabla f(p)\}^{\perp}$.

Question: Does $\nabla f(p)$ point outwards of $\partial M$?

I know it's not true if we take the interval the other way around. E.g. $-1$ is a regular value of $f:\mathbb{R}^2\to \mathbb{R}$, $f(x,y)=-x^2-y^2$, but the gradient of $f$ points inwards of the boundary of $f^{-1}([-1,+\infty))$ which is $S^1$.
In fact, by symmetry, if the answer to the question is positive, I suspect that if we take $M=f^{-1}([a,+\infty))$ then $\nabla f(p)$ always points inwards of $\partial M$.
 A: By assumption $f(p)=a$ and $\nabla f(p)=: n\ne0$. For $X\in T_p$ we have
$$f(p+X)-f(p)=n\cdot X+o\bigl(|X|\bigr)\qquad(X\to0)\ .$$
Now put $X:= \lambda n$ with $\lambda>0$. Then $|X|=\lambda|n|$ and therefore
$$f(p+\lambda n)-f(p)=\lambda|n|^2+o(\lambda|n|)=\lambda |n|^2\bigl(1+o(1)\bigr)\qquad(\lambda\to0+)\ .$$
It follows that $f(p+\lambda n)>f(p)=a$ for all suitably small $\lambda>0$, which implies that $n$ points to the outside of $M$.
A: I disagree with your interpretation that the gradient of your example function $f = -x^2 -y^2$ points inward.  The manifold $M$ is everything outside of the unit sphere.  To me, saying the gradient points inward means it points into the manifold.  Instead, the gradient points out of the manifold.  It just so happens that out of the manifold is radially towards the origin.
It may be you drew this conclusion because you originally defined the manifold as the set of points such that $f$ takes on no more than the value of $a$, but then you changed to consider the set of points corresponding to $f$ no less than the value of $a$ at the end of the question.  Reversing these notions reverses what you consider to be part of the manifold.
Edit: I see why you explored that case then.  Then yes, as long as you define the manifold to contain points where $f < a$, the gradient will point to where $f$ increases and hence takes on values greater than $a$.  This is outward to the manifold when the manifold is defined in this way.
A: I have managed to formulate my own proof of this theorem. I give full detail below.
Definition: Let $M$ be an $n$-manifold with boundary, $p\in \partial M$ and $\varphi:U\subset \mathbb{H}^n\to M$ a parametrization such that $\varphi(q)=p$. We say that $v\in T_pM$ is inward-pointing (resp. outward-pointing) if it is of the form $d\varphi_q(v_0)$ with $v_0\cdot e_n>0$ (resp. $v_0\cdot e_n<0$).
Let's check that this definition does not depend on the choice of parametrization, and at the same time give a useful criterion.
Theorem. Let $M$ be an $n$-manifold with boundary, $p\in \partial M$ and $v\in T_pM$. The following are equivalent:


*

*There exists a parametrization $\varphi:U\to M$ such that, if $\varphi(q)=p$ and $v=d\varphi_q(v_0)$, then $v_0$ is such that $v_0\cdot e_n>0$.

*$v\not\in T_p\partial M$ and there exists a curve $\alpha:[0,\epsilon)\to M$ such that $\alpha(0)=p$ and $\alpha'(0)=v$.

*For every parametrization $\varphi:U\to M$ we have that, if $\varphi(q)=p$ and $v=d\varphi_q(v_0)$, then $v_0$ is such that $v_0\cdot e_n>0$.
Proof: ($1 \Rightarrow 2$) Define $\alpha:[0,\epsilon)\to M$ as $\alpha(t)=\varphi(q+tv_0)$, taking $\epsilon$ small enough for $q+tv_0$ to be in $U$ for all $t$. Then $\alpha(0)=p$, and by the chain rule, $\alpha'(0)=v$.
($2 \Rightarrow 3$) Let $\varphi:U\to M$ be a parametrization with $\varphi(q)=p$ and $v=d\varphi_q(v_0)$. Since $\alpha(0)=p\in \varphi(U)$, we may suppose that $\alpha([0,\epsilon))\subset \varphi(U)$, taking a smaller $\epsilon$ if necessary. We can define then a curve $\beta:=\varphi^{-1}\circ \alpha:[0,\epsilon)\to U$ with $\beta(0)=q$ and $\beta'(0)=v_0$.
Now, $\beta'(0)=\lim_{t\to 0^+} \frac{\beta(t)-q}{t}$. But $\beta(t)-q\in \mathbb{H}^n$ for all $t$, therefore $\beta'(0)=v_0\in \mathbb{H}^n$. Since we further assumed that $v\not\in T_p\partial M$, then $v_0\not\in \partial \mathbb{H}^n$, whence $v_0\cdot e_n>0$.
($3 \Rightarrow 1$) It is obvious. $\blacksquare$
Theorem. Let $f:M\to N$ be a differentiable function between manifolds with boundary. Let $p\in \partial M$ and $v\in T_pM$. If $v$ is inward-pointing, then $df_p(v)\in T_{f(p)}N$ is inward-pointing.
Proof: Let $\alpha:[0,\epsilon)\to M$ be a curve such that $\alpha(0)=p$, $\alpha'(0)=v$. Consider $f\circ \alpha:[0,\epsilon)\to M$. We have $f(\alpha(0))=f(p)$, and by the chain rule, $(f\circ \alpha)'(0)=df_p(v)$. Therefore $df_p(v)$ is inward-pointing. $\blacksquare$
Theorem: Let $f:\mathbb{R}^n\to \mathbb{R}$ be a differentiable function with $a\in \mathbb{R}$ a regular value. So $M=f^{-1}((-\infty,a])$ is a manifold with boundary such that $\partial M=f^{-1}(a)$. Let $p\in \partial M$. Then $\nabla f(p)$ is outward-pointing.
Proof: We first observe that $\nabla f(p)\not\in T_p\partial M$, because $T_p\partial M=\{\nabla f(p)\}^\perp$. Assume by contradiction that $\nabla f(p)$ is inward-pointing.
By considering $f|_M:M\to (-\infty,a]$, by the previous proposition we conclude that $df_p(\nabla f(p))\in \mathbb{R}$ is inward pointing to $(-\infty,a])$. Explicitly, this means that $df_p(\nabla f(p))<0$.
Indeed, a vector $v\in \mathbb{R}$ is inward-pointing to $(-\infty,a])$ if and only if $v\neq 0$ and there exists a curve $\alpha:[0,\epsilon)\to (-\infty,a]$ such that $\alpha(0)=a, \alpha'(0)=v$. Since $\alpha(t)\leq a$ for all $t$, then $v=\alpha'(0)=\lim_{t\to 0^+} \frac{\alpha(t)-a}{t}\leq 0$, therefore $v<0$.
We have thus that $df_p(\nabla f(p))<0$. We reach a contradiction, since $df_p(\nabla f(p))=\nabla f(p)\cdot \nabla f(p)=\|\nabla f(p)\|^2>0$. $\blacksquare$
