If $h$ is twice differentiable, then $|h|$ is twice differentiable except on a countable set

Let $$h:\mathbb R\to\mathbb R$$ be differentiable. It can be shown that $$N:=\left\{a\in\mathbb R:h(a)=0\text{ and }h'(a)\ne0\right\}$$ is countable and $$|h|$$ is differentiable on $$\mathbb R\setminus N$$ with $$|h|'(a)=\begin{cases}\displaystyle\frac{h(a)}{\left|h(a)\right|}h'(a)&\text{, if }h(a)\ne0\\0&\text{, if }h'(a)=0\end{cases}\tag1$$ for all $$a\in\mathbb R$$.

Assuming $$h$$ is twice differentiable, can we show a similar statement for the second derivative of $$|h|$$, i.e. that there is a countable $$N'\subseteq\mathbb R$$ such that $$|h|$$ is twice differentiable on $$\mathbb R\setminus N'$$?

EDIT: It would be enough for me, if $$N'$$ can be shown to have Lebesgue measure $$0$$ (as opposed to being even countable). Moreover, if necessary, feel free to assume that $$h''$$ is continuous.

EDIT 2: We already know that $$|h|$$ is differentiable at $$a$$ with $$|h|'(a)=\operatorname{sgn}(h(a))h'(a)\tag5$$ for all $$a\in\left\{h\ne0\right\}\cup\left\{h'=0\right\}$$. Now, since $$h$$ is continuous, $$\operatorname{sgn}h$$ is differentiable at $$a$$ with $$(\operatorname{sgn}h)'(a)=0\tag6$$ for all $$a\in\left\{h\ne0\right\}\cup\left\{h=0\right\}^\circ$$ (see: Can we show differentiability of $\operatorname{sgn}h$ on a larger set than $\left\{h\ne0\right\}$?). Thus, by the chain rule, $$|h|$$ is twice differentiable at $$a$$ with $$|h|''(a)=\operatorname{sgn}(h(a))h''(a)\tag7$$ for all $$a\in\left\{h\ne0\right\}\cup\left\{h=0\right\}^\circ\cap\left\{h'=0\right\}$$. The complement of the latter set is $$N_0:=\left\{h=0\right\}\cap\left(\mathbb R\setminus\left\{h=0\right\}^\circ\cup\left\{h'\ne0\right\}\right)=\partial\left\{h=0\right\}\cup N.$$ However, since $$\partial\left\{h=0\right\}$$ doesn't need to have Lebesgue measure $$0$$ (please correct me if I'm wrong), we cannot conclude.

(Please take note of my related question: if $h$ is twice differentiable, what is the largest set on which $|h|$ is twice differentiable?.)

• Try using an analogous result applied to $|h|'$. May 1 '19 at 17:10
• @copper.hat Sure, I tried that. But it seems to be more complicated here. May 1 '19 at 17:11
• I'm not clear on what the"similar statement" should be.
– zhw.
May 1 '19 at 17:16
• @zhw. That there is a countable set $N'$ such that $|h|$ is twice differentiable on $\mathbb R\setminus N'$. May 1 '19 at 17:47
• @Jack Well, the formula is true for all $a\in\mathbb R$ since it is true for each case which is considered. Jul 8 '19 at 12:24

Let us assume $$h$$ twice differentiable.

Let $$N$$ be the set of isolated zeros of $$h$$. $$|h|$$ is differentiable on $$\mathbb{R}\backslash N$$, and $$|h|'(x) = sgn(h(x)) h'(x)$$ where the sgn function is $$0$$ on $$0$$, $$1$$ on the positive reals and $$-1$$ and the negative ones.

Let $$x_0 \in \mathbb{R}\backslash N$$. For $$x \in \mathbb{R} \backslash N$$,

$$|h|'(x) - |h|'(x_0) = sgn(h(x)) h'(x) - sgn(h(x_0)) h'(x_0)$$

Let us show that Newton's difference quotient has always a limit when $$x\rightarrow x_0$$, $$x\in \mathbb{R}\backslash N$$ (this is not rigorously equivalent to say that $$|h|'$$ is differentiable at $$x_0$$ since $$\mathbb{R} \backslash N$$ does not necessarily contain an open interval centered at $$x_0$$)

I will distinguish several cases.

• $$h(x_0) \neq 0$$. Then $$h(x)$$ has the same sign as $$h(x_0)$$ when $$x$$ close enough to $$x_0$$ and it is clear that the Newton's difference quotient converges to $$sgn(h(x_0)) h''(x_0)$$. Here, $$|h|'$$ is even rigorously differentiable at $$x_0$$.
• $$h(x_0) = 0$$ (so $$h'(x_0) = 0$$) and $$h$$ is of constant sign (in a large sense) near $$x_0$$, it is essentially the same situation.
• $$h(x_0)=0$$ (so $$h'(x_0) = 0$$) and $$h$$ has strict changes of sign in each interval centered at $$x_0$$. Then $$h''(x_0) = 0$$ (else, $$h$$ would have a local extrema at $$x_0$$, which contradicts the changes of sign). So we have a LD at order $$1$$ for $$h'$$ at $$x_0$$ : $$h'(x) = o( x-x_0)$$ So $$|h|'(x) - |h|'(x_0) = sgn(h(x))h'(x) = o(x-x_0)$$. So the Newton's difference quotient admits a limit, which is $$0$$ (but $$|h|'$$ is not rigorously differentiable as soon as $$x$$ in not the interior of $$\mathbb{R} \backslash N$$, i.e exactly when infinitely many sign changes of $$h$$ are made with non zeros first derivatives).

Note that $$|h|''(x) = sgn(h(x)) h''(x)$$.

Conlusion : Let $$N' = (\overline{N} \cap \{h'(x_0) = 0, h \text{ has infinite strict changes of sign near } x_0 \text{ with non zeros first derivatives}\}) \cup N$$. Let $$|h|'$$ is rigorously differentiable exactly on $$\mathbb{R} \backslash N'$$, but the Newton's difference quotients converges for all $$x_0 \in \mathbb{R} \backslash N$$. But there might be some real philosophical problem : the fact that the Newton's difference converges does not corresponds intuitively to the idea of differentiability (it ignores the "jumps" that can exists in the holes of the domain of definition, and is not compatible with LD of order $$\geq 2$$, see the counter example I give in About a $C^\infty$ extension of a function defined on a closed set (or a $C^\infty$- version of Tietze's extension theorem) ).

To understand better the situation, the following question should be raised : where is the singular loci of $$|h|''$$, interpreted as a distribution ? And what are the nature of the different singularities ?

Remark : it is possible to check that $$\overline{N}$$ can contain an arbitrary Cantor set contained in $$\mathbb{R}$$ (it's a bit technical, because of the intricated structure of the cantor set : the difficult part is to ensure that $$h$$ is two times differentiable). So it might be of positive measure... It is quite easy to ensure that $$N' = \overline{N}$$ in this case : just put non zero derivatives on all isolated zeros of $$h$$. The demonstration is a bit technical, so please tell me if it is necessary to make it.

EDIT : I've made several edits for the notations of this response ; don't pay attention too much attention of the notations in the commentaries.

• If you suppose $h(x)=0$, then (since $x\not\in N$) $h'(x)=0$. That's clear to me. But why $x$ is an accumulation point of $h^{-1}(\left\{0\right\})$? May 2 '19 at 5:13
• It seems like you're concluding $h''(x)=0$ from $h(x)=h'(x)=0$. This is obviously wrong (take for example $h(x)=x^2$ and $x=0$). May 2 '19 at 6:09
• By construction, $N$ is the set of the isolated zeros of $h$. So, the other zeros are the accumulations points of the zeros. By Rolle theorem, if $x$ is an accumululation point of the zeros of $h$, it is also an accumulation point of $h'$. By applying it a second time, it is the same for $h''$. This implies $h'(x) = h''(x) = 0$ ; you have also $|h|'(x) = 0$ (already known). I deduce from all this that $|h|''(x) = 0$ : you have a linear developpement of $|h|'(x) = o( (x-y) )$ at order 1. So $|h|''$ exists at $x$ and is $0$ May 2 '19 at 8:19
• Ok I understand, I mixed the notations with the link you've given. I've taken $N'$ = the set of isolated zeros of $h$. My $N'$ can be a little bigger than $N$, but it is still countable. May 2 '19 at 8:35
• To be precise, your $N$ is $\left\{x\in\mathbb R\mid\exists\varepsilon>0:B_\varepsilon(x)\cap h^{-1}(\left\{0\right\})=\left\{x\right\}\right\}$, right? May 2 '19 at 9:02

Suppose that $$h$$ is twice differentiable. Note that you already know that $$\bigl||h|'(x)\bigr|=|h'(x)|$$ for $$x\notin N:=\{\,x\in \Bbb R\mid h(x)=0,h'(x)\ne 0\,\}$$ (and that $$N$$ is countable).

Suppose $$h(a)=h'(a)=0$$, $$h''(a)=c>0$$. Then we have a local minimum at $$a$$, hence $$h(x)\ge0$$ on some interval $$(a-\epsilon,a+\epsilon)$$ and hence $$|h|=h$$ and $$|h|''=h''$$ there. Similarly, $$|h|''(a)=-h''(a)=|h''(a)|$$ if $$c<0$$. If $$c=0$$ and additionally $$a\notin \overline N$$, then we already know $$|h|'(a)=0$$ and have that $$\tag1\lim_{t\to0}\left|\frac{|h|'(a+t)-|h|'(a)|}{t}\right|=\lim_{t\to 0}\left|\frac{|h|'(a+t)}{t}\right|= \lim_{t\to 0}\left|\frac{h'(a+t)}{t}\right|=0$$ because $$\lim_{t\to 0}\frac{h'(a+t)}{t}=h''(a)=0$$ and we conclude that also $$|h|''(a)=0$$.

We conclude that $$|h|''(a)$$ can only fail to exist under some limited conditions, namely for $$a\in N$$ and for those $$a\in\overline N$$ where $$h''(a)=0$$ (and additionally $$h(a)=h'(a)=0$$). Specifically, let $$N_2=(\overline N\cap \{\,x\in\Bbb R\mid h(x)=h'(x)=h''(x)=0\,\})\cup N.$$ Let $$x\in\Bbb R\setminus N_2$$. Then one of the following cases treated above applies:

• $$h(x)\ne 0$$ $$\quad\implies\quad|h|''(x)=\operatorname{sgn}(h(x))h''(x)$$,
• or $$h(x)=h'(x)=0$$ and $$h''(x)\ne 0$$ $$\quad\implies\quad|h|''(x)=|h''(x)|$$,
• or $$h(x)=h'(x)=h''(x)=0$$, but $$x\notin \overline N$$ $$\quad\implies\quad|h|''(x)=0$$.

Note that we cannot say that $$N_2$$ is countable (or can we?), but at least it is nowhere dense ...

Can $$|h|''$$ exist for any point $$a\in N_2$$? Certainly not for $$a\in N$$ as then not even $$h'(a)$$ exists: From $$h(a)=0$$ it follows that $$\frac{|h|(x)-|h|(a)}{x-a}=\pm\frac{h(x)-h(a)}{x-a}$$, so at most $$|h|'(a)=\pm h'(a)$$ is possible, but on the other hand $$|h|$$ has a local minimum at $$a$$. So what about $$a$$ with $$h(a)=h'(a)=h''(a)=0$$ and there is a sequence $$a_n\to a$$ with $$h(a_n)=0$$, $$h'(a_n)\ne 0$$? Then as just said, $$|h|'(a_n)$$ does not exist. Hence there is no open neighbourhood of $$a$$ where $$|h|'$$ is defined. Hence the ordinariy definition of derivative is not applicable.

At best, a one-sided derivative of $$|h|'$$ can exist. In that case, we can just write $$t\to 0^+$$ or $$t\to 0^-$$ in $$(1)$$ and still obtain the (one-sided) derivative $$|h|''(a)=0$$. But keep in mind that even this is valid only if $$a$$ is only a one-sided limit of points in $$N$$, that is, we must have that one of $$[a,a+\epsilon)$$, $$(a-\epsilon,a]$$ is disjoint from $$N$$.

• Could you elaborate on $|h|'(x)=|h'(x)|$ for all $x\not\in N$? You seem to assume that $h(x)$ and $h'(x)$ have the same sign. May 1 '19 at 18:19
• @0xbadf00d Sorry, there was yet another absolute value missing. May 1 '19 at 18:36
• Ah, okay. Thought I would miss something. May 1 '19 at 18:38
• If we apply the chain rule to the result that $|h|$ is differentiable on $\{h=0\}\cap\{h'=0\}$ with derivative $h'\operatorname{sgn}h$, we obtain that $|h|$ is twice differentiable on $\{h\ne0\}\cup\{h=0\}^\circ\cap\{h'=0\}$ with derivative $h''\operatorname{sgn}h$. Is this stronger or weaker than your result? Jun 30 '19 at 13:02
• Oh, and I can't follow your reasoning for the definition of $N_2$. You've shown that $|h|'$ is differentiable at $a$ with $|h|''(a)=|h''(a)|$ for all $a\in D:=\{h=0\}\cap\{h'=0\}\cap(\{h''\ne0\}\cup\{h''=0\}\cap\mathbb R\setminus\overline N)$. The complement of this set is $\mathbb R\setminus D=\{h\ne0\}\cup\{h'\ne0\}\cup(\{h''=0\}\cap\overline N)$ which is not equal to $N_2$. What am I missing? Jun 30 '19 at 15:32