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.

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

Consider the function $$ f(x)=\begin{cases} x & \textrm{if } x \textrm{ is rational} \\ -x & \textrm{if } x \textrm{ is irrational} \end{cases} $$ It is well-known that $f(x)$ is continuous at $x=0$, and discontinuous everywhere else. Now, let's consider the modified function: $$ g(x)=\begin{cases} x^3 & \textrm{if } x \textrm{ is rational} \\ -x^3 & \textrm{if } x \textrm{ is irrational} \end{cases} $$ Then, $g(x)$ will be again continuous at $x=0$. But I am wondering:

Is $g(x)$ differentiable at $x=0$?

I think the answer might be 'yes', because by introducing the higher power $x^3$, we have "smoothed out" the behaviour of the function around the origin. On the other hand, the function looks too pathological to admit any points of differentiability.

share|cite|improve this question
Can you compute $\lim_{h\rightarrow0}{g(h)\over h} $? – David Mitra Dec 22 '13 at 12:43
Differnciability requires continuity at least in some open interval, otherwise it is impossible. The whole deffinition of a derivative at point $c$ is that the we look at the quaotient dY/dX at some open neighbourhood – Belov Dec 22 '13 at 12:45
Indeed $\pm x^2$ would have worked as well – Hagen von Eitzen Dec 22 '13 at 12:45
@DavidMitra: I can! Regardless of whether $h$ is rational or irrational, the limit is 0. Wow it is that simple! – Prism Dec 22 '13 at 12:45
@Belov Your first statement is not true for differentiability at a point, as the example of the OP shows. – David Mitra Dec 22 '13 at 12:46
up vote 3 down vote accepted

For all $x\neq 0$ the following holds:

$$\dfrac{g(x)-g(0)}{x-0}=\dfrac {g(x)}x=\begin{cases} x^2, &\text{if }x\in \mathbb Q\\ -x^2, &\text{if }x\not \in \mathbb Q\end{cases},$$

therefore $$\lim \limits_{x\to 0}\left(\dfrac{g(x)-g(0)}{x-0}\right)=\underline ?$$ and $g'(0)=\underline ?$.

share|cite|improve this answer
Thanks… Now I feel stupid :) – Prism Dec 22 '13 at 12:46
That is not correct as the limit there tends to 0, but the function still does not have a derivative. – Belov Dec 22 '13 at 12:46
@Belov What definitions are you using? – Git Gud Dec 22 '13 at 12:47
@Belov Of course it has, though only at $x=0$. – Hagen von Eitzen Dec 22 '13 at 12:47
I use the following definition: A derivative is that quotient of a function at point $c$ if the function is continous at some open neighbourhood of $c$ PS: I'll get my analysis old textbook, I might be wrong. – Belov Dec 22 '13 at 12:54

It's easy to prove that for every real valued function $f$, defined on an non-degenerated open interval containing $0$, which is continuos in $0$, the function $x\cdot f(x)$ is differentiable in $0$.

share|cite|improve this answer
Indeed, $\displaystyle \lim_{x\to 0} \frac{xf(x)-0f(0)}{x-0}=\lim_{x\to 0} f(x) = f(0)$ which exists by continuity of $f$. Thanks for the general fact! – Prism Dec 22 '13 at 13:01
You're welcome. It follows that if $f$ is only bounded, that $x^2f(x)$ is differentiable at $0$. – Michael Hoppe Dec 22 '13 at 13:04

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.