(A more general case of Example 6.3) Obtain the PDF of Z=X+Y, where X and Y are two independent random variables with the following PDFs:
\,\displaystyle f_X\left (x\right )= \begin{cases}\frac{1}{b-a} & a<x<b \\ 0 & \text { otherwise }\end{cases}\\ \,\displaystyle f_Y\left (y\right )= \begin{cases}\frac{1}{d-c} & c<y<d, d-c<b-a \\ 0 & \text { otherwise }\end{cases}The two PDFs are shown in Figure 6.6.
To evaluate the limits of integration of the PDF of Z, we consider the following regions represented by the diagram shown in Figure 6.7.
When z \lt a+c, f_Z(z)=0 because there is no overlap of the curves f_X(x) and f_Y(z-x).When \,\displaystyle a+c \leq z \leq a+d (see Figure 6.7(i)), we obtain
\,\displaystyle f_Z\left (z\right )=\frac{1}{\left (b-a\right )\left (d-c\right )} \int_a^{z-c} d y=\frac{z-c-a}{\left (b-a\right )\left (d-c\right )}
When a+d \leq z \leq b+c (see Figure 6.7(ii)), we obtain
\,\displaystyle f_Z\left (z\right )=\frac{1}{\left (b-a\right )\left (d-c\right )} \int_{z-d}^{z-c} d y=\frac{1}{b-a}
When \,\displaystyle b+c \leq z \leq b+d (see Figure 6.7(iii)), we obtain
\,\displaystyle f_Z\left (z\right )=\frac{1}{\left (b-a\right )\left (d-c\right )} \int_{z-d}^b d y=\frac{b+d-z}{\left (b-a\right )\left (d-c\right )}
Finally, when \,\displaystyle z>b+d, f_Z\left (z\right )=0 . Thus, the PDF of Z is given by
\,\displaystyle f_Z(z)= \begin{cases}0 & z<a+c \\ \frac{z-a-c}{(b-a)(d-c)} & a+c \leq z \leq a+d \\ \frac{1}{b-a} & a+d \leq z \leq b+c \\ \frac{b+d-z}{(b-a)(d-c)} & b+c \leq z \leq b+d \\ 0 & z>b+d\end{cases}
The PDF is graphically illustrated in Figure 6.8, which is a trapezoid. Note that when b-a=d-c , the PDF reduces to an isosceles triangle centered at \left (a+c+b+d\right )/2 ; similar to that in Figure 6.5. In the special case when a=c and b=d , the isosceles triangle is centered at z=a+b .