# How to compute the PDF of a sum of bernoulli and normal variables analytically?

Can convolution be applied to get a closed form expression for $Z = X + N$ where $X$ is a Bernoulli random variable and $N$ is a zero mean normal random variable independent of $X$?

• Isn't $Z$ just a mixture of Gaussians? Mar 31, 2015 at 6:00
• I don't know; I am not aware of how to show this. Mar 31, 2015 at 6:00
• Not much to show. I added an answer. Mar 31, 2015 at 6:10
• Mar 31, 2015 at 7:06
• if it is an homework assignment, you need to tell us why you can derive the pdf of $Z$ by the convolution formula. I added the self-study tag, please read the wiki. Mar 31, 2015 at 8:35

Compute the CDF of $X+N$ using convolution, then differentiate the result.

The CDF of $X$ is

$$F_X(x) = (1-p)\theta(x) + p\theta(x-1)$$

where $\theta$ is the Heaviside theta function (the indicator function of the nonnegative reals),

$$\theta(x) = 1\text{ if }x \ge 0,\ 0\text{ otherwise}.$$

By definition, the CDF of $X+N$ is

$$F_{X+N}(y) = \Pr(X+N \le y) = \Pr(X \le y-N) =\mathbb{E}(F_X(y-N)).$$

The last equality computes $F_X(y-N)$ for each possible $N=n$ and integrates over them all, weighting them by their probabilities $f_N(n)dn$. It is a convolution, written as

$$\mathbb{E}(F_X(y-N)) = \int_\mathbb{R} F_X(y-n) f_N(n)dn = (F_X\star f_N)(y).$$

Using the expression of $F_X$ in terms of Heaviside functions, linearity of integration breaks this integral into two convolutions of multiples of $\theta$ against $f_N$. But computing such convolutions is trivial, because for any distribution function $f$ with integral $F$,

$$(\theta \star f)(y) = \int_\mathbb{R} \theta(y-x)f(x)dx = \int_{-\infty}^y 1 f(x)dx + \int_{y}^\infty 0 f(x)dx = F(y).$$

It should be apparent that the CDF of $X+N$ is a linear combination of the CDF of $N$ and the CDF of $N-1$. Thus differentiation of the CDF to obtain the PDF will obtain the same linear combination of the PDFs. At this point you could simply write down the answer.

• THank you for your answer. I am very weak in this area which is the basics of probability theory & so have few Questions. Can you please clarify? (1) How $Pr$ gets replaced by $E$. (2) Did not understand how $\theta(y-x)f(x) dx$ comes and then it becomes 1(range of integral is $y$ to $\infty$ and 0. (3) Is the final answer GMM? But how is that conclusion arrived from the last step of integration $F(y)$ (4) Plz suggest books where I can learn how to derive myself and the backgrnd info required for it. Apr 1, 2015 at 3:44
• Can you kindly explain how the pdf of $Z$ will be the differentiation of the cdf of $X+N = F(y)$ (from convolution) and what is $y$? Apr 4, 2015 at 18:14

$X$ is Bernoulli distributed with probability $p$. $N$ has mean zero and variance $\sigma^2$. So, with probability $1-p$, $Z=X+N$ has mean zero and variance $\sigma^2$ and with probability $p$ it has unit mean and variance $\sigma^2$. That looks like a mixture of Gaussians to me.

• So, the variance will be same? I could not show with convolution how to compute. It is a homework assignment where I need to show analytically. Can you help me with that? THank you. Mar 31, 2015 at 6:12
• @RiaGeorge If you need the variance then (add it in your question and) you can get it with the help of conditioning by applying the formula $V(N)=E(V(N|X))+V(E(N|X))$. Mar 31, 2015 at 8:52
• @StéphaneLaurent: Since, $N$ is zero mean, then I think $E[N|X] = 0$. So, we are left with $V(n) = E[V(N|X)] = \sigma^2$. Am I correct? Thank you for pointing this formula; totally forgot. Mar 31, 2015 at 15:05
• In what cases, do we we have GMM with different variance? Mar 31, 2015 at 15:05
• @RiaGeorge Sorry, I meant $Z$ and not $N$, in case if you are interested in the variance of $Z$. I don't understand your latest question ("GMM with different variance ?", could you detail ?) Mar 31, 2015 at 15:08