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, π}]
  • 1
    $\begingroup$ Please do not use Bugs tag for initial posts, it is intended to be used after confirmation by participants. $\endgroup$
    – ciao
    Commented Jan 25, 2017 at 23:10
  • $\begingroup$ Fort the last example, Integrate[ DiracDelta[Cos[\[Theta]]] UnitStep[\[Theta]] // Simplify[#, 0 <= \[Theta] <= \[Pi]] &, {\[Theta], 0, \[Pi]}] evaluates to 1 $\endgroup$
    – Bob Hanlon
    Commented Jan 25, 2017 at 23:51
  • 3
    $\begingroup$ 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. $\endgroup$
    – Carl Woll
    Commented Jan 26, 2017 at 0:03
  • $\begingroup$ 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). $\endgroup$
    – user64494
    Commented Jan 4, 2020 at 18:52
  • $\begingroup$ @user64494 Why do they not make sense to you? $\endgroup$
    – Petter
    Commented Jan 6, 2020 at 16:22

2 Answers 2


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}]



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}]


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.