# How to find the distribution of a function of multiple, not necessarily independent, random variables?

If $Y$ is a random variable defined as $Y=g(X_1,X_2)$, where $X_1$ and $X_2$ are two different random variables whose distributions are known (say with pdf's $f_{X_1}$ and $f_{X_2}$), how do we find the distribution of $Y$ (i.e. the pdf $f_Y$)?

Is there a general method to solve this problem? If there isn't, let us consider two specific cases which I am interested in.

a) $Y=X_1X_2$; $X_1$ and $X_2$ being independent random variables.

b) $Y=X_1X_2$; $X_1$ and $X_2$ being correlated random variables.

• possible duplicate of Joint distribution of two dependent variables Jan 15, 2015 at 8:21
• @Xi'an :I do not think the post you suggested answers my question. Not directly at least or I should have missed something. Consider the case in which $X_1$ follows Lognormal with parameters $\mu_1$ and $\sigma_1$, while $X_2$ follows a Normal distribution with parameters $\mu_2$ and $\sigma_2$, what should be the distribution of $Y$ Jan 15, 2015 at 8:41
• There is no solution to the question when $X_1$ and $X_2$ are correlated. Jan 15, 2015 at 8:45
• @Xi'an : Thanks. If $X_1$ and $X_2$ are independent, how do we find? I have seen the solution to the problem when the relation is $Y=X_1+X_2$. But the method did not seem to be general enough to accommodate other functional relationships. Jan 15, 2015 at 8:54
• (1) I think you should add the "self-study" tag to your question; (2) you have to study what a change of variable and what a Jacobian are to be able to manage the general answer. Jan 15, 2015 at 9:07

For $a > 0$, $\displaystyle P\{XY > a\} = \int_0^\infty \int_{\frac ax}^\infty f_{X,Y}(x,y) \,\mathrm dy\,\mathrm dx + \int_{-\infty}^0 \int_{-\infty}^{\frac ax} f_{X,Y}(x,y) \,\mathrm dy\,\mathrm dx$.
From this, you can deduce $P\{XY \leq a\} = F_{XY}(a)$ for $a >0$ and hence the density function for $a >0$ by differentiating $F_{XY}(a)$ with respect to $a$. A similar calculation can be done for $a < 0$; setting up the integrals and their limits is left to you as an exercise.
If you understand the Fundamental Theorem of Calculus well enough to be able to differentiate an integral with respect to a parameter that appears only in the limits, then you can even avoid calculating the inner integrals in both cases. Some textbook writers even exhibit the pdf of $XY$ as a mystical magical integral involving absolute values etc that gives the answer for all $a \in (-\infty,\infty)$, but using this formula in any actual calculation usually results in disaster for beginners. I am not a trained professional by any means, but I still advise you not to try it at home.
Note that this answers both questions asked as long as you know the joint pdf of $X$ and $Y$ (e.g. $X$ and $Y$ are independent with known pdfs) but not if you know only that $X$ and $Y$ are correlated without knowing the joint pdf. As Xi'an says in a comment, your second question has no answer in general