# x DiracDelta[x] simplifies to 0, desired or a bug?

Bug introduced in 5.0 or earlier, persisting through 12.0.

I encountered this when trying to answer this question:

x DiracDelta[x] // Simplify
(* 0 *)


Is this a bug or desired? If it's desired, what's the meaning of it? Well, this behavior indeed causes trouble in certain cases, here is a minimal example:

test = ( I + ζ DiracDelta[ζ])/  ζ;
InverseFourierTransform[#@test, ζ, z] & /@ {Identity, Simplify}
(* {(1 + π Sign[z])/Sqrt[2 π], Sqrt[π/2] Sign[z]} *)

• delta is only defined in terms of its integral, and this result will give the correct integral value. In what sense is it wrong? – george2079 Sep 25 '16 at 14:45
• From the documentation: "DiracDelta[x] returns 0 for all real numeric x other than 0." Since x DiracDelta[x] is zero at x = 0 then x DiracDelta[x] is zero for all real x. DiracDelta is a generalized function and is only fully defined in the context of an integral ("DiracDelta can be used in integrals, integral transforms, and differential equations"). – Bob Hanlon Sep 25 '16 at 14:59
• @george2079 I've added a minimal example to the question. – xzczd Sep 25 '16 at 15:05
• It seems more generally that for a numeric function f, Simplify[f[x] DiracDelta[x]] yields f[0] DiracDelta[x]. – Michael E2 Sep 25 '16 at 15:33
• @MichaelE2 Not necessarily. If you shift the expression, it doesn't work: Simplify[Abs[x-x1]DiracDelta[x-x1]]. This would also be a potential workaround for this Q: just shift everything: (x - x1) DiracDelta[x - x1] // Simplify is not zero. – Jens Sep 25 '16 at 15:37

The first line in your question is simplified correctly, but the added example shows that the simplification of the second line is in fact wrong because the denominator is ignored for too long.

To work around this, you could shift the variable like this:

test=(I+(ζ-ζ1) DiracDelta[ζ-ζ1])/(ζ-ζ1);
InverseFourierTransform[#@test,ζ,z]&/@{Identity,Simplify}


Then the results agree:

SameQ@@%


True

Therefore, to get the desired result, I tried this:

test = (I + (ζ - ζ1) DiracDelta[ζ - ζ1])/(ζ - ζ1);
(InverseFourierTransform[#@test, ζ, z] & /@ {Identity, Simplify}) /. ζ1 -> 0


{Sqrt[2 Pi] DiracDelta[0] DiracDelta[z] + Sqrt[Pi/2] Sign[z], Sqrt[2 Pi] DiracDelta[0] DiracDelta[z] + Sqrt[Pi/2] Sign[z]}

However, this doesn't quite work because there is a delta function of 0.

The best I could do with this shift trick is to prevent the simplification like this:

test = (I + ζ DiracDelta[ζ])/ζ;
InverseFourierTransform[#[test /. ζ -> (ζ - ζ1)] /. ζ1 -> 0,
ζ, z] & /@ {Identity, Simplify}


{(1 + Pi Sign[z])/Sqrt[2 Pi], (1 + Pi Sign[z])/Sqrt[2 Pi]}

• In v9 your first approach already works: Mathematica graphics :D – xzczd Sep 26 '16 at 3:08
• And things seem to be even worse in v11: i.stack.imgur.com/EAhvT.png – xzczd Sep 26 '16 at 3:43
• My results are for version 11 on OS X. Good to know that it can always get worse... – Jens Sep 26 '16 at 5:03