# Functional form of Delta function to perform convolution of continuous functions

I'm trying to get Mathematica to perform the convolution I need. I think it's fairly simple, just a convolution between a Normal distribution and a Uniform distribution on [-1,1]. A friend of mine mentioned using the delta function to do so but I'm not sure how to evaluate it correctly in Mathematica... Below is my attempt:

Integrate[PDF[NormalDistribution[μ, σ]][x-y](DiracDelta[# + 1] + DiracDelta[# - 1])/2&[y],
{y, -Infinity, Infinity}]


However, the output when I plot the solution seems readily wrong. I believe my problem is in how I'm implementing the DiracDelta. Any help would be greatly appreciated.

• Apparently this is a mis-interpretation of $[-1,1]$. It's an interval, right? Then you mean a uniform distribution on $[-1,1]$... so deltas are wrong. – Jens Jul 14 '17 at 18:45
• I'm not sure what is being asked. Is there some reason to believe that the result of the Integrate above is not correct? I get: (E^(-((1 + x - \[Mu])^2/(2 \[Sigma]^2))) + E^(-((1 - x + \[Mu])^2/( 2 \[Sigma]^2))))/(2 Sqrt[2 \[Pi]] \[Sigma]) and it seems to behave as expected. – Daniel Lichtblau Jul 14 '17 at 23:57

I would proceed as follows. Define a transformed distribution.

dist = TransformedDistribution[
x + 2 y - 1, {x \[Distributed] NormalDistribution[μ, σ],
y \[Distributed] BernoulliDistribution[1/2]}];


This has the expected properties

{Mean[dist], Variance[dist]}
(* {μ, 1 + σ^2} *)


and the PDF can be computed easily

PDF[dist, x]
(* (E^(-((1 + x - μ)^2/(2 σ^2))) + E^(-((1 - x + μ)^2/(
2 σ^2))))/(2 Sqrt[2 π] σ) *)