# How to compute the density of the product of a discrete and a continuous variable?

Let's say $X$ and $Y$ are continuous and discrete random variables, respectively, with $f(x)$ and $g(y)$ being a probability density for $X$ and probability mass for $Y$, respectively. Can I say that $Z=XY$ has density function equal to

$$\sum_{y} f(z/y)g(y)$$

and can I generalize this for all pairs of random variables?

• Your title is wrong. You're confusing $f(AB)$ (density of a product of two variables) with $f_A(A)f_B(B)$ (product of the density of two variables). You mean the first, you said the second. They're not the same – Glen_b -Reinstate Monica Feb 12 '14 at 8:27
• Are $X$ and $Y$ independent? – Zen Feb 12 '14 at 11:01
• When I was reformatting this question I took the liberty of changing one "f" in the formula to "g," assuming that was a mere typographical error. – whuber Feb 12 '14 at 14:55

## 2 Answers

Yes, but you need to fix the formula:

$pdf(Z) = \sum\limits_{i=Y_{min}}^{Y_{max}}g(i)f(\frac{Z}{i})$ This will yield a continuous density in Z.

You can generalize to any pair of variables...this is basically just a convolution.

Supposing that $X$, with pdf $f_X$, and $Y$, with pmf $p_Y$ are independent, then, for a Borel set $B$, we have $$P(Z\in B) = P(X\,Y\in B) = \sum_i P(X\,Y\in B\mid Y=y_i)\,P(Y=y_i)$$ $$= \sum_i P(X\,y_i\in B\mid Y=y_i)\,P(Y=y_i) = \sum_i P(X\in B_i\mid Y=y_i)\,P(Y=y_i)$$ $$= \sum_i P(X\in B_i)\,P(Y=y_i) = \sum_i \,q_i\,\int_{B_i} f_X(x)\,dx \, ,$$ in which $B_i=\{t\in\mathbb{R}:t\,y_i\in B\}$, and $q_i=P(Y=y_i)$.