# Derivative of floor function

I thought the derivative of function $\text{floor}(x)$ should be $\infty$ for integer values of $x$ and 0 elsewhere. But wolframalpha plot showed something different. Is there any explanation?

-
It does not exist for integer values, and it is $0$ elsewhere. Explanation: don't trust Wolfram too much. –  1015 Feb 17 '13 at 3:58
I really appreciate this website as an atomized helping tool, and it may be a good idea to collect as much bugs we can find and raise them to the website owners to improve. –  Tariq Feb 17 '13 at 4:11
I don't think being a WolframAlpha bug tracker would be a good use of this site. If you find a bug in WolframAlpha you should probably just let them know directly. –  Rahul Feb 17 '13 at 4:16
add comment

## 3 Answers

The Alpha plot is badly wrong. The derivative of $\lfloor x \rfloor$ is 0 at non integers and not defined at integers. You would have to ask the people at Wolfram why this happens.

-
It does that for some other graphs as well. –  Joe Z. Feb 17 '13 at 4:02
add comment

If you try asking Wolfram Alpha to differentiate the floor function, it will just output "Floor'(x)". If you force Wolfram Alpha to plot the derivative of the floor function, I think what Wolfram Alpha does is it as an infinte sum of dirac deltas, so that when you integrate, you can still get back the floor function. See http://reference.wolfram.com/mathematica/ref/DiracDelta.html and http://mathworld.wolfram.com/DeltaFunction.html

Clearly that's not what you had in mind when you asked Wolfram Alpha to plot the graph, but well...

-
add comment

It's probably calculating the derivative numerically instead of symbolically. An approach that gives a good approximation for functions that actually are differentiable, but behaves weird when the function is discontinuous.

For example, using a simple centered difference approximation $f'(x) \approx \frac{f(x + h) - f(x - h)}{2h}$, with $h = 0.05$, gives $f'(1) \approx \frac{f(1.05) - f(0.95)}{0.1} = \frac{1 - 0}{0.1} = 10$. This is nonsense, but an artifact of the computation.

-
add comment