Joint distribution of two uniform RV's

Let $X \sim U(0,\theta_1) \text{ and } Y \sim U(0,\theta_2)$ be independent RV's. We're interested in $\mathbb{P}[X-Y\le z]$.

I've done the convolution (or double integrals), denote $Z=X-Y$ \begin{align} \mathbb{P}[Z\le z] &= \int_{[x-y<z]} dF_X dF_Y \\ &=\int_0^{\theta_2} \int_0^{z+y} \frac{1}{\theta_1} dx \frac{1}{\theta_2} dy\\ &=\frac{z}{\theta_1}+\frac{\theta_2}{2\theta_1} \end{align}

is this correct?

for $\theta_1=\theta_2 = 1$ we're getting $\mathbb{P}[X-Y\le z] = z+\frac12$, which intuitively makes sense.

I'm also curious about the joint pdf. We get the pdf by differentiating the cdf w.r.t. $z$. So $f_Z(z) = \frac{1}{\theta_1}$. Had we chosen the convolution the other way around $$\int_0^{\theta_1} \int_0^{z+x} \frac{1}{\theta_2} dy \frac{1}{\theta_2} dx$$ we would have obtained the joint pdf $f_Z(z) = \frac{1}{\theta_2}$. Isnt' that weird?

Assuming that $X$ and $Y$ are independent, the joint distribution is
$f(x,y) = \frac{1}{\theta_1 \theta_2}$ if $0 \le x \le \theta_1, 0 \le y \le \theta_2$ and $0$ otherwise.
The correct way to do this is to integrate $f(x,y)$ over the region $x-y\le z$. The easiest way to compute this integral is to do it geometrically. Compute the area of the intersection of the region $x-y\le z$ and the rectangle $[0, \theta_1] \times [0, \theta_2]$ and divide it by $\theta_1 \theta_2$.
You can also use the convolution to compute the distribution of $Z = X - Y$ and find $P\{Z \le z\}$ by integrating $\int_0^z f_Z(s) ds$.
• Both your integrals are incorrect because $z+y$ and $z+x$ can potentially be negative in your integration range. (Z can assume values between $-\theta_2$ and $\theta_1$) You have to split into cases depending on the value of $z$. – Narut Sereewattanawoot May 29 '13 at 21:08