Let $X$ and $Y$ be i.i.d. and uniformly distributed random variables on $[1/2,1]$. Furthermore, we define $Z:=X-Y$ and want to calculate the pdf by convolution as follows:


First, note that $Z$ can take values from $-1/2\le z \le 1/2$ and $f_Y$ is zero outside $1/2\le x -z \le 1$. Thus we can write the convolution

$f_Z(z)=\int^{\infty}_{-\infty} 1/4 \chi_{[1/2,1]}\chi_{[1/2+z,z+1]}\mathrm{d}x$,

where $\chi$ is the indicator function (also denoted $\mathbb{1}$).

I now divide the interval of $z$ into $-1/2\le z\le 0$ and $0\le z \le 1/2$ and obtain

$f_Z(z)=\begin{cases} \int^1_{1/2+z}\frac{\mathrm{d}x}{4}=\frac{0,5-z}{4},& \ \ 0\le z \le 1/2 \\ \int^{z+1}_{1/2}\frac{\mathrm{d}x}{4}=\frac{0,5+z}{4},& \ \ -1/2\le z \le 0\end{cases}$

This density is wrong and I could not figure out the problem for hours.

  • $\begingroup$ Are $X$ and $Y$ uniform on $[1/2,1]$? $\endgroup$
    – Sanderr
    May 23 '17 at 12:59
  • $\begingroup$ Yes, I forgot to add. $\endgroup$ May 23 '17 at 13:01
  • $\begingroup$ The title should probably read 'difference of two iid variables' $\endgroup$ May 23 '17 at 13:03
  • 2
    $\begingroup$ $\frac14$ should change into $4$. $\endgroup$
    – drhab
    May 23 '17 at 13:21
  • 1
    $\begingroup$ Your mistake is in $f_X,f_Y$, you divide by the length of the interval to get the density for the uniform distribution. Hence the $1/4$ in your calculation should be $4$ which gives the correct answer. $\endgroup$
    – Sanderr
    May 23 '17 at 13:22

Let $X,Y$ be uniformly distributed on $[a,b]$. Then the pdf of $Z = X-Y$ is

$$p(z) = \int_\mathbb{R} dx\int_\mathbb{R} dy \ p(x) p(y) \ \delta(z-(x-y)) =$$ $$ = \frac{1}{(b-a)^2} \int_\mathbb{R} dx \int_\mathbb{R} dy \ \mathbb{1}^x_{[a,b]} \mathbb{1}^y_{[a,b]} \delta(z-(x-y))=$$ $$ = \frac{1}{(b-a)^2} \int_\mathbb{R} dx \int_\mathbb{R} dy \ \mathbb{1}^x_{[a,b]} \mathbb{1}^y_{[a,b]} \delta(y-(x-z))=$$ $$ = \frac{1}{(b-a)^2} \int_\mathbb{R} dx \ \mathbb{1}^x_{[a,b]} \mathbb{1}^{x-z}_{[a,b]} =$$

The product of the two indicators is equivalent to the conditions:

$$a \leq x \leq b \quad \wedge \quad z+a\leq x \leq z+b.$$

For different values of $z$, these conditions can be reduced to a single inequality, for instance if $0 \leq z \leq b-a$, then the inequality $a+z \leq x $ is "stronger" than $a \leq x$, and the inequality $x \leq b+z$ is "weaker" than $x \leq b$. So for those values of $z$, you have the product of the indicators simplifying to:

$$\mathbb{1}^x_{[a,b]} \mathbb{1}^{x-z}_{[a,b]} = \mathbb{1}^x_{[a+z,b]}, \quad 0 \leq z \leq b-a.$$

Similarly, for another set of values of $z$ (negative $z$, but not too negative), you'll have a different total constraint, and if $z +a \geq b$ or $z+b \leq a$, the two indicators will be totally disjoint and give zero.

To help visualize this, you can draw a picture like this:


where the square brackets denote the interval $[a,b]$, and the stars are $a+z$ and $b+z$ respectively.

In your solution you had the wrong numerical factor, $1/4$ instead of a $4$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.