Assume $f$ is differentiable at each point of an n-ball $B(a)$. Prove that if $f(x) \leq f(a)$ for all $x$ in $B(a)$, then $\nabla {f(a)} = 0.$
I had my proof, but I'm not sure it is correct.
Proof: Since f is differentiable at each point of the n-ball B(a), meaning
$$\lim_{h \to 0} \frac{f(a+hy)-f(a)}{h} = \nabla f(a) \cdot y$$ , where y is an arbitrary unit vector.
From the mean value theorem, we know that
$$\lim_{h \to 0} \frac{f(a+hy)-f(a-hy)}{h} = \nabla f(c) \cdot y$$ for some c where $||c|| < r$.
Since
$$\lim_{h \to 0} \frac{f(a+hy)-f(a)}{h} = \nabla f(c) \cdot y = - \lim_{h \to 0} \frac{f(a)-f(a-hy)}{h}$$
Since the RHS of the the first equation is 0, we have $\nabla f(a) = 0$.
So, is there any mistake of any suggestion about the point that I can improve mathematically or about the way that I wrote ?
You never used the fact that $f(x)\leq f(a)$. I may be missing something, but it seems that your proof would imply that all differentiable functions have this property.
My proof is the following: Compute
$$\lim_{h\to 0 } \frac{f(a+hy)-f(a)}{h} = \nabla f(a) \cdot y,$$
and note that $f(a+hy)\leq f(a)$ for all $h$ sufficiently small, so $\nabla f(a)\cdot y\leq 0$. However, taking $y\mapsto -y=:\tilde{y}$ we again have
$$\lim_{h\to 0} \frac{f(a+h\tilde{y})-f(a)}{h} = \nabla f(a)\cdot \tilde{y},$$
implying $\nabla f(a) \cdot \tilde{y} \leq 0$. But, since $\tilde{y}=-y$ we have $\nabla f(a)\cdot y \geq 0$. Combining this with the first inequality we derive $\nabla f(a) \cdot y =0$. Since $y$ was arbitrary it immediately follows that $\nabla f(a)=0.$
EDIT: To make the last argument explicit: Our above work implies that $\nabla f(a) \cdot y =0 $ for any $y$. In particular, take $y=\nabla f(a)$ so that
$$0 = \nabla f(a) \cdot \nabla f(a) = |\nabla f(a)|^2.$$
Then, $|\nabla f(a)|^2 = 0$ only if $\nabla f(a) =0.$