# If $g$ is differentiable, how can we show that $z\mapsto1\wedge e^{g(z)}$ is differentiable except on a countable set

If $$g:\mathbb R\to\mathbb R$$ is differentiable, how can we show that $$h(z):=\min\left(1,e^{g(z)}\right)\;\;\;\text{for }z\in\mathbb R$$ is also differentiable, except at a countable number of points, with derivative given Lebesgue almost everywhere by the function $$z\ni\mathbb R\mapsto\begin{cases}g'(z)e^{g(z)}&\text{, if }g(z)<0\\0&\text{, if }g(z)\ge0\end{cases}?\tag1$$

It's clear to me that $$\min:\mathbb R^2\to\mathbb R$$ is partially differentiable in both arguments, except on the diagonal $$\Delta:=\left\{(x,x):x\in\mathbb R\right\}$$ (which clearly has Lebesgue measure $$0$$). However, it's not clear to me why $$h$$ is differentiable except on a countable set.

Remark 1: I'm aware of Rademacher's theorem, which yields that $$\mathbb R\ni x\mapsto\min(1,e^x)$$ is differentiable Lebesgue almost everywhere (noting that this function is Lipschitz continuous). But this doesn't immediately yield that the derivative of $$h$$ is as claimed and it doesn't yield that the null set is countable.

Remark 2: We may note that the Lipschitz continuity implies absolutely continuity. So, maybe this is related to this Wikipedia entry: https://en.wikipedia.org/wiki/Absolute_continuity#Equivalent_definitions. But again, this result seems only to yield Lebesgue almost everywhere differentiability, but not the concrete shape of the derivative.

EDIT: We know that $$\frac{\rm d}{{\rm d}x}\min(1,e^x)=\left.\begin{cases}e^x&\text{, if }x<0\\0&\text{, if }x>0\end{cases}\right\}\;\;\;\text{for all }x\in\mathbb R.\tag2$$ So, the problematic set seems to be $$\left\{x\in\mathbb R:g(x)=0\right\}$$, which doesn't need to be countable ... The claim can be found here on page 12.

Yes, it is true. Since $$2\min(a,b)=a+b-|b-a|$$ for positive numbers $$a,b$$, and $$F(z)=e^{g(z)}-1$$ is differentiable, it suffices to prove that $$|F|$$ is differentiable except at a countable set of points. Namely, this exceptional set is a set of isolated zeroes of $$F$$ (or, better to say, a subset of the set of isolated zeroes). Indeed, if $$F(x)\ne 0$$, of course $$|F|$$ is differentiable at $$x$$. If $$F(x)=0$$ and $$F'(x)=0$$, then $$(|F|)'(x)=0$$, since $$|F(x+t)|-|F(x)|=|0+o(t)|-|0|=o(t)$$ for small $$t$$. All points which remain are isolated zeroes of $$h$$, there are at most countably many of them.
• Thank you for your answer. Let me note that the symbol $h$ is already used in the question. So, it is a bit unfortunate that you use it for $z\mapsto e^{g(z)}-1$. – 0xbadf00d May 1 '19 at 13:40
• You have shown that $$N:=\left\{a\in\mathbb R:f(a)=0\text{ and }f'(a)\ne0\right\}$$ is countable and $h$ is differentiable at $a$ with $$h'(a)=\begin{cases}e^{g(a)}g'(a)&\text{, if }g(a)<0\\0&\text{, if }g(a)>0\\0&\text{, if }g(a)=0\text{ and }g'(a)=0\end{cases}$$ for all $a\in\mathbb R\setminus N$. What can we say about the second derivative? It's clear that $$h''(a)=\begin{cases}e^{g(a)}\left(\left|g'(a)\right|^2+g'(a)\right)&\text{, if }g(a)<0\\0&\text{, if }g(a)>0\end{cases}$$ for all $a\in\mathbb R$ though. – 0xbadf00d May 1 '19 at 15:14
• I've asked for that separately here: math.stackexchange.com/q/3209891/47771. It would be enough for me if the set on which $|h|$ is twice differentiable has Lebesgue measure $0$. – 0xbadf00d May 1 '19 at 19:21