Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Apologies for what's probably a dumb question from the perspective of someone who paid better attention in real analysis class.

Let $I \subseteq \mathbb{R}$ be an interval and $f : I \to \mathbb{R}$ be a continuous function such that $f^2$ is differentiable. It follows by elementary calculus that $f$ is differentiable wherever it is nonzero. However, considering for instance $f(x) = |x|$ shows that $f$ is not necessarily differentiable at its zeroes.

Can the situation with $f$ be any worse than a countable set of isolated singularities looking like the one that $f(x) = |x|$ has at the origin?

share|improve this question
Since $f$ is continuous, the set of points where $f$ is nonzero is open. In particular any point at which $f$ is nonzero lives on an open interval where $f$ is nonzero, and we can apply the chain rule on that neighborhood. –  Daniel McLaury Jun 10 '13 at 12:01
(Though to be fair I suppose the topology of the real line is probably beyond the scope of elementary calculus as well...) –  Daniel McLaury Jun 10 '13 at 12:09
how can you apply the chain rule if you don't know that $f$ is differentiable? –  Ittay Weiss Jun 10 '13 at 12:11
Both $f^2$ and $\sqrt{\phantom{-}}$ are differentiable on the appropriate neighborhoods, so their composition is as well. Perhaps calling this "the chain rule" isn't necessary, but texts often specify that this statement is part of the the chain rule: "The derivative exists, AND is equal to..." –  Daniel McLaury Jun 10 '13 at 12:26
Yes. $x\mapsto |x|^{1+\epsilon}$ is differentiable near zero. So another option is that $f$ looks locally like $x \mapsto |x|^{\frac12 + \delta}$ for any $\delta > 0$. These form cups at your singular points, which are in some sense worse than the Lipschitz $|x|$. –  Willie Wong Jun 10 '13 at 12:51

3 Answers 3

up vote 3 down vote accepted

I'd try something along these lines:

if we consider $K$ - Cantor set on $[0,1]$ and $f(x)=\inf_{y\in K} |x-y|$. This function is continuous and has a continuum of zeros: $f^{-1}(0)=K$. The only question is whether $f^2$ is everywhere differentiable. The intuition suggests that up to some tinkering with the definition of $f$ that it is.

Edit. reflected the result from my comment below.

share|improve this answer
Can you explain the intuition that suggests that $f^2$ is differentiable? I have a very hard time picturing what it looks like. –  Daniel McLaury Jun 10 '13 at 12:05
@DanielMcLaury As a warning: none of this is formal. Let's take $x\in K^c$ and $y_{1,2}\in K$ such that $y_1<x<y_2$ and $(y_1,y_2)\cap K=\emptyset$; we can take it because $K$ is nowhere dense. Then $f(x)$ on $[y_1,y_2]$ looks like a hat (try to draw a picture): $f(x) = \min(|x-y_1|,|x-y_2|)$. Hence, we have a problem in $x_\ast\in (y_1+y_2)/2$, but we can adjust $f$ there a little bit to preserve differentiability, thanks to $f(x_\ast)>0$. –  TZakrevskiy Jun 10 '13 at 12:23
So the idea is that we may even need to make $f$ differentiable at $x_\ast = (y_1 + y_2)/2$ in order to make $f^2$ differentiable there, but that at any rate $f$ will still be non-differentiable at $y_1$ and $y_2$ ? –  Daniel McLaury Jun 10 '13 at 12:51
@Landscape: I don't think that $f^2$ is clearly differentiable on $I$. Consider $x = 1/2$, $r = 1/6$. Then as you say $f(y) = 1/6 - |y - 1/2|$, so its square on $I$ looks like this: wolframalpha.com/input/… In particular it's not going to be differentiable at $y = x$, as TZakrevskiy pointed out above, so we'd need to modify $f$ at these points to make things work. –  Daniel McLaury Jun 10 '13 at 13:16
However it doesn't appear to be a problem to fix that issue by modifying $f$ away from the points of $K$, so I believe this example works. –  Daniel McLaury Jun 10 '13 at 13:20

To expand on TZakrevskiy's answer, we can use one of the intermediate lemmas from the proof of Whitney extension theorem.

Theorem (Existence of regularised distance) Let $E$ be an arbitrary closed set in $\mathbb{R}^d$. There exists a function $f$, continuous on $\mathbb{R}^d$, and smooth on $\mathbb{R}^d\setminus E$, a large constant $C$, and a family of large constants $B_\alpha$ ($C$ and $B_\alpha$ being independent of the choice of the function $f$) such that

  1. $C^{-1} f(x) \leq \mathrm{dist}(x,E)\leq Cf(x)$
  2. $|\partial^\alpha f(x)| \leq B_\alpha~ \mathrm{dist}(x,E)^{1 - |\alpha|}$ for any multi-index $\alpha$.

(See, for example, Chapter VI of Stein's Singular Integrals and Differentiability Properties of Functions.)

Property 1 ensures that if $x\in \partial E$ the boundary, $f$ is not differentiable at $x$. On the other hand, it also ensures that $f^2$ is differentiable on $E$. Property 2, in particular, guarantees that $f^2$ is differentiable away from $E$.

So we obtain

Corollary Let $E\subset \mathbb{R}^d$ be an arbitrary closed set with empty interior, then there exists a function $f$ such that $f^2$ is differentiable on $\mathbb{R}^d$, $f$ vanishes precisely on $E$, and $f$ is not differentiable on $E$.

share|improve this answer

$f(x)=-x$ if $x$ is in $\mathbb{Q}$

$f(x)=x$ if $x$ is in $\mathbb{R}$ \ $\mathbb{Q}$


$f^{2}(x) =x^{2}$ in $\mathbb{R}$

As it is not continuous (except 0 maybe), it is not differentiable.

share|improve this answer
This is why I included the condition that $f$ is continuous. –  Daniel McLaury Jun 10 '13 at 12:02
One problem, though, your function $f$ is not continuous, as the author asked. –  TZakrevskiy Jun 10 '13 at 12:02
such an $f$ is not continuous, but it's assumed in the question that $f$ is continuous. –  Ittay Weiss Jun 10 '13 at 12:03
Ok so the answer will probably come from fractal. My apologies. –  lmorin Jun 10 '13 at 12:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.