I'm working on a proof on my own, because I didn't like the proofs I found in the books. Can anyone help me checking whether it is correct or not?
Let $f: U\rightarrow \mathbb R$ be a $C^2$ function defined on the open set $U\subset \mathbb R^n$. Suppose $p\in U$ is such that $\nabla f(p)=0$ and
$$\langle Hf(p)\cdot v, v\rangle<0$$ for every $v\in \mathbb R^n\setminus\{0\}$, where
$$Hf(p)=\left(\frac{\partial^2 f}{\partial x_i \partial x_j}(p)\right)$$
is the Hessian matrix of $f$ at $p$. I'd like to show there is $\delta>0$ such that
$$f(x)<f(p)$$ for every $p\in B(x, \delta)\subset U$, that is, $p$ is a local maximum.
Well, since $U$ is open we can find $\delta_1>0$ such that $B(p, \delta_1)\subset U$. But then $f|_{B(p, \delta_1)}: B(p, \delta_1)\rightarrow \mathbb R$ is a $C^2$ function defined on the convex set $B(p, \delta_1)$. Hence, we are allowed to use Taylor expansion of second order, that is,
$$f(x)=f(p)+\langle\nabla f(p), x-p\rangle+\frac{1}{2}\langle Hf(p)\cdot (x-p), x-p\rangle+r_p(x)$$
for every $x\in B(p, \delta_1)$, and
$$\lim_{x\to p} \frac{r_p(x)}{\|x-p\|^2}=0.$$ Above, $\langle\cdot, \cdot\rangle$ stands for the usual inner product in $\mathbb R^n$ and $\|\cdot\|$ stands for the induced norm.
Since $\nabla f(p)=0$, the previous expansion yields
$$f(x)-f(p)=\frac{1}{2}\langle Hf(p)\cdot (x-p), x-p\rangle+r_p(x).$$
Now, since
$$\lim_{x\to p} \frac{r_p(x)}{\|x-p\|^2}=0$$
there is $\delta_2>0$ such that:
$$\|x-p\|<\delta_2\implies \frac{|r_p(x)|}{\|x-p\|^2}<-\max_{\|v\|=1}\langle H f(p)\cdot v, v\rangle.$$ Notice that $-\langle Hf(p)\cdot v, v\rangle>0$ for every $v\in\mathbb R^n\setminus\{0\}$, so the above makes sense.
Also, since $\lim_{x\to p} \frac{\|x-p\|^2}{2}=0$ there is $\delta_3>0$ such that
$$\|x-p\|<\delta_3\implies \frac{\|x-p\|^2}{2}<2\Rightarrow \frac{\|x-p\|^2}{2}-1<1.$$
Then, whenever $\|x-p\|<\min\{\delta_1, \delta_2, \delta_3\}$, it follows:
$$\begin{align*} f(x)-f(p)&=-\frac{\|x-p\|^2}{2}\cdot \left(-\langle H f(p)\cdot \frac{x-p}{\|x-p\|}, \frac{x-p}{\|x-p\|}\rangle\right)+\frac{r_p(x)}{\|x-p\|^2}\\ &\leq -\frac{\|x-p\|^2}{2}\min_{\|v\|=1}\left(-\langle H f(p)\cdot v, v\rangle\right)+\frac{|r_p(x)|}{\|x-p\|^2}\\ &<-\frac{\|x-p\|^2}{2}(-\max_{\|v\|=1}\langle H f(p)\cdot v, v\rangle)+(-\max_{\|v\|=1}\langle Hf(p)\cdot v, v\rangle)\\ &<\max_{\|v\|=1}\langle Hf(p)\cdot v, v\rangle \left(\frac{\|x-p\|^2}{2}-1\right)\\ &<\max_{\|v\|=1}\langle Hf(p)\cdot v, v\rangle\\ &<0. \end{align*}$$ Is the above proof correct?
Thanks.