Differentiation of $f:\mathbb{R^n} \rightarrow \mathbb{R}$  Let $f:\mathbb{R^n} \rightarrow \mathbb{R}$ be a differentiable function. Assume that f has a local maximum at $x_0 \in \mathbb{R^n}$. Show that $f'(x_0) = 0$.
I have the definition 
$$\begin{cases}f(x_0 + h) = f(x_0) + f'(x_0)h + r(h) \\
\lim_{h\rightarrow0} \dfrac{|r(h)|}{|h|} = 0
\end{cases}
$$
But am unsure how to apply it in this situation. The outcome is trivial but the technical proof is eluding me.
 A: Note that your $f'$ is actually a gradient. To show that $f'(x_0)=0$ is equivalent to showing that the directional derivative of $f(x)$ in each of the coordinate directions $e_1,\ldots,e_n$ is zero. Fix $1\leq i\leq n$. The trick to showing that the derivative in direction $e_i$ is zero is to show that $f'(x_0)e_i\leq 0$ and that $f'(x_0)e_i\geq 0$.
I'll indicate how to show the first inequality. Since $f$ has a local maximum at $x_0$, this means that for all $\epsilon>0$ sufficiently small, $f(x_0+\epsilon e_i)\leq f(x_0)$. By definition, $$f'(x_0)e_i=\frac{f(x_0+\epsilon e_i)-f(x_0)}{\epsilon}-\frac{r(\epsilon e_i)}{\epsilon}.$$
The limit as $\epsilon\to 0$ of the second fraction is zero, and the first fraction is always less than or equal to zero. Thus $f'(x_0)e_i\leq 0$.
I'll leave it to you to fill in the other inequality, and to see why this implies the result.
A: HINT: Can you reduce to the one-dimensional result in an obvious way? Alternatively, if $f'(x_0)\ne 0$, could you pick $h\ne 0$ (but still going to $0$ in magnitude) that would lead to a contradiction? 
A: Clearly all partial derivatives of $f$ at $x_0$ (which exist by the differentiability of $f$) are $0,$ just from one variable calculus. Thus $\nabla f(x_0) =(0,0,\dots, 0).$ Since $f'(x_0)$  is given by the dot product with $\nabla f(x_0),$ $f'(x_0)$ is the zero map.
A: First note that $f'(x_0)$ can be interpreted as a $1\times n$ matrix, with $D_if(x_0)$ in the $i$-th row.
So $f'(x_0)=0$ iff $D_if(x_0) = 0$ for all $i$, which must be true since $f$, as a function of each of the components of $x_0$, has a maximum at that point.
A: Since $x_0$ is a local max then $  f(x_0+h)-f(x_0) = h \nabla f (x_0) + r(h)  \le 0$ for enough small $h$. Now take $h = t  \nabla f (x_0)$ then by dividing both sides by $t > 0$ we'll get 
$$  \frac{ f(x_0+h)-f(x_0) }{t} = \left \| \nabla f (x_0) \right \|^2 +\frac{r(t)}{t}  \le 0$$
as $t \rightarrow 0^+ $ then $LHS \rightarrow \left \| \nabla f (x_0) \right \|^2$ Therfore $\left \| \nabla f (x_0) \right \|^2 \le0$ which implies $\left \| \nabla f (x_0) \right \|^2 = 0$
