Is a smooth function convex near a local minimum? I would like to know if every sufficiently differentiable function is convex near a local minimum. The background to my question is that I became curious if one could motivate the usefulness of convex optimization techniques by saying that at least locally they work for all continuous functions.
Unfortunately I discovered there are $C^1$-functions which have  minima where they are not locally convex. But my construction involves the use of everywhere non-differentiable continuous functions so I started to wonder if perhaps $C^2$-functions are convex near a local minimum. 
 A: No, this isn't true. Let $\phi(x)$ be a nonnegative smooth "bump" function that is zero except on $(0,1)$ where it is positive. Then $\psi(x) = \sin^2({1 \over x})\phi(x)$ is a smooth nonnegative function (define $\psi(0) = 0$) which has zeroes at $x = {1 \over k\pi}$ for positive integers $k$ but is positive between these zeroes. $\psi(x)$ will still have a local minimum at zero because $\psi(0) = 0$, but because of the humps in $\psi(x)$ between zeroes, a chord connecting $({1 \over k\pi},0)$ to $({1 \over (k +1)\pi},0)$ will lie below the graph. So $\psi(x)$ is not convex.
I should add that if $x_0$ is a local minimum of $f(x)$ such that $f^{(l)}(x_0)$ is nonzero for some $l > 0$, then it will be convex on some interval centered at $x_0$ as long as $f(x)$ is $C^{l+1}$. To see this, note that without loss of generality we may assume $l$ is minimal. By Taylor expanding one gets
$$f(x) = {1 \over l!} f^{(l)}(x_0)(x - x_0)^l + O((x - x_0)^{l+1})$$
If $|x - x_0|$ is sufficiently small the remainder term will be dominated by the ${1 \over l!} f^{(l)}(x_0)(x - x_0)^l$ term. Thus the only way a local minimum can occur is if $l$ is even and $f^{(l)}(x_0) > 0$. Next note that the second derivative of $f$ has Taylor expansion given by
$${d^2 f \over dx^2} = {1 \over (l-2)!} f^{(l)}(x_0)(x - x_0)^{l-2} + O((x - x_0)^{l-1})$$
The remainder term is domninated by the first term once again, which is nonnegative on an interval containing $x_0$ since $l$ is even and $f^{(l)}(x_0) > 0$. Thus the second derivative of $f$ is nonnegative on this interval and therefore the function is convex there. 
A: I would just like to point out an elementary counterexample that satisfies most desirable properties. In particular, this example shows the issue is neither smoothness nor the fact the minimum is not an isolated critical point. Consider then $f \colon (x,y) \in \mathbb R^2 \longmapsto x^2y^2 + (x+y)^2$. Clearly $f$ is $\mathcal C^\infty$, furthermore $f(x,y) > 0$ for all $(x,y) \neq 0$ while $f(0,0) = 0$. Its gradient is,
\begin{equation}
\nabla f(x,y) = \begin{bmatrix}
2xy^2 + 2(x+y) \\ 2x^2y + 2(x+y)
\end{bmatrix}.
\end{equation}
If it vanishes, $xy^2 = x^2y$, that is either $x=0$ but then $y=0$, or $y=0$ but then $x=0$, or $x=y$ in which case $x^3+2x=x(x^2+2)=0$ that is $x=y=0$ as well. This establishes that $f$ has a unique critical point which is its global minimum, $(0,0)$.
Despite all these properties,
\begin{equation}
\begin{bmatrix}1\\-1\end{bmatrix}
\nabla^2f(x,x)
\begin{bmatrix}1\\-1\end{bmatrix}
= - 4x^2 < 0,
\end{equation}
for all $x \neq 0$, therefore there exists no neighborhood of $(0,0)$ on which $f$ is convex.
There is a related question here that has not been resolved, the hypotheses are stronger and this particular counterexample fails to satisfy them.
A: Say we have y  = f(x1,x2,..) for (x1,x2,,) at least two dimensions.
We can construct smooth f such that f(x,0,0..) = a x^2  , f(0,x,0..) = a x^2 ,
and   f(x,x,0..) = b x^2
In other words a smooth pinch.
If we take a chord between (x,0,..) and (0,x,..) then f = a x^2 at the ends. The midpoint is (x,x,..)/sqrt(2), and f = b x^2 / sqrt(2)  
So f is not convex if b x^2 / sqrt(2) > a x^2  , or   b > sqrt(2) a , which is easily satisifed.
So, a smooth minimum does not have to be convex.
