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

I am trying to get a function $f:\mathbb{R}^2 \to \mathbb{R}$ that is differentiable at the origin but discontinuous everywhere else?

As a simpler case, we have that $$g\left(x\right)=\begin{cases} x^2 & \mbox{if }x \in\mathbb{Q}\\ -x^2 & \mbox{otherwise} \end{cases}$$ has this property. Can we use this to help us construct an $f$?

share|cite|improve this question
How about $f(x,y) = g(x) + g(y)$? – Rahul May 6 '12 at 19:21
up vote 5 down vote accepted

Let $f(x,y)=\pm(x^2+y^2)$, with "$+$" when $(x,y)$ is rational (i.e. both components are rational) and "$-$" when $(x,y)$ is irrational (i.e. at least one component irrational).

share|cite|improve this answer

Treat the following as a heuristic, not a strict statement:

If $\lambda$ is a smooth function with $\lambda(0)=0$, $\lambda >0$ for $x\neq 0$ and $\nabla\lambda(0) =0$ and $g$ is any bounded function, then $\lambda g$ will be differentiable at the origin and will be as smooth/nonsmooth as $g$ everywhere else.

So take $\lambda(x,y) = x^2+y^2 = r^2$ and choose for $g$ any bounded function which is nowhere differentiable (like $g(x,y) = 0 $ if $x, y$ are both rational and $g(x,y) =1$ otherwise).

Then let $f=\lambda g$

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.