Probability density function of a product of uniform random variables

There are different solutions depending on whether $a > 0$ or $a < 0$, $c > 0$ or $c < 0$ etc. If you can tie it down a bit more, I'd be happy to compute a special case for you.

In the case of: $a > 0$ and $c > 0$, there are three special sub-cases:

  • Case 1: $a d > b c$

  • Case 2: $a d < b c$

  • Case 3: $a d = b c$

Here is the output for Case 1 using the mathStatica/Mathematica combo ...

Case 1: $a > 0$, $c > 0$, $a d > b c$

Given $X \sim \text{Uniform}(a,b)$ with pdf $f(x)$, and $Y \sim \text{Uniform}(c,d)$ with pdf $g(y)$ and parameters $a>0$ and $c>0$, we have:

f = 1/(b-a);    domain[f] = {x, a, b} && {0 < a < b, a d > b c};
g = 1/(d-c);    domain[g] = {y, c, d} && {0 < c < d};

Find pdf of the product $Z = X * Y$, say $h(z)$:

h = TransformProduct[{f, g}, z]

enter image description here

with domain of support (just define it on the real line):

domain[h] = {z, -∞, ∞};

Here is a plot of the pdf for Case 1:

PlotDensity[h /. {a -> 2, b -> 4, c -> 1/2, d -> {6, 7, 8}}]

enter image description here

update ...

Case 3: $a > 0$, $c > 0$, $a d == b c$

Case 3 is really just a special case of case 1 ...

Given $X \sim \text{Uniform}(a,b)$ with pdf $f(x)$, and $Y \sim \text{Uniform}(c,d)$ with pdf $g(y)$, and parameters $a>0$ and $c>0$, we have:

f = 1/(b-a);    domain[f] = {x, a, b} && {0 < a < b, a d == b c};
g = 1/(d-c);    domain[g] = {y, c, d} && {0 < c < d};

Find pdf of the product $Z = X * Y$, say $h(z)$:

h = TransformProduct[{f, g}, z]

enter image description here

with domain of support (just define it on the real line):

domain[h] = {z, -∞, ∞};

Here is a plot of the pdf for Case 3, for your set-up, with $a = c$, and $b = d$:

PlotDensity[h /. {a -> Range[5], b -> 12, c -> Range[5], d -> 12}]

enter image description here

... and you are all done :) I might update the mathStatica code to automatically output all the special cases ... for the next version :)


The general formula for the pdf of the product $Z=XY$ of two random variables $X$ and $Y$ is given by

$$p_{Z}(z)= \int_{-\infty}^{\infty}\frac{1}{|x|}p_{XY}\left (x,\frac{z}{x}\right )\;dx$$

where $p_{XY}(x,y)$ is the joint distribution of the two random variables. If they are independent you can use $p_{XY}(x,y)=p_X(x)p_Y(y)$.