# Can formally differentiating give a derivative of a discrete function?

When I teach calculus, I really try to stress the importance of knowing the domain of a function.

One example that I sometimes like to use to show students the importance of inspecting the domain is the following: $f(x) = \sqrt{\sin(x)-1}$. I ask the student to differentiate this function, and they happily apply their formal rules to obtain $f'(x) = \frac{\cos(x)}{2\sqrt{sin(x) - 1}}$. Then I ask them to graph the original function. Hey, it is just a discrete set of points! I think at this point they realize that the differentiation they did was totally meaningless, and that paying attention to the domain might be a good idea.

One defect with this example is that the derivative really does fail to exist everywhere - it has no domain. I would like an example of a rule for a function whose "largest domain" (the domain where the rule can be evaluated) is a discrete set of points, but where formally differentiating the rule yields a derivative which has a nonempty "largest domain". I have thought off and on about this for a while now, and was hoping the collective MO community might be able to come up with something. Or perhaps someone might be able to prove that the standard "formal rules of differentiation" (say from Stewart's calc book), and the standard list of "common functions" are incapable of producing such an example. I would be happy either way.

• It seems that the main problem with $f(x)$ in your example is that $x$ is implicitly assumed to be real. Formal manipulations with elementary functions (including formal differentiation) can be often easily justified if $x$ is allowed to be complex. – Andrey Rekalo Mar 3 '11 at 23:13
• Bouncing off of Andrey's comment, you might look for a function f holomorphic in a neighborhood of the real line whose real values on the real line are discrete but such that its derivative has real values on some real interval. By the identity principle, the values of its derivative on that real interval uniquely determine it, and every elementary function I can think of which takes real values on some interval is real everywhere, so... – Qiaochu Yuan Mar 3 '11 at 23:34

How about $y=\log(-x^2)$?
• Nice one!  – Steven Gubkin Mar 4 '11 at 0:37
If $g(x)$ is analytic in a neighborhood of a point, say $x=0$, then its Taylor expansion is of the form $g(z) = \sum_{n=0}^{\infty} c_n z^n$ where $c_n = g^{(n)}(0)/n!$. Thus if $g$ is real-valued for real $x$ then all the $c_n$ are real. Apply this to $g(x) = f'(x)$ with $f$ as in the question. Then by integrating term by term we have $f(x) = C + \sum_{n=0}^{\infty} c_n x^{n+1}/(n+1)$, where $C$ is constant. The only way $f$ is not real is if $C$ is a non-real complex number. This is actually the case in Gerry's example of $f(x) = \log(-x^2) = \log(|x|^2) + i \arg(-1)$ (however you want to define the argument of $-1$). The trick to generating further examples is then to find disguised ways to write such a function $f$.