# Difference of convex functions with many oscillations (looking for examples)

It is known (see e.g. here [pdf]) that any function $$f: \mathbb{R} -> \mathbb{R}$$ with locally bounded left- and right derivatives can be represented as a difference of convex functions. Consequently, there must exist convex functions $$f$$ and $$g$$, such that the difference $$h = f - g$$ is (perhaps counter-intuitively) a highly oscillating function with arbitrary many local maxima and minima. My question is: Are there any nice explicit examples of functions $$f, g$$ and $$h = f-g$$ with these properties?

• Something like $\sin(nx)=(\sin(nx)+n^2x^2)-n^2x^2$ for any $n$?
– Gerd
Commented Sep 13, 2023 at 8:04
• Simple and does the job, thanks! You could post it as an answer.
– MKR
Commented Sep 13, 2023 at 9:37
• OK, I will post ist.
– Gerd
Commented Sep 13, 2023 at 9:43

For any $$n \in \mathbb{N}$$ the fucnctions $$f(x)=\sin(nx)+n^2x^2$$ and $$g(x)=n^2x^2$$ are convex (as the second derivative is $$> 0$$) and $$\sin(nx)= f(x)-g(x)$$ has arbitrarily many local maxima and minima.