# Problem with integrating DiracDelta

I thought I had found a bug in Mathematica and reported it already in version 9, since it wasn't fixed in version 10 or 11 I reported it two more times but I never get any reply whatsoever so I'm thinking perhaps it is not a bug and I have just misunderstood the way Mathematica is supposed to work.

I do not expect these last two integrals to give 0 but they do. Should they not return 1? The first two integrals return what I expect them to and are just provided for comparison.

Integrate[DiracDelta[Cos[θ]] θ, {θ, 0, π}]
Integrate[DiracDelta[Cos[θ]] Exp[θ], {θ, 0, π}]
Integrate[DiracDelta[Cos[θ]] Sin[θ], {θ, 0, π}]
Integrate[DiracDelta[Cos[θ]] UnitStep[θ], {θ, 0, π}]

• Please do not use Bugs tag for initial posts, it is intended to be used after confirmation by participants.
– ciao
Jan 25, 2017 at 23:10
• Fort the last example, Integrate[ DiracDelta[Cos[\[Theta]]] UnitStep[\[Theta]] // Simplify[#, 0 <= \[Theta] <= \[Pi]] &, {\[Theta], 0, \[Pi]}] evaluates to 1 Jan 25, 2017 at 23:51
• For distributions, it is better to use HeavisideTheta instead of UnitStep, since HeavisideTheta is a generalized function (distribution) and UnitStep is not. Integrate[DiracDelta[Cos[t]] HeavisideTheta[t], {t, 0, Pi}] does return 1. This is covered in the documentation in the tutorial on GeneralizedFunctions. Jan 26, 2017 at 0:03
• All the integrals under consideration make no sense (see encyclopediaofmath.org/index.php/Delta-function and encyclopediaofmath.org/index.php/Generalized_function as a first reading for explanation). Jan 4, 2020 at 18:52
• @user64494 Why do they not make sense to you? Jan 6, 2020 at 16:22

I'd consider it a bug.

Reason: I would consider following identity: $$\delta(f(x))=\sum_i\frac{\delta(x-x_i)}{|f'(x_i)|}$$

Where $\forall x_i : f(x_i)=0$

This leads us to: $$\delta(\cos x)=\frac{\delta(x-\pi/2)}{|-\sin(\pi/2)|}=\delta(x-\pi/2)$$

So we conclude: $$\int_0^\pi\text{d}x\;\delta(x-\pi/2)\cdot\sin x=\sin(\pi/2)=1$$ The same for UnitStep. And Mathematica realizes this:

Integrate[DiracDelta[x - Pi/2]*Sin[x], {x, 0, Pi}]
Integrate[DiracDelta[x - Pi/2]*UnitStep[x], {x, 0, Pi}]


1

1

With FullSimplify before:

FullSimplify[DiracDelta[x - Pi/2]*Sin[x], 0 < x < Pi]
FullSimplify[DiracDelta[x - Pi/2]*UnitStep[x], 0 < x < Pi]


2 DiracDelta[[Pi] - 2 x]

2 DiracDelta[[Pi] - 2 x]

Which evaluates in Integrate to:

Integrate[2 DiracDelta[\[Pi] - 2 x], {x, 0, Pi}]


1

So, my vote is on bug.

I also vote for a bug. The easiest way to see it is using an undefined function,

Integrate[DiracDelta[Cos[x]] f[x], {x, 0, Pi}]


which gives f[Pi/2]. So for an undefined function it gives the right answer but for f=Sin it does not give Sin[Pi/2]. Hence a Bug.