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

How I can calculate the derivative of $$f(x) = \left\{ \begin{gathered} {x^2}\quad,\quad{\text{if}}\quad x \in \mathbb{Q} \\ {x^3}\quad,\quad{\text{if}}\quad x \notin \mathbb{Q} \\ \end{gathered} \right.$$ at some $x\in \mathbb{R}$?

share|cite|improve this question
There are actually two points where this function is continuous: the two points where the graphs of the cubic and quadratic functions intersect. But it's differentiable at only one of them. – Michael Hardy Aug 11 '11 at 19:41
Exactly. I've seen it. – mathsalomon Aug 12 '11 at 15:41


The derivative exists if $\lim _{y \to x} \dfrac{f(y) - f(x)}{y - x}$ exists. Of course, a limit must be the same along any Cauchy sequence. So at what points does the derivative even exist? (it does exist somewhere)

share|cite|improve this answer
Thanks for the reply, but how can calculate such a limit?. If you only know where the variable estimate limits on the numbers approaching real. – mathsalomon Aug 11 '11 at 6:25
@mathsalomon For example, suppose we wanted to calculate it at $x = 2$. Then on irrationals, the limit is 4. On the irrationals, the limit is 12. They're not equal, so it's not differentiable at 2. – mixedmath Aug 11 '11 at 6:27
oh, I see, sounds reasonable. thank you very much. – mathsalomon Aug 11 '11 at 6:37

The first helpful information to look for is if your function is continuous at any $x$. After all, a function does not have a well-defined derivative where it isn't continuous.

Then, analyze those points where it is continuous. Does it have a derivative there? A hint is that there is always a rational point in between two real numbers (that aren't equal) and that there's always an irrational point in between two real numbers (again, nonequal).

share|cite|improve this answer
I think your very good suggestion, I think I will do so. thanks. – mathsalomon Aug 11 '11 at 6:29

What makes you think it has a derivative? Doesn't a function have to be continuous to be differentiable?

share|cite|improve this answer
If you plot the function, we could be continued only at $x=0$ and $x=1$. – mathsalomon Aug 11 '11 at 6:33
If what you are saying is that the function is continuous only at $x=0$ and $x=1$, then, yes, that's true. – Gerry Myerson Aug 11 '11 at 13:11
Oh yes. That is true. – mathsalomon Aug 12 '11 at 15:44

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.