I am new to statistics and I happen to came across this property of MGF:
Let $X$ and $Y$ be independent random variables. Let $Z$ be equal to $X$, with probability $p$, and equal to $Y$, with probability $1 − p$. Then,
$$M_Z(s)= p M_X(s) + (1 − p) M_Y(s).$$
Let $X$ and $Y$ be independent random variables. Let $Z$ be equal to $X$, with probability $p$, and equal to $Y$, with probability $1 − p$. Then, $$M_Z(s)= p M_X(s) + (1 − p) M_Y(s).$$
The proof is given that
$$M_Z(s)= E[e^{s Z}]= p E[e^{s X}] + (1 − p)E[e^{s Y}]= p M_X (s) + (1 − p)M_Y (s)$$
But I do not understand, can someone show me a full proof as in showing the conditioning on the random choice between X and Y, as in why the following holds
$$M_Z(s)= E[e^{s Z}]= p E[e^{s X}] + (1 − p)E[e^{s Y}]$$
Thanks very much.