Message Boards Message Boards

6 Replies
2 Total Likes
View groups...
Share this post:

derivative of (x/Sqrt[x^2])

When I ask Math for the derivative of 
it returns ZERO.
But one knows that the correct answer is
Dirac Delta .

Can one explain why?
POSTED BY: osvaldo negrini
6 Replies
You mean the derivative of Sqrt[x^2]/x, not x/Sqrt[x^2], right?

As Marco said, mathematically this expression is undefined for x=0, and so is its derivative.

However, Mathematica simply takes the formal derivative (which results in 0) and does not look at for what values of x the expression is not defined.  This is a rather common issue in Mathematica, but I think that trying to be completely precise in these cases would turn out to be counterproductive.

Another example would be (2x-2)/(x-1).  This expression is equal to 2 for all x except for x=0 where it's undefined, hence its derivative should be undefined too.  But once again Simplify[(2x-2)/(x-1)] takes the practical route and gives 2, which is often the preferable result (although it's not strictly mathematically valid).  Simplify@D[(2x-2)/(x-1), x] is results 0 too.

It is good to be aware of this behaviour: often the generic result returned by Mathematica is not valid in a one or a few points (usually similar cases to the above).
POSTED BY: Szabolcs Horvát
Well, as long as we say that the derivative that Mathematica gives is correct in the entire domain of the original function, then that is consistent. Is your argument then, that the problem is that given only the derivative, we do not know its domain, i.e. the information regarding the domain of the original function regarding is lost in the derivative? I would agree that it would be nice to have an easier way of Mathematica giving me the domain of that derivative.

However, there is some functionality in Wolfram Alpha which might be interesting here:
WolframAlpha["domain of x/(Sqrt[x^2])", {{"Result", 1}, "Output"}]

(*HoldComplete[x < 0 || x > 0]*)
It gives the domain of a function. It also tells me that the derivative is, in fact not defined at x=0:
WolframAlpha["domain of Derivative[(x/(Sqrt[x^2])),x]", {{"Result", 
   1}, "Output"}]

(*HoldComplete[x < 0 || x > 0]*)

POSTED BY: Marco Thiel
Are you sure about the Dirac Delta?
The function you define (in the Reals?) is 1 everywhere apart from 0, where it is not defined. At that point (x=0) it is not defined, and hence has no derivative. I would think that Mathematica's answer that the derivative is 0 everywhere on its domain is quite correct.
POSTED BY: Marco Thiel
Posted 11 years ago
Small correction, -1 for x<0, 1 for x>0, undefined for x = 0.

So derivative could be considered 2*DiracDelta ?  Since integrating over it produces 2*UnitStep + C ?
POSTED BY: David Keith
Well, yes, I should have said that the magnitude is 1 everywhere, but the argument is true: f is not defined at x=0. The derivative is zero on the entire domain of f. I guess that that is what Mathemaitca wants to say. 

I am aware that the delta distribution can be considered to be the derivative of the Heaviside function.
Note that the Heaviside function, defined as a piecewise constant function, is defined at x=0, so it is defined on the entire real line. (There is a way of defining as as a generalised function as well, which is a bit different.) BTW, I believe that Mathematica basically uses the piecewise constant function definition of the Heaviside function.

The derivative of the Heaviside function is indeed the Dirac Delta:
D[HeavisideTheta[x], x]


I think that Mathematica is just very cautious about distinguishing between 

D[2*HeavisideTheta[x] - 1, x]
(*2 DiracDelta[x]*)
is indeed twice the DiracDelta. But they are not equal because of the domains. See also my post below. In other words there is no "jump" anywhere in its domain. It is a bit like with a function which is defined on the rationals such that it is 0 for all rationals < Sqrt[2] and 1 for all rationals > Sqrt[2]. Over the rationals that function is continuous in spite of the obvious jump at Sqrt[2]. There is no point in the rationals where it actually is discontinuous. It's all a matter of the domains.

POSTED BY: Marco Thiel
Uh-Huh.  How to catch a Newbie.

I guess I shouldn't have posted before actually examining the problem. I assume you've entered the derivative function incorrectly. In case you did enter your question incorrectly and are getting odd unexpected results in Mathematica and other people get the right answer for the same question, then the following tip might be useful. 

I had a "Flakey" problem with double integrals "acting incorrectly". I suggest you go to the URL provided  in my post (right below yours at the moment ) called "Double Integral Symbols don't work as advertised" and read it. It seems possible that your problem can be fixed in the same way mine was by resetting the Mathematica preferences to fix "common problems" (according to them). Read the whole URL or you may loose some stuff. 
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract