How to evaluate $\mathbb{P}(XY=a)=\mathbb{P}(X=\frac{a}{Y})$, when $X$ or $Y$ take multiple values?

Assume $$X,Y$$ are discrete and have a finite outcome space.

How to evaluate $$\mathbb{P}(XY=a)=\mathbb{P}(X=\frac{a}{Y})$$, when $$X$$ or $$Y$$ take multple values?

Does one write out the result for each output value that $$X,Y$$ take?

Thus, if $$Y \in \{0,1\}$$, then

$$\mathbb{P}(XY=a)$$ $$= \mathbb{P}(X=\frac{a}{0}) \text{ or }\mathbb{P}(X=a)$$

out of which the first is undef.

I.e.

$$= \mathbb{P}(X=a)$$

If $$Y \in \{0,1,2\}$$, then

$$\mathbb{P}(XY=a)= \mathbb{P}(X=a) \text{ or } \mathbb{P}(X=a/2)$$

• Are $X$ and $Y$ continuous or discrete variables? Is the set of possible values for each finite? – dlnB Mar 17 at 15:36
• $P(XY=a)$ does not equal $P(X=\frac aY)$ when $Y=0$; just because you are using probability does not mean you are allowed to divide by $0$. – Dilip Sarwate Mar 17 at 16:09

For discrete and finite $$X$$ and $$Y$$ you could say
$$\mathbb{P}(XY=a)= \begin{cases} \mathbb{P}(X=a/Y) &\quad \text{if a \neq 0}\\ \mathbb{P}(X=0 \lor Y=0) &\quad \text{if a = 0} \end{cases}$$
• My question didn't particularly concern $a$, but $X,Y$. So could assume $a$ fixed. – mavavilj Mar 17 at 17:25
• @mavavilj you can replace the condition $a=0$ by $X=0 \lor Y=0$. It just shows that the case $a=0$ (which implies $X=0 \lor Y=0$) is special. When $Y$ is never 0 then $\mathbb{P}(X=0 \lor Y=0) = \mathbb{P}(X=0)$. – Martijn Weterings Mar 18 at 7:26
What you want to do here is use the law of iterated expectation, that is $$P(XY=a)=E[P(XY=a|Y)]$$, where the expectation is taken over all values of $$Y$$. This works in the discrete and continuous case. In the discrete case you can write the resulting integral as $$P(XY=a)=E[P(XY=a|Y)]=\sum_y P(X=a/y)P(Y=y)$$, where the sum is taken over all values that $$Y$$ takes.