What is the PDF of random variable Z=XY?

Given two independent random variables X and Y, how can I find the PDF of random variable $Z=XY$?

*If their joint distribution is required, assume that we also have it.

-
Re the asterisk: independence implies that the joint distribution is fully determined by the marginals. –  Did Sep 17 '13 at 6:26
Please do not modify your posts making answers or comments appear off-topic. –  Did Sep 23 '13 at 17:53
@Did: you are right. Thanks for your editing. –  May Sep 23 '13 at 17:54

If $X$ and $Y$ are two random variables, you may find the product distribution as follows: $$f_Z(z)=\int_{-\infty}^{\infty} \frac{1}{|t|} f_X\left(t\right)f_Y\left(\frac{z}{t}\right)dt$$ To see this, suppose that the distribution of $X$ is continuous at 0: $$P(Z\leq z)=P(XY\leq z)= P(Y\leq \frac{z}{X}\big|X>0)P(X>0)+P(Y\geq \frac{z}{X}\big|X<0)P(X<0)=$$ $$=\int_{0}^{\infty} P(Y\leq \frac{z}{t}\big)f_X\left(t\right)dt+ \int_{-\infty}^{0} P(Y\geq \frac{z}{t}\big) f_X\left(t\right)dt$$ We can find the derivation of both sides w.r.t. $z$ and we get:

$$f_Z(z)=\int_{0}^{\infty} \frac{1}{t} f_Y(\frac{z}{t}\big)f_X\left(t\right)dt+ \int_{-\infty}^{0} \frac{-1}{t} f_Y(\frac{z}{t}\big) f_X\left(t\right)dt$$ $$=\int_{-\infty}^{\infty} \frac{1}{|t|} f_X\left(t\right)f_Y\left(\frac{z}{t}\right)dt$$ The moral: it is not always possible to use this formula.

-
thanks, just a question why do we need $1/|t|$? –  May Sep 16 '13 at 23:25
I wrote a more complete answer :-) –  Arash Sep 16 '13 at 23:39
Thanks a lot now I see why. I think the last line of formula should be edited. –  May Sep 17 '13 at 0:06
just a question why is it not always possible to use it? –  May Sep 17 '13 at 0:07
Sorry but I do not understand "it is not always possible to use this formula". The formula is always right. –  Did Sep 17 '13 at 8:58

\begin{align} {\cal P}\left(Z\right) &= {{\rm d} \over {\rm d}Z}\int_{-\infty}^{Z}{\cal P}\left(Z'\right)\,{\rm d}Z' = {{\rm d} \over {\rm d}Z}\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} {\rm P_{X}}\left(X\right)\,{\rm P_{Y}}\left(Y\right)\, \Theta\left(Z - XY\right)\,{\rm d}X\,{\rm d}Y\, \\[3mm]&= \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} {\rm P_{X}}\left(X\right)\,{\rm P_{Y}}\left(Y\right)\, \delta\left(Z - XY\right)\,{\rm d}X\,{\rm d}Y\, = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} {\rm P_{X}}\left(X\right)\,{\rm P_{Y}}\left(Y\right)\, {\delta\left(Y - Z/X\right) \over \left\vert X\right\vert}\,{\rm d}X\,{\rm d}Y\, \end{align}

$$\begin{array}{|c|}\hline\\ \color{#ff0000}{\large\quad% {\cal P}\left(Z\right) = \int_{-\infty}^{\infty} {\rm P_{X}}\left(X\right)\,{\rm P_{Y}}\left(Z \over X\right)\, \,{{\rm d}X \over \left\vert X\right\vert} \quad} \\ \\ \hline \end{array}$$

-