# Local minimum has neighbourhood with positive semi-definite Hessian?

I know that any local minimum $x_0$ of a (twice continuously differentiable) function $f : \mathbb{R}^n \rightarrow \mathbb{R}$ has positive semi-definite Hessian $H(x_0) \succeq 0$. Can we say moreover that there exists a neighbourhood $U$ of $x_0$ such that $$H(x) \succeq 0$$ for all $x \in U$? I don't see any reason for this being true since positive semi-definiteness is not a continuous property (while positive definiteness is), but can't find a counter-example.

Edit: Follow-up posted here.

• I would think of an example of the form $f(x)=x^2\sin^2(1/x)$ or something like that. This has a global minimum at $0$, and I expect the second derivative to oscillate wildly in any neighborhood. – Giuseppe Negro Jul 11 '18 at 15:04
• The second derivative does not exist at the origin. I added this condition in the question for clarity. – Nao Jul 11 '18 at 15:10
• Yeah, of course. I mean, I would consider a modification of that example, it is just a conjecture and not an answer. Try putting $x^4$ instead of $x^2$ – Giuseppe Negro Jul 11 '18 at 15:24
• Your intuition was right Giuseppe...! – Nao Jul 11 '18 at 16:22
• Thanks, but I didn't do anything, all credit goes to Will Jagy. – Giuseppe Negro Jul 11 '18 at 16:31

No. Take$$\begin{array}{rccc}f\colon&\mathbb{R}&\longrightarrow&\mathbb R\\&x&\mapsto&\begin{cases}x^4\left(2+\sin\left(\frac1x\right)\right)&\text{ if }x\neq0\\0&\text{ otherwise.}\end{cases}\end{array}$$Then $f$ is twice differentiable, it has a local minimum at $0$ and $f''(0)=0$. But there are critical points $x_0$ of $f$ as close as you wish from $0$ such that $f''(x_0)<0$.
$$e^{ \left(\frac{-1}{x^2} \right)} \; \sin^2 \left(\frac{1}{x^2} \right)$$
is $C^\infty$