# Dirac delta in integrals

I am trying to simplify the following integral

Integrate[ Integrate[K[x, z] u[z], {z, -Infinity, +Infinity}] K[x, y]
+ DiracDelta[x - y] u[x], {x, -Infinity, +Infinity}]


unfortunately Mathematica is not able to simplify it into

Integrate[ Integrate[K[x, z] u[z], {z, -Infinity, +Infinity}] K[x, y],
{x, -Infinity, +Infinity}]+ u[y]


However,

Integrate[DiracDelta[x - y] u[x], {x, -Infinity, +Infinity}]


produces the correct result, namely

u[y]


I have attempted various approaches such as

Integrate[ Integrate[K[x, z] u[z], {z, -Infinity, +Infinity}] K[x, y]
+ DiracDelta[x - y] u[x], {x, -Infinity, +Infinity}]//Simplify


or

Assuming[Element[y, Reals], FullSimplify@Integrate[ Integrate[K[x, z] u[z],
{z, -Infinity, +Infinity}] K[x, y]
+ DiracDelta[x - y] u[x], {x, -Infinity, +Infinity}]


]

but I never got the desired result.

Any suggestions?

Thanks!

• What version of Mathematica are you using? DiracDelta has some known bugs in certain versions of Mathematica. Commented Apr 20, 2016 at 21:04
• On further thought, this probably isn't an issue with one of those bugs. Effectively, you want Mathematica to simplify that $\int [ f(x) + g(x) \delta(x - x_0)]\, dx$ to $\int f(x) \, dx + g(x_0)$, even if it can't evaluate the integral of $f(x)$. My guess is that it'll be tricky to cajole Mathematica into doing this without using explicit patterns and replacement rules, and I'm not an expert on those. Commented Apr 20, 2016 at 21:14
• Thanks Michael. I am using version 10.4. Commented Apr 20, 2016 at 21:18

You can define a custom transformation function:

sepint[expr_] := expr /. Integrate[Plus[a_, b_], c_] :> Plus[Integrate[a, c], Integrate[b, c]]


Then apply it to the expression. The ComplexityFunction can be used to eliminate the DiracDelta in the expression.

Simplify[Integrate[
Integrate[K[x, z] u[z], {z, -Infinity, +Infinity}] K[x, y] +
DiracDelta[x - y] u[x], {x, -Infinity, +Infinity}],
TransformationFunctions -> {sepint},
ComplexityFunction -> (Count[#, DiracDelta[_], Infinity] &),
Assumptions -> {y ∈ Reals}]]

(*
Integrate[Integrate[K[x, z]*u[z], {z, -Infinity, Infinity}]*K[x, y], {x, -Infinity, Infinity}] + u[y]
*)