Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are there two continuous functions ( $f:R^n\to R$, $g:R\to R$ ) which are not differentiable at point $0$, but if you compose them, $h=g(f(x))$ is differentiable at $0$? ($f(0)=0$)

share|cite|improve this question
f is not differentiable in 0, and g is not differentiable in 0 (and f(0) = 0, so it's actually the same :-) – Reactormonk Apr 1 '11 at 20:56
Thank you. I'll delete my now irrelevant comments. – Jonas Meyer Apr 2 '11 at 4:18
up vote 4 down vote accepted

Let $f(x)=x$ when $x \ge 0$, and $f(x)=0$ when $x<0$. Let $g(x)=x$ when $x\le 0$, and $g(x)=0$ when $x>0$.

Then $g(f(x))$ is identically 0, and indeed so is $f(g(x))$.

share|cite|improve this answer

Let $f(x)=2x$ for $x\ge 0$ and $f(x)=x$ for $x\le 0$, and let $g$ be its inverse, given by $g(x)=x/2$ for $x\ge 0$ and $g(x)=x$ for $x\le 0$, so $g(f(x))=x$, but neither $g$ nor $f$ is differentiable at $0$.

share|cite|improve this answer
Really good answer, but I like the one of user6312 better, due to its simplicity :-) – Reactormonk Apr 3 '11 at 20:53

Let $f:\mathbb{R}^n\to\mathbb{R}$ be defined by $f(x)=\sqrt{x_1^2+x_2^2+\cdots+x_n^2}$, and let $g:\mathbb{R}\to\mathbb{R}$ be defined by $g(x)=x$ if $x<0$ and $g(x)=0$ if $x\geq 0$. Then $f$ and $g$ are continuous everywhere, not differentiable at $0$, $f(0)=0$, and $g(f(x))=0$ for all $x$.

For example, $f(x)=|x|$ when $n=1$. Note that $g(x)=-x^-$ is minus the "negative part" of $x$, which could also be written as $g(x)=\frac{1}{2}(x-|x|)$.

share|cite|improve this answer

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.