# does there exist a smooth function which is nowhere convex/concave?

Consider $$g\in {\rm C}^1[0,1]$$. We say that $$g$$ is nowhere convex (concave, resp.) on $$[0,1]$$ if there is no open interval $$I\subseteq [0,1]$$ on which $$g$$ is convex (concave, resp.) Is it possible to find a function $$g$$ which satisfies:

Q1.(strong verison) $$g$$ is $${\rm C}^2[0,1]$$ and $$g$$ is nowhere convex and nowhere concave on $$[0,1]$$?

Q2.(weak version) $$g$$ is twice differentiable on $$(0,1)$$ and $$g$$ is nowhere convex and nowhere concave on $$[0,1]$$?

I suspect that the answer to Q1 is no, and that the answer to Q2 is yes, but I am not exactly sure how to prove it. The question may be related to questions about sets of zeros of the first (or, equivalently, the second) derivative of $$g$$. By Whitney's Theorem, we can find $${\rm C}^{\infty}$$-function whose first (or equivalently, second) derivative vanishes exactly on any given compact subset of $$[0,1]$$.

https://mathoverflow.net/questions/179445/non-zero-smooth-functions-vanishing-on-a-cantor-set

There are examples which show that $$g'$$ can be zero on the set $${\bf Q}\cap [0,1]$$,

Set of zeroes of the derivative of a pathological function

so the elementary sufficient condition $$g''>0$$ for strict convexity does not apply in our case because every open interval contains at least one rational point. This however, in my view, does not discount the possibility that $$g$$ is (not necessarily strictly) convex in such intervals (g'' can occasionally be zero, and g still can be convex). Also, Darboux property of $$g''$$:

Is intermediate value property equivalent to Darboux property?

or existence of nowhere monotone continuous function $$g'$$ may be related to the answer:

Suppose a continuous function $$f:\mathbb{R} \rightarrow \mathbb{R}$$ is nowhere monotone. Show that there exists a local minimum for each interval.

the point here being that a point of strict inflection of $$g$$ is exactly the point of strict local extremum of $$g'$$,

Does there exist a continuous function from [0,1] to R that has uncountably many local maxima?

but I am not sure whether we can use the same argument if we consider general inflection point of $$g$$ (i.e., non-strict local extremum of $$g'$$).

• A differentiable function is convex on an interval iff its derivative is increasing, that should be of help. By the way, $\mathbb Q\cap[0,1]$ is not compact. – Wojowu Dec 6 '18 at 14:57
• I don't have time to think about this now, but maybe something I wrote in this 14 June 2001 ap-calculus post archived at Math Forum will help. – Dave L. Renfro Dec 6 '18 at 16:05
• It appears that all the results I state in that 2001 post start from the assumption of convexity and then ask how well behaved MUST the function be and how pathological CAN the function be, but you're starting from convexity at no point and asking how well behaved CAN the function be. Maybe the references I give in that post will be of use. I'd recommend looking at Garg's book, because if it's known at all, it's probably there, although it's likely to be in such a specialized-general way that you might have difficultly recognizing it. – Dave L. Renfro Dec 6 '18 at 16:18
• @Wojowu: Yes, we can use such characterisation of convexity. Since there exist everywhere differentiable and nowhere monotone function mathoverflow.net/questions/167323/… we can integrate it, and we get nowhere convex and nowhere concave function of class ${\rm C}^1$. But the quaestion still remains: can we have such twice differentiable or even ${\rm C}^2$ function? – Andrija Dec 6 '18 at 18:27
• @Wojowu: I made the statement about ${\rm Q}\cap [0,1]$ more precise. – Andrija Dec 6 '18 at 18:32

Q1: The answer is no. If $$g''(a)>0$$ for some $$a\in [0,1],$$ then $$g''>0$$ in a neighborhood of $$a$$ by the continuity of $$g''.$$ Hence $$g$$ is strictly convex in that neighborhood. Similarly, if $$g''(a)<0$$ for some $$a\in [0,1],$$ then $$g$$ is strictly concave in that neighborhood. We're left with the case $$f''\equiv 0.$$ But this implies $$f(x) = ax +b$$ on $$[0,1],$$ hence $$f$$ is both convex and concave everywhere on $$[0,1].$$

Added later, in answer to the comment: It's actually possible for a $$C^2$$ function to have uncountably many inflection points. Suppose $$K\subset [0,1]$$ is uncountable, compact, and has no interior (the Cantor set is an example). Define

$$f(x)=\begin{cases}d(x,K)\sin (1/d(x,K)),&x\notin K\\ 0,& x\in K\end{cases}$$ Then $$f$$ is continuous, and $$f$$ takes on positive and negative values on any interval containing a point of $$K.$$ Define

$$g(x)=\int_0^x\int_0^t f(s)\,ds\,dt.$$

Then $$g\in C^2[0,1]$$ and $$g''=f.$$ It follows that every point of $$K$$ is an inflection point of $$g.$$

• Thanks a lot. Q1 and Q2 are very different cases, though. If I may ask you: Do you agree that, as a consequence of Q1, every ${\rm C}^2[0,1]$-function is convex/concave on $(0,1)$, with at most countably many convexity/concavity intervals, and at most countably many inflection points? This sounds obvious to me. Is it really so? – Andrija Dec 6 '18 at 19:42
• I thank you again. This is a very good example. Just to be safe, here by "an inflection point", we mean the point in which the tangent line intersects the graph of ${\rm C}^1$-function, see en.wikipedia.org/wiki/Inflection_point – Andrija Dec 9 '18 at 11:06
• Yes you're right. In every interval containing a point of $K,$ my example exhibits strict convexity somewhere, and strict concavity somewhere. I guess that doesn't show every point of $K$ is an inflection point. Let me think about this. – zhw. Dec 9 '18 at 23:43