# CDF of Z=XY with X~Uniform(0.5,1.5) and Y~Uniform(0.8,1.5)

I am looking for the CDF of the product of two independent random variables (X and Y) with uniform distributions. Both random variables uniform distributions have interval boundaries (upper and lower boundary of the uniform distribution) greater 0. Furthermore, the upper boundary is the same for both random variables . For simplicity let's assume the first random variable X to be Uniform(0.5,1.5) and the second random variable to be Uniform(0.8,1.5).

It is clear to me that the support of the product of the two independent random variables (X and Y) is [0.4,2.25] but I struggle to derive the cdf of Z=XY.

• Are you asking about the product of distributions or of random variables or of something else, such as a Cartesian product? If it's distributions, please explain what you mean by "product." What is an "interval boundary"? – whuber Mar 6 '18 at 23:03
• Yes the product of two stochastic variables. – TKres Mar 6 '18 at 23:04
• @Jim could you tell me how? Sry I'm new to the forum . On another note it is not homework and rather a question I need to answer for my personal research. – TKres Mar 6 '18 at 23:06
• @whuber variable X has a uniform distribution U(0.5,1.5) and Y has a uniform distribution U(0.8,1.5). The question is : what is the cdf of Z=XY – TKres Mar 6 '18 at 23:08
• @TKres You could do that by editing your question. Anyway, are you assuming $U_1$ and $U_2$ to be independent? – Jim Mar 6 '18 at 23:09

The solution is straightforward but messy using a standard formula, such as obtained in the first half of the Wikipedia derivation. The interest lies in simplifying the work.

I propose starting with a seemingly strange expression for the uniform distribution on the square $[a,b]\times [c,d],$ where (to avoid wrangling too heavily with negative numbers and special cases) I will assume all endpoints are non-negative. Its density is equal to $$f(x,y; a,b,c,d)=\frac{1}{(b-a)(d-c)}$$ throughout this square--that is, provided $a\le x\le b$ and $c\le y\le d$--and otherwise is zero. I will write that more formally and rigorously in the form

$$f(x,y;a,b,c,d) = \frac{1}{(b-a)(d-c)}\left[\mathcal{I}_{a,c}(x,y) - \mathcal{I}_{a,d}(x,y) - \mathcal{I}_{b,c}(x,y) + \mathcal{I}_{c,d}(x,y)\right]$$

where $\mathcal{I}$ is the indicator function of the quadrant bounded at the lower left by the point $(u,v),$

$$\mathcal{I}_{u,v}(x,y) = \left\{\array{ 1 & \text{if}\quad x\ge u, y\ge v \\ 0 & \text{otherwise.} }\right.$$

(For motivation, please see the illustrations and discussion under "Intuition from Geometry" at https://stats.stackexchange.com/a/43075/919, which uses the same idea to compute sums of uniform variables.)

To find the chance that $xy \le z$ for any $z$ all we need to do is integrate expressions of the form

$$F_{u,v}(z) = \int_{x y \le z} \mathcal{I}_{u,v}(x,y) dx dy.$$

These are elementary to compute. If $z\le uv$, this integral must be zero; otherwise, it is

$$\int_{x y \le z} \mathcal{I}_{u,v}(x,y) dx dy = \int_u^{\frac{z}{v}} \left(\frac{z}{x} - v\right) dx dy = z(\log(z) - \log(u) - \log(v)) - z + u v.$$

Therefore

\eqalign{\Pr(xy \le z) &= \int_{x y \le z}f(x,y;a,b,c,d) dx dy \\ &= \frac{F_{a,c}(z) - F_{a,d}(z) - F_{b,c}(z) + F_{c,d}(z)}{(b-a)(d-c)}.}

For instance, here is a Mathematica implementation of the basic integral (here written g):

g[z_, a_, b_] := Boole[z >= a b] (a b - z + z (Log[z] - Log[a] - Log[b]))


To illustrate its use, we may plot the CDF:

With[{a = 8/10, b = 3/2, c = 1/2, d = 3/2},
Plot[(g[z, a,c] - g[z, a,d] - g[z, b,c] + g[z, b,d] )/((b-a)(d-c)), {z, a c, b d}]] • wonderful. It works like a charm. Here is some code in R to illustrate that the empirical CDF and the analytical one from whuber match: a = 0.8 b = 1.5 c = 0.5 d = 1.5 g = function(z, a, b) (z>a*b)*(a*b-z+z*(log(z)-log(a)-log(b))) cdf = function(z,a,b,c,d) (g(z, a,c) - g(z, a,d) - g(z, b,c) + g(z, b,d) )/((b-a)*(d-c)) plot(ecdf((runif(1e6,a,b)*runif(1e6,c,d)))) curve(cdf(x,a,b,c,d),a*c,b*d,add=T,col='blue') – TKres Mar 7 '18 at 9:46