# CDF and MGF of a Sum of a discrete and continuous random variable

I am currently dealing with the following exercise:
Given the random variables $$X \sim Be(p), Y \sim Exp(\lambda)$$, and assume they are independent. Set $$Z:= X + Y$$.

• Compute the Moment Generating Function (MGF) $$M_{z}(t)$$ of $$Z$$
• Compute the Distribution Function (CDF) $$F_{z}$$ of $$Z$$. Is $$Z$$ an absolutely continuous random variable?

From the theory I have studied, I have some questions regarding how to deal with this kind of exercises:

1. When it comes to sum to sum two independent random variables (discrete or continuous) and then calculating their CDF, does this always mean using convolution? Does this differ from calculating their joint PDF or CDF?
2. If X depended on Y, the joint CDF would be obtainable by using the law of total probability?
3. Since they are independent, the joint MGF is simply the product of the two MGFs?
• Could you please explain why you ask about the "sum [of] two discrete independent variables?" I believe that by "Exp$(\lambda)$" most people would understand an Exponential distribution with CDF $1 - \exp(-\lambda x)$ (for $x\gt 0$), which is continuous. Thus, your exercise concerns the sum of a discrete and a continuous variable. As far as your questions go, have you learned anything about MGFs or CDFs to suggest that how you operate on them mathematically (for the purpose of computing sums) differs at all depending on whether the distribution is continuous or not? if so, what is it?
– whuber
Dec 27, 2018 at 16:02
• @whuber I made an error in the title, I mean what you have said. From the theory, I understood about MGFs and CDFs work on the different cases. For what concerns the MGF, I only have to make the product of the MGF of X and Y since they are independent, but for the CDF I don't know how to proceed because, as you have pointed, I have to sum a discrete and a random variable. Convolution could be the solution, but the fact Bernoulli RV can be 0 or 1 confuses me while doing the math to compute the result.
– Slav
Dec 27, 2018 at 16:15
• Good, your comment answers question (3). Question (2) seems like a separate question, unrelated to the context you present. That leaves (1) (assuming you intend to edit it, too, so it refers to a sum of a discrete and continuous variable). Convolution is indeed the solution and it works identically for all CDFs. After you compute the CDF of the sum you can then decide whether it's continuous. That suggests your difficulty might stem from what you understand convolution to be or what formula(s) for it you might be using. Perhaps you could include that information in your post?
– whuber
Dec 27, 2018 at 16:22
• Yes, question 2 is not related to the exercise but to generalize even for the case when the variables are not independent. For what concerns question 3, I'm referring to the one provided from Wikipedia since in my course we don't have covered it yet. To me, it seems like I have something similar to $P(X=0)P(Y = y) + P(X=1)P(Y = y - 1)$, but here is the problem. I am not sure if the reasoning behind is correct because I feel I'm going far from the definition of CDF. By the way, I edited the question. Thanks
– Slav
Dec 27, 2018 at 16:36
• @whuber Sorry, in the last comment I meant $P(X=0)P(Y=z)+P(X=1)P(Y=z−1)$. I was not allowed to edit anymore.
– Slav
Dec 27, 2018 at 16:51

I will provide some advice about question (1) because (as indicated in the comments) it's the heart of the matter.

Because there are many ways to calculate with distributions, it's not always apparent how to proceed. When you're stuck, it's often a good idea to resort to the basic definition; namely, for all real numbers $$z$$ the CDF of $$X+Y$$ is given by the probability that $$X+Y \le z:$$

$$F_{X+Y}(z) = {\Pr}_{(X,Y)}(X+Y \le z).$$

It can help to focus on the simplest aspect of a problem. In this case, the Bernoulli variable looks particularly simple to me, because it can attain only two values. This invites us to break the problem into two parts, one for each possible value of $$X.$$ Thus:

• $$X=0$$ with probability $$1-p.$$ In this case $$X+Y=Y$$ and therefore $$\Pr(X+Y\le z) = \Pr(Y \le z) = F_Y(z).$$

• $$X=1$$ with probability $$p.$$ Now $$X+Y=1+Y$$ and therefore $$\Pr(X+Y\le z) = \Pr(1+Y\le z) = \Pr(Y \le z-1) = F_Y(z-1).$$

The foregoing are mutually exclusive events: the axioms of probability assert we may add their chances. Technically, we're working with conditional probabilities and we are computing

\eqalign{ \Pr(X+Y \le z) &= &\Pr(X+Y\le z\mid X=0)\Pr(X=0) \\&&+ \Pr(X+Y\le z\mid X=1)\Pr(X=1) \\ &= &F_Y(z)(1-p) + F_Y(z-1)p.}

I'm not supposing you would have formulated the problem like this at the outset; but by the time you have done the foregoing calculations, it's helpful to express what they reveal to you in this more rigorous form.

You should be able to proceed to an explicit answer from here by using whatever formula you like for the exponential CDF $$F_Y.$$ To determine whether this is a continuous variable, I recommend plotting $$F_{X+Y}$$ for typical values of $$p$$ and $$\lambda,$$ as shown by the thick curve in this figure (where $$p=1/2$$ and $$\lambda=1$$): The dashed line sketches $$F_Y$$ itself. The amount by which the curve departs from the dashed line represents the contribution of $$pF_Y(z-1),$$ whose graph has the same shape as that of $$(1-p)F_Y,$$ but shifted one unit right and rescaled by $$p/(1-p).$$ (As always, the graph continues infinitely far to the right and left, equal to $$0$$ for all negative values of $$z$$ and reaching $$1$$ asymptotically for large positive values of $$z.$$)

The question of continuity is resolved by determining whether the graph of $$F_{X+Y}$$ has any vertical breaks in its rise from $$0$$ to $$1.$$ I hope the picture makes it clear that this depends on whether $$F_Y$$ itself is continuous; I'll leave the answer at that.

• Thank you so much. That was exactly what I needed: a rigorous approach explaining which formulas are being involved. It is really useful.
– Slav
Dec 27, 2018 at 20:08