# Supremum of a smooth function is smooth

I'm fairly sure that this is an easy question, but I can't quite prove my suspicions.

For $f\in\mathbf{C}^\infty(\mathbf{R})$, let $g(t):=\sup_{t\leq x} f(x)$. Then $g\in\mathbf{C}^\infty(\mathbf{R})$.

I want to say that this is true, but I'm unable to fully justify it. In my mind, I'm effectively viewing $g$ as a smooth step function that always increases, moving from one hill of $f$ to the next higher hill of $f$ as $t$ increases. $g$ moves from that earlier hill to the next hill with $f$ (aka smoothly), so the only possible points where $g$ can be not smooth are the points $\{x \mid f(x)=\max_{t\leq x}{f(t)}, f'(x)=0, f''(x)<0\}$. These are the points where $g(x)$ stops following $f(x)$ and instead is the zero function until $f(x)$ "catches up" again, heading for the next higher hill.

However, when I try and construct a proof for why these points cannot be true for contradiction, I can't get anywhere. Can anyone give me a counterexample, or some hint for how to prove this?

This is pretty clearly not true. Consider for example the map $$f(x) = e^x\sin(x).$$ However, the statement becomes true if you replace $C^\infty$ by $C^0$ everywhere, or by piecewise $C^\infty$ (at least under the mild assumption that the set of critical points of $f(x)$ is discrete).

As remarked in the comments, this only makes sense when $f(x)$ is bounded above as $x\to-\infty$.

The reason for the "piecewise continuous" part is the following: We all have agreed that $g(t)$ is continuous. Let $t_0\in\mathbb{R}$, then we have three possible cases:

1. If $f(t_0)<\max_{x\le t_0}f(x)$, then by continuity of $f(x)$ we know that this remains true in a small neighborhood of $t$. Therefore, $g(t)$ is constant in said neighborhood, and in particular locally smooth.
2. If $f(t_0)=\max_{x\le t_0}f(x)$ and it is either a local maximum, or $f(t_0)=g(t_0)$ and for all $\epsilon>0$ small enough we have that $f(t-\epsilon)<g(t-\epsilon)$ (i.e. a point where $f$ "joins up" with $g$), then the $g(t)$ might be non-smooth at $t_0$. Notice that these points must be isolated (or we could have a piece where $f$ is maximal but constant, which gives us a smooth piece and thus no problems).
3. The remaining case is when $f(t) = g(t)$ in a small neighborhood of $t_0$. Here, $g(t)$ is of course automatically smooth as $f(x)$ is.
• Thank you for the example - I was oblivious to the potential discontinuity of the derivative at the point at which $f(x)$ catches up to the constant $g(x)$. Sep 13, 2016 at 5:05
• Depending on whether you have $t \le x$ or $x \le t$ as subscript, is it not a problem that the supremum can be $+\infty$? I see no assumption that $f$ be bounded. Also, can you elaborate on how you know it is true for the piecewise $C^\infty$ case? Sep 13, 2016 at 9:14
• @JeppeStigNielsen Here you go. Sep 13, 2016 at 16:31
• As long as there exists no modification of the topologist's sine curve or the Weierstrass function or similar pathological example for which the points are not isolated. Sep 13, 2016 at 20:32
• @JeppeStigNielsen Right, but if we ask for $f(x)$ to be smooth on the whole real line I think this kind of problems doesn't appear. Sep 13, 2016 at 20:52