# Deriving the joint MGF for $U = XY + (1-X)Z$, $X \sim \text{Bernoulli}(p=1/3), Y \sim \text{Exp}(\theta = 2), Z \sim \text{Poi}(\lambda = 3)$

The question is to find the MGF of $U = XY + (1-X)Z$, where:

$X \sim \operatorname{Bernoulli} (p = \frac{1}{3})$

$Y \sim \operatorname{EXP} (\theta = 2)$ (Note that the notation is $\theta = \operatorname{E} (Y)$ for this distribution)

$Z \sim \operatorname{POI} (\lambda = 3)$

My (intuitive...?) thought process is that:

$$\operatorname{P} (X = x) = \begin{cases} \frac{1}{3}, & x = 1 \\ \frac{2}{3}, & x = 0 \\ \end{cases}$$

So

$$U = XY + (1 - X)Z = \begin{cases} Y & \text{with probability } \frac{1}{3} \\ Z & \text{with probability } \frac{2}{3} \\ \end{cases}$$

Then:

$$\operatorname{M}_U(t) = \operatorname{E} (e^{tU}) = \operatorname{E} (e^{t(XY + (1 - X)Z}) = \operatorname{P} (e^{tU} = e^{tY}) \operatorname{E}(e^{tY}) + \operatorname{P} (e^{tU} = e^{tZ}) \operatorname{E}(e^{tZ})$$

I don't really know how to explain this simplification: it's kind of intuitive. Can someone please explain if it is correct, and if so, why?

This is pretty much my question. Here's the rest of the derivation:

\begin{align} \operatorname{M}_U(t) & = \cdots = \operatorname{P} (e^{tU} = e^{tY}) \operatorname{E}(e^{tY}) + \operatorname{P} (e^{tU} = e^{tZ}) \operatorname{E}(e^{tZ}) \\ & = \operatorname{P} (X = 1) \operatorname{E}(e^{tY}) + \operatorname{P} (X = 0) \operatorname{E}(e^{tZ}) \\ & = \frac{1}{3} \operatorname{E}(e^{tY}) + \frac{2}{3} \operatorname{E}(e^{tZ}) \\ & = \frac{1}{3} \operatorname{M}_Y(t) + \frac{2}{3} \operatorname{M}_Z(t) \\ & = \frac{1}{3} \frac{1}{1 - 2t} + \frac{2}{3} e^{3(e^t-1)} \\ \end{align}

• Also: X, Y, Z are independent! – Alex Lostado Apr 17 '18 at 14:02
• It is enough if $X$ and $Y$ are independent and $X$ and $Z$ are independent. You do not need that $Y$ and $Z$ are independent. – drhab Apr 17 '18 at 14:04

According to the law of total probability:$$\mathsf Ee^{tU}=\mathsf E[e^{tU}\mid X=1]\mathsf P(X=1)+\mathsf E[e^{tU}\mid X=0]\mathsf P(X=0)=$$$$\frac13\mathsf E[e^{tU}\mid X=1]+\frac23\mathsf E[e^{tU}\mid X=0]=\frac13\mathsf E[e^{tY}\mid X=1]+\frac23\mathsf E[e^{tZ}\mid X=0]$$
This because $\mathsf E[e^{tU}\mid X=1]=\mathsf E[e^{tY}\mid X=1]$ and $\mathsf E[e^{tU}\mid X=0]=\mathsf E[e^{tZ}\mid X=0]$
If $X$ and $Y$ are independent then $\mathsf E[e^{tY}\mid X=1]=\mathsf Ee^{tY}$.
If $X$ and $Z$ are independent then $\mathsf E[e^{tZ}\mid X=0]=\mathsf Ee^{tZ}$.
So under these conditions (they are not mentioned in your question) you end up with:$$M_U(t)=\mathsf Ee^{tU}=\frac13\mathsf Ee^{tY}+\frac23\mathsf Ee^{tZ}=\frac13M_Y(t)+\frac23M_Z(t)$$
• Did you meant to write $\operatorname{E} (e^{tU} \vert X = 1) = \operatorname{E} (e^{tY})$ instead of $\operatorname{E} (e^{tY} \vert X = 1) = \operatorname{E} (e^{tY})$? Likewise for $Z$. – Alex Lostado Apr 17 '18 at 14:08
• I have added a step to make things more clear. If $U=XY+(1-X)Z$ then $(U\mid X=1)=Y$. That is: the distribution of $U$ under condition $X=1$ is the same as the distribution of $Y$. – drhab Apr 17 '18 at 14:28