I am calculating the sum of two uniform random variables $X$ and $Y$, so that the sum is $X+Y = Z$. Since the two are independent, their densities are $f_X(x)=f_Y(x)=1$ if $0\leq x\leq1$ and $0$ otherwise. The density of the sum becomes $f_Z(z)=\int_{-\infty}^\infty f_X(z-y)f_Y(y)dy=\int_0^1f_X(z-y)dy$ by convolution. I am stuck at this stage. How do I proceed with my integral? I think a diagram make it easy but I dont know how to proceed.
2 Answers
Hint: Split the calculation into two cases: (i) $0\le z\le 1$ and (ii) $1\lt z\le 2$.
Added: (i) if $0\le z\le 1$, then $f_X(z-y)=1$ if $0\le y\le z$, and $f_X(z-y)=0$ if $y\gt z$. It follows that $$\int_0^1 f_X(z-y)\,dy=\int_0^z 1\cdot dy=z$$.
(ii) If $1\lt z\le 2$, then $f_X(z-y)=1$ if $z-1\le y \le 1$, and $f_X(z-y)=0$ elsewhere. It follows that $$\int_0^1 f_X(z-y)\,dy=\int_{z-1}^1 1\cdot dy=2-z.$$ Thus $f_Z(z)=z$ if $0\le z\le 1$, and $f_Z(z)=2-z$ if $1\le z\le 2$. And for completeness, $f_Z(z)=0$ if $z$ is outside the interval $[0,2]$.
Remark: I suspect that the convolution way is in this case effectively no faster than the "slow" way of finding first the cumulative distribution function $F_Z(z)$, and differentiating.
- $\begingroup$ could you elaborate on that. $\endgroup$Vaolter– Vaolter2012-10-25 08:41:29 +00:00Commented Oct 25, 2012 at 8:41
- $\begingroup$ @Vaolter: Details filled in. $\endgroup$André Nicolas– André Nicolas2012-10-25 09:28:48 +00:00Commented Oct 25, 2012 at 9:28
- $\begingroup$ why $f_X(z-y) = 1$ ? $\endgroup$Belter– Belter2017-07-31 14:47:20 +00:00Commented Jul 31, 2017 at 14:47
- 2$\begingroup$ I am a little bit dizzy, I got it finally. According to the definition of uniform distribution, $f_X$ only has two possible value: either 0 or 1. So the only thing we need to do is to find the zone that can promise $f_X(x) = 1$. $\endgroup$Belter– Belter2017-07-31 15:30:03 +00:00Commented Jul 31, 2017 at 15:30
- $\begingroup$ Actually another answer of yours is better to understand ^_^ math.stackexchange.com/a/357842/395289 $\endgroup$Belter– Belter2017-07-31 15:33:03 +00:00Commented Jul 31, 2017 at 15:33
hint: the integrand is zero unless $0 \le z-y \le 1$
- $\begingroup$ ok, $f_X(z-y)$ is 1 in that case how do I proceed? $\endgroup$Vaolter– Vaolter2012-10-25 08:41:06 +00:00Commented Oct 25, 2012 at 8:41
- $\begingroup$ Your answer it great hint, and I answer this question with your hint. $\endgroup$GoingMyWay– GoingMyWay2018-11-06 12:47:33 +00:00Commented Nov 6, 2018 at 12:47
- $\begingroup$ @Vaolter I posted an answer by the hint. $\endgroup$GoingMyWay– GoingMyWay2018-11-06 12:47:53 +00:00Commented Nov 6, 2018 at 12:47