# How to calculate and plot the joint distribution probability density function of independent variables

Knowing that X and Y are independent of each other and follow the standard normal distribution, I want to know how to find and plot the probability density function of Z=f(X,Y).

By looking at this post, I know some types of probability density functions for Z=f(X,Y). By using the M function, the probability density function of Z=XY is quickly obtained:

dist = TransformedDistribution[
x y, {x \[Distributed] NormalDistribution[],
y \[Distributed] NormalDistribution[]}];
PDF[dist][x]
Plot[PDF[dist][x], {x, -1, 1}, Filling -> Axis, PlotRange -> Full]


But when I use the above method to find other probability density functions of type Z=f(X,Y) and W=f[X,Y,Z] , I have encountered difficulties, and MMA has been running without outputting results:

dist = TransformedDistribution[
x^y, {x \[Distributed] NormalDistribution[],
y \[Distributed] NormalDistribution[]}];
PDF[dist][x]
Plot[PDF[dist][x], {x, -1, 1}, Filling -> Axis, PlotRange -> Full]

dist = TransformedDistribution[
x*y*z, {x \[Distributed] NormalDistribution[],
y \[Distributed] NormalDistribution[],
z \[Distributed] NormalDistribution[]}]
PDF[dist][w]
Plot[PDF[dist][w], {w, 0, 1}, Filling -> Axis]


What should I do to find and plot the probability density functions of other Z=f(X,Y) types ($$Z=X^Y$$,$$Z=\sqrt[Y]{X}$$,$$Z=\log_{X}{Y}$$,$$W=XYZ$$,...)?

• What you're refering to is not an article, just a post in zhihu, and a quick test shows the first result is wrong: test1[z_] := -1/(2 Pi) NIntegrate[Exp[-1/(2 x^2) - z^(2 x)/2] Abs[z^(x - 1)/x], {x, -Infinity, Infinity}]; test2[z_] := -1/(2 Pi) NIntegrate[Exp[-x^2/2 - z^(2/x)/2] Abs[1/x z^(1/x - 1)/x], {x, -Infinity, Infinity}];{test1, test2} – xzczd Jul 4 '20 at 6:43
• @xzczd Thank you very much, I will think about this question again. – A little mouse on the pampas Jul 4 '20 at 7:00
• @xzczd Agreed: the first example is so wrong that it gives negative values for every value of $z$. To the OP: Are you expecting complex or imaginary values for $Z$? If you're only interesting in real numbers, then $X^Y$ won't do it for you. You'd need to consider $|X|^Y$. – JimB Jul 4 '20 at 16:03
• I wasn't actually suggesting you do that. (Maybe as a classroom exercise but likely no practical reason to have a real-world use for such a random variable.) I was only pointing out that some transformations result in complex numbers. – JimB Jul 4 '20 at 23:15
• You should take a look at mathworld.wolfram.com/RatioDistribution.html for a general method to obtain the distribution of the ratio of two random variables. – JimB Jul 6 '20 at 4:35