# Strange behavior of DiracDelta

On Mathematica 11.1.1.0 on Mac OS X86, I found the following behavior of DiracDelta:

DiracDelta[x - a] /. x -> a
(* DiracDelta[0] *)

DiracDelta[x - 1/5] /. x -> 1/5
(* 5 DiracDelta[0] *)


Why there is an additional factor 5 in front of DiracDelta[0]?

• DiracDelta[0] has no sense. I will submit that bug. – user64494 Feb 7 '18 at 20:51
• Indeterminate should be performed in both the cases. – user64494 Feb 7 '18 at 21:00

For rational numbers r, DiracDelta[x-r] evaluates:

DiracDelta[x - 1/5]


5 DiracDelta[-1 + 5 x]

Recall that DiracDelta is a distribution, and is only well defined when it occurs inside of an integral. The two versions are equivalent when used inside of an integral:

Integrate[x^2 DiracDelta[x - a], {x, -Infinity, Infinity}] /. a->1/5
Integrate[x^2 DiracDelta[x - 1/5], {x, -Infinity, Infinity}]
Integrate[x^2 (5 DiracDelta[-1 + 5 x]), {x, -Infinity, Infinity}]


1/25

1/25

1/25

You might be curious about why DiracDelta evaluates in this way. Note that distributions (of which DiracDelta is one) form a real vector space. This means that Mathematica needs to be able to add DiracDelta objects that represent the same distribution, even if their arguments are different. Since Mathematica canonicalizes DiracDelta objects with exact numeric coefficients, the following examples produce a single DiracDelta object:

DiracDelta[x-1/2] + 2 DiracDelta[2x-1]
DiracDelta[x-1/π] + π DiracDelta[Pi x - 1]


4 DiracDelta[-1 + 2 x]

2 π DiracDelta[-1 + π x]

Converting expressions to a canonical (or normal) form is an essential part of all symbolic algebra programs.

You also might ask why the canonical form of DiracDelta[x-1/5] is 5 DiracDelta[5x-1] instead of just the original DiracDelta[x - 1/5], but that is a question whose answer I do not know.

• While this is all very much true, do sympathize with the OP's bafflement over this rather obscure evaluation behaviour for DiracDelta. – Sjoerd Smit Feb 7 '18 at 16:14
• @SjoerdSmit I gave an update explaining why DiracDelta objects evaluate to a canonical form. – Carl Woll Feb 7 '18 at 20:29
Trace[DiracDelta[x - 1/5] /. x -> 1/5]
(*{{{{{{1/5,1/5},1/5,1/5},-(1/5),-(1/5)},x-1/5,-(1/5)+x},DiracDelta[-(1/5)+x],5 DiracDelta[-1+5 x]},{{{1/5,1/5},1/5,1/5},x->1/5,x->1/5},5 DiracDelta[-1+5 x]/. x->1/5,5 DiracDelta[-1+5/5],{{{5/5,1},-1+1,0},DiracDelta[0]},5 DiracDelta[0]}*)