# Trouble with the derivative of the delta function

I am trying to evaluate the following integral with Mathematica:

\begin{align} I = \int_{0}^{\infty} da \, \frac{e^{-\frac{a ^2}{4s^2}} }{a^2} \mbox{sinc}\left(\tfrac{w}{2} a \right) \delta' \left( \frac{D^2}{a}- a \right), \end{align} where the prime on the delta function denotes differentiation with respect to the argument of the Delta function. When I evaluate this integral with Mathematica as:

Integrate[Exp[-a^2/(4 s^2)]/a^2 Sinc[w a / 2] Derivative[DiracDelta][D^2/a - a],{a,0,Infinity}, Assumptions -> s > 0 && w > 0 && D > 0]


I get the result: \begin{align} I_{Mathematica} = \frac{e^{-\frac{D^2}{4 s ^2}} }{4 D^4 s ^2 w } \left[\left(D^2+6 s ^2\right) \sin \left(\frac{D w }{2}\right)-D s ^2 w \cos \left(\frac{D w }{2}\right)\right]. \end{align}

However, if I evaluate this integral analytically, using the fact that \begin{align} \frac{d}{da} \delta\left( \frac{D^2}{a}- a \right) = - \delta' \left( \frac{D^2}{a}- a \right) \left(\frac{D^2}{a^2}+1\right) \implies \delta' \left( \frac{D^2}{a}- a \right) = - \left[\frac{d}{da} \delta\left( \frac{D^2}{a}- a \right) \right] \left(\frac{D^2}{a^2}+1\right)^{-1}, \end{align} I get the following result: \begin{align} I_{analytic} &= \int_{0}^{\infty} da \, \frac{e^{-\frac{a ^2}{4s^2}} }{a^2} \frac{\sin \left(\tfrac{w}{2} a \right) }{\tfrac{w}{2} a} \delta' \left( \frac{D^2}{a}- a \right) \\ &=- \int_{0}^{\infty} da \, \left[\frac{d}{da} \delta\left( \frac{D^2}{a}- a \right) \right] \left(\frac{D^2}{a^2}+1\right)^{-1} \frac{e^{-\frac{a ^2}{4s^2}} }{a^2} \frac{\sin \left(\tfrac{w}{2} a \right) }{\tfrac{w}{2} a} \\ &= \int_{0}^{\infty} da \, \delta\left( \frac{D^2}{a}- a \right) \left[\frac{d}{da} \left(\frac{D^2}{a^2}+1\right)^{-1} \frac{e^{-\frac{a ^2}{4s^2}} }{a^2} \frac{\sin \left(\tfrac{w}{2} a \right) }{\tfrac{w}{2} a} \right] \\ &= \int_{0}^{\infty} da \, \frac{\delta\left( D - a \right)}{2} \left[\frac{d}{da} \left(\frac{D^2}{a^2}+1\right)^{-1} \frac{e^{-\frac{a ^2}{4s^2}} }{a^2} \frac{\sin \left(\tfrac{w}{2} a \right) }{\tfrac{w}{2} a} \right] \\ &= - \frac{e^{-\frac{ D^2 }{ 4s^{2}}}}{4 D^{4} s^{2} w} \left[ \left(D^{2}+4 s^{2}\right)\sin\left( \frac{ Dw}{2} \right) - D s^{2} w \cos \left( \frac{ Dw}{2} \right) \right], \end{align} which differs from $$I_{Mathematica}$$ by an overall negative sign and the prefactor in front of $$s^2$$ in the first term.

I'm not sure if the issue is with the way Mathematica handles the derivative of the delta function or if I've made a mistake in my analytic calculation. Any help would be much appreciated, I've been staring at this for days!

• Perhaps your analytical formula is wrong? As far as I know DiracDelta'[x]==-DiracDelta[x]/x , which is different from your "fact". Mar 31, 2020 at 18:53
• The formula holds for arbitrary argument! Mar 31, 2020 at 19:44
• Thanks for the discussion! Note that the bounds are differnt so that Integrate[ x Derivative[DiracDelta][x], {x, 0, Infinity}] == - 1 + HeavisideTheta. Mar 31, 2020 at 20:25
• Also, Integrate[ x Derivative[DiracDelta][x], {x, 0, Infinity}]'' is not equal to Integrate[ x^2 Derivative[DiracDelta][(x - 1)^2], {x, 0, Infinity}]. However, presumably when you say The formula holds for any argument', then also the integration measure would change. I believe this is equivalent to the "fact" I stated above. Note I use quotations around "fact" to leave open the possibility that there may be a mistake there, but I do not see one. Mar 31, 2020 at 20:27
• @e4alex s/he says that every time the Dirac delta-function is mentioned, don't worry. Apr 1, 2020 at 8:16

Let's talk about the Dirac $$\delta$$-"function". Strictly speaking, it's a linear functional $$\delta:C^\infty(\mathbb R)\to\mathbb R\qquad\qquad\delta(f)=f(0).$$ However, we usually use the notation $$\int_{-\infty}^\infty\delta(x)f(x)dx$$ to denote the evaluation $$\delta(f)$$. The derivative of the $$\delta$$-"function" is computed via formal integration by parts: $$\delta'(f)=\int_{-\infty}^\infty\delta'(x)f(x)dx=-\int_{-\infty}^\infty\delta(x)f'(x)dx=-f'(0).$$ Your integral has the additional complications that there is a function inside the argument of $$\delta'(x)$$, and that the integral is not taken over all of $$\mathbb R$$. Composing distributions with functions is, in general, not possible, but in this case we can appeal to a theorem of Hormander:

Theorem: Suppose $$f:M\to N$$ is a smooth function whose differential is everywhere surjective. Then there is a linear map $$f^*:\mathscr D(N)\to\mathscr D(M)$$ such that $$f^*u=u\circ f$$ for all $$u\in C(N)$$.

For our purposes, this means $$\int_{-\infty}^\infty\delta'(f(x))g(x)dx$$ makes sense provided $$f(x)$$ is smooth and $$f'(x)$$ never vanishes. Similarly, reducing the domain of integration is, in general, not possible, but we have:

Theorem Suppose $$E_1$$ and $$E_2$$ are disjoint closed sets, and let $$\mathscr D_{E_i}$$ denote the set of distributions which coincide with a smooth function on $$E_i^c$$ for $$i=1,2$$. Then there is a bilinear map $$m:\mathscr D_{E_1}\times\mathscr D_{E_2}\to\mathscr D(\mathbb R^n)$$ such that $$m(u,v)=uv$$ when $$u$$ and $$v$$ are continuous.

In our case, we would like to compute the integral $$\int_0^\infty\delta'\left(\frac{D^2}{x}-x\right)g(x)dx=\int_{-\infty}^\infty\chi_{(0,\infty)}(x)\delta'\left(\frac{D^2}{a}-a\right)g(x)dx,$$ where $$\chi_{(0,\infty)}$$ is the characteristic function of the half-line $$(0,\infty)$$. The theorem says that the product $$\chi_{(0,\infty)}(x)\delta'\left(\frac{D^2}{x}-x\right)$$ makes sense whenever the singular support of $$\chi_{(0,\infty)}$$, namely $$\{0\}$$, does not intersect the singular support of $$\delta'\left(\frac{D^2}{x}-x\right)$$, namely $$\{D,-D\}$$. Thus when $$D\neq 0$$, our integral makes sense and $$\int_0^\infty\delta'\left(\frac{D^2}{x}-x\right)g(x)dx=\begin{cases}g'(D),&D>0\\g(-D),&D<0\end{cases}.$$ To compute your integral, just plug in your particular function $$g(x)$$. When you're working with distributions (like $$\delta$$) you need to be very careful about what you do with them. I don't know how Mathematica conceptualizes the $$\delta$$-distribution, but I wouldn't be inclined trust that it would go through the necessary analytical reasoning and get the right answer.

TL;DR: Do your distributional calculus by hand.

• Thank you so much for those theorems that rigorously justify the composition and multiplication of distribution, placing the integral we seek to evaluate on solid ground! The detailed reply is much appreciated. Apr 2, 2020 at 23:47
• @ AestheticAnalyst However, I'm not sure I agree with the evaluation of the integral in your last equation, or perhaps it was misunderstood what was meant by $\delta'(f(x))$. Consider $\frac{d}{dx} ( \frac{D^2}{x} - x )= - \delta'( \frac{D^2}{x} - x ) \left(\frac{D^2}{x^2}+1 \right)$. Apr 3, 2020 at 0:36
• @ AnethesticAnalyst It follows that: \begin{align} \int_0^\infty \delta'\left( \frac{D^2}{x} - x \right) g(x) \, dx &= - \int_0^\infty \left(\frac{D^2}{x^2}+1 \right)^{-1} g(x) \frac{d}{dx} \delta \left( \frac{D^2}{x} - x \right) \, dx \\ &= \int_0^\infty \frac{d}{dx} \left[ \left(\frac{D^2}{x^2}+1 \right)^{-1} g(x) \right] \delta\left( \frac{D^2}{x} - x \right) \\ &= \frac{1}{2} \frac{d}{dx} \left[ \left(\frac{D^2}{x^2}+1 \right)^{-1} g(x) \right]_{x = D} \end{align} Would you agree? Apr 3, 2020 at 0:36
• @AestheticAnalyst Thank you for this interesting contribution. One remark: Assuming ( Wikipedia ) Derivative[DiracDelta][x]==-DiracDelta[x]/x I would get something like Integrate[g[x],x] Derivative[DiracDelta][x],{x,0,Infinity}]=-g[a]/(d^2 -a) /.a->d without distinguishing cases of d! Apr 3, 2020 at 6:39
• @yarchik Regarding that prior post, feel free to take my comments as: "The math does not support the given result. Unevaluated would be better. A message that the singular integral is undefined would also be nice." Apr 3, 2020 at 15:02

Here my attempt to solve the integral Integrate[f[a] Derivative[DiracDelta][d^2/a - a],{a,0,Infinity}]:

f[a_] := Exp[-a^2/(4 s^2)]/a^2 Sinc[w a/2]


Substitution u[a]=d^2/a-a (integrationlimits change to u=Infinity],u[Infinity]=-Infinity)

u[a_] := d^2/a - a

sola = Solve[u == d^2/a - a, a][] (*solution a>0*)


Now Mathematica is able to solve the integral

int=Integrate[f[a/.sola] Derivative[DiracDelta][u]/u'[a]/.sola ,{u, Infinity,-Infinity}]

(*(E^(-(d^2/(4 s^2))) (d s^2 w Cos[(d w)/2] - (d^2 + 4 s^2) Sin[(d w)/2]))/(4 d^3 Sqrt[d^2] s^2 w)*)


Hope it helps solving your problem!

• Thanks a lot for your reply! I agree with your approach and it agrees with the result I get from $I_{analytic}$. This is the result I trust, however, when I evaluate Integrate[Exp[-a^2/(4 s^2)] Sinc[w a / 2] Derivative[DiracDelta][D^2/a - a],{a,0,Infinity}, Assumptions -> s > 0 && w > 0 && D > 0], which appears to be the same integral, I get $I_{Mathematica} \neq I_{analytic}$. This is the source of my confusion. Do you see why these two integrals give differnt results? Is it something wrong with how code $I_{Mathematica}$? Apr 1, 2020 at 16:38
• @e4alex I agree and think that Mathematica result, which only differs in sign, is wrong. You get the Mathematica result if you take the first branch of sola[…][]! One additional remark: Substitution d^2->d2 helps mathematica a lot... Apr 2, 2020 at 5:54
• @UlrichNeumann I do not think MMA result is wrong. The fact that Dirac's delta only has meaning within an integral does not mean that you can change the limits of integration at will. The limits of integration are an integral part 😁 of the definition. Apr 2, 2020 at 14:38
• @SolutionExists Thanks for your comment, I didn't change the integration limits at will. My point is the transformation a->u , which must cover the integration range 0<a<Infinity . That's why I think sola[] is the right branch (and Mathematica perhaps took the wrong) Apr 2, 2020 at 14:42
• @UlrichNeumann I didn't mean you personally, I meant in general. The integral in the OP goes from zero to ∞, but the definition of Dirac's delta must use an integral from -∞ to ∞. Changing the limits of the integral to [0,∞) is equivalent to multiply to test function by a Heaviside theta, so the OP integral is the integral of a distribution times a distribution. That is doable but not trivial. Apr 2, 2020 at 14:49

My previous answer and comments were wrong. I didn't notice the argument of the δ function was not linear in the integration variable (and I wasn't even drunk).

In the integral form the generalized scaling property may be written as $$∫_{-∞}^∞ f ( x ) δ ( g ( x ) ) d x = ∑_i f ( x_i ) / | g ′ ( x_i ) |$$.

The Jacobian of the transformation is 1/g'(x). Please note the absolute value in the denominator.

Basically, find the zeroes of the argument of the δ, and integrate around them (by parts if necessary). Also,

The distributional derivative of the Dirac delta distribution is the distribution δ′ defined on compactly supported smooth test functions φ by $$δ ′ [ φ ] = − δ [ φ ′ ] = − φ ′ ( 0 )$$ .

(1) Finding the zeroes:

Solve[-a + Δ^2/a == 0, a]


(2) Finding the Jacobian:

jac = Solve[Dt[-a + Δ^2/a == u[a]], u'[a]]
/. Dt[Δ] → 0 /. a → Δ // FullSimplify


(3) Evaluating the integral by parts (don't forget the minus sign in front):

v1 = -D[(E^(-(a^2/(4 s^2))) Sinc[(a w)/2])/a^2, a] / Abs[jac]
/. a → Δ // FullSimplify


(4) Divide the integral by the Jacobian (the previous division was because of the integration by parts, this one because of the scaling):

v1 / Abs[ jac ]


The answer is the same as $$I_{MMA}$$. By the way, MMA is simply using

Integrate[ f[a] DiracDelta'[2 a], {a, -∞, ∞}]
(*-(1/4) f'*)


Prove that analytically and you will find the error in your analytic calculation.

• Many thanks for replies in answering this question. I am able to prove the last expression you suggest by the methods I use above, so I still don't see the error in my analytic calculation. Observe $\frac{d}{da} \delta(2 a) = 2 \delta'(2a)$. It then follows that: \begin{align} \int da \, f(a) \delta'(2a) &= \int da \, f(a) \frac{1}{2} \frac{d}{da} \delta(2 a) \\ &= -\frac{1}{2} \int da \, \left( \frac{d}{da} f(a) \right) \delta(2 a) \\ &= -\frac{1}{4} \int da \, \left( \frac{d}{da} f(a) \right) \delta(a) \\ &= -\frac{1}{4} f'(0) \end{align} Apr 3, 2020 at 15:41
• @e4alex ok, now we agree that the Jacobian is in the denominator twice. So, the only discrepancy should be the sign. Remember that Dirac's delta is an even function, so only the minus sign from integration by parts is necessary. Apr 3, 2020 at 16:18
• For example, the following minus sign in your post should not be there \begin{align} I_{analytic} &= \int_{0}^{\infty} da \, \frac{e^{-\frac{a ^2}{4s^2}} }{a^2} \frac{\sin \left(\tfrac{w}{2} a \right) }{\tfrac{w}{2} a} \delta' \left( \frac{D^2}{a}- a \right) \\ &=- \int_{0}^{\infty} da \, \left[\frac{d}{da} \delta\left( \frac{D^2}{a}- a \right) \right] \left(\frac{D^2}{a^2}+1\right)^{-1} \frac{e^{-\frac{a ^2}{4s^2}} }{a^2} \frac{\sin \left(\tfrac{w}{2} a \right) }{\tfrac{w}{2} a} \end{align} Also, it seems that there are algebraic errors (you have a 4 where I got a 6). Apr 3, 2020 at 16:18
• I'm not sure I agree that the Jacobian appears twice. The first factor of two comes from the chain rule, while the second comes from the scaling property of the delta function. So the negative sign you believe should not be there follows from the chain rule which I state in the original post. Is it that you do not agree with the way I apply the chain rule? Apr 3, 2020 at 16:36
• It appears you get the answer that agrees with Mathematica. Note that I believe $I_{Mathematica}$, as stated in the original post, agrees with your results (note the appearance of a 6 instead of a 4). Apr 3, 2020 at 16:37

speculation: Mathematica cannot handle Derivative[DiracDelta][1/x-x]in a right way?

Here I'll give a simplified example which perhaps shows that Mathematica gives a wrong result, when applied to Derivative[DiracDelta][1/x-x]!

Let's consider the integral

Integrate[Derivative[DiracDelta][1/x - x], {x, 0, Infinity} ]
(*0*)


which MMA (v12) evaluates to zero!

Alternatively integration with substitution u=1/x-x, x=-u/2+Sqrt[1+(u/2)^2] (see my first answer)

us=D[1/x-x,x]/. x->-u/2+Sqrt[1+(u/2)^2];
Integrate[ Derivative[DiracDelta][u]/us, {u, Infinity,-Infinity} ]
(*1/4*)


To "proof" the last result I'll consider the deltadistribution as a well known limit

dirac = Function[x, Exp[-(x^2/(2 eps))]/Sqrt[2 Pi eps]] (* eps->0 *)

int=Integrate[dirac'[1/x - x], {x, 0, Infinity} ]

(*(E^(1/eps) (-BesselK[0, 1/eps] + BesselK[1, 1/eps]))/(eps^(3/2) Sqrt[2 \[Pi]])*)


eps->0

Simplify[ Normal[Series[int, {eps, 0, 0}]], eps > 0]

(*1/4*)
`

Why can't Mathematica find this result? What's wrong here?