Sum of uniform random variables $U(0,1)$ and $U(0, a)$ The problem I have is:
$X \sim U(0,1),  Y \sim U(0,a)$ are independent random variables. Find the pdf of $X + Y$. I've got stuck in an integral-problem, and will show you what I've tried. Skip to the integral-problem itself if uninterested in the rest of the problem.
I will use the indicator-function notation: $1_{[a,b]}(x)$ in the following way...
If $a \leq x \leq b$
then $1_{[a,b]}(x) = 1$
else $1_{[a,b]}(x) = 0$.
$Z := X + Y, W := X \Rightarrow \frac{d(x,y)}{d(z,w)} = -1$.
By the transformation theorem we get:
$$f_{Z,W}(z,w) = f_{X}(w)f_{Y}(z - w) \cdot |-1| = 1_{[0,1]}(w)\cdot1_{[0,a]}(z-w)\cdot\frac{1}{a}$$
Now to the integral-problem:
$$f_{Z}(z) = \int_{-\infty}^{\infty} f_{Z,W}(z,w)dw$$
If $ 0 \leq w \leq 1$ and $0 \leq z - w \leq a$ then $f_{Z,W}(z,w) = \frac{1}{a}$ else $f_{Z,W}(z,w) =0$.
The problem that remains is... how do I compute the integral? How do I re-express the region where $f_{Z,W}(z,w) \neq 0$ so that the lower and upper bound of $w$ is expressed with z, and z is bounded by constants, so that I can eliminate $w$ by integration?
Thank you.
I've been told that it is wise to divide the problem into two cases: one where a < 1 and one where a >= 1.
 A: Don't forget to include the indicator function for $0\leq z\leq a+1$
You have (assuming $a>1$):
$$\begin{align}
 f_{Z,W}(z,w) & \tag{1} =\tfrac 1 a \mathbf 1_{[0;a+1]}(z)\mathbf 1_{[0;1]}(w)\mathbf 1_{[0;a]}(z-w)
\\[1ex] & \tag{2} =\tfrac 1 a \mathbf 1_{[0;a+1]}(z)\mathbf 1_{[0;1]}(w)\mathbf 1_{[z-a;z]}(w)
\\[1ex] & \tag{3} =\tfrac 1 a \mathbf 1_{[0;a+1]}(z)\mathbf 1_{[\max(z-a,0);\min(z,1)]}(w) 
\\[1ex] & \tag{4} = \tfrac 1 a \Big(\mathbf 1_{[0;a]}(z)\mathbf 1_{[0;\min(z,1)]}(w)+\mathbf 1_{(a;a+1]}(z)\mathbf 1_{[z-a;1]}(w)\Big) 
\\[1ex] & \tag{5} = \tfrac 1 a \Big(\mathbf 1_{[0;1]}(z)\mathbf 1_{[0;z]}(w)+\mathbf 1_{(1;a]}(z)\mathbf 1_{[0;1]}(w)+\mathbf 1_{(a;a+1]}(z)\mathbf 1_{[z-a;1]}(w)\Big) 
\\[4ex]
f_Z(z) & = \tfrac 1 a \Big(\mathbf 1_{[0;1]}(z)\int_0^z\operatorname d w+\mathbf 1_{(1;a]}(z)\int_0^1\operatorname d w+\mathbf 1_{(a;a+1]}(z)\int_{z-a}^1\operatorname d w\Big) 
\\[1ex] & = \frac z a \mathbf 1_{[0;1]}(z) + \frac 1 a \mathbf 1_{(1;a]}(z)+\frac{1+a-z}{a}\mathbf 1_{(a;a+1]}(z)
\end{align}$$
Can you do the case for $a<1$  ?
A: Thanks for the help! Now I understand the technique. I've managed to solve the problem for a < 1. For other people facing the same problem, I upload my answer here:
$f_{Z,W}(z,w) = \frac{1}{a}$ for $0 \leq w \leq 1$ and  $0 \leq z - w \leq a$, which is equivalent to:
$0 \leq w \leq 1$ and $z - a \leq w \leq z$ and $0 \leq z \leq a + 1$.
$\Rightarrow max(0, z - a) \leq w \leq min(z,1)$ and $0 \leq z \leq a + 1$
For $0 \leq z \leq a$ we get $0 \leq w \leq z$
For $a < z \leq 1$ we get $z - a \leq w \leq z$
For $1 < z \leq a + 1$ we get $z - a \leq w \leq 1$
Therefore, the density of Z is given by:
$$f_{Z}(z) = \frac{1}{a}\int_{0}^{z}1_{[0,a]}(z)dw + \frac{1}{a}\int_{z - a}^{z}1_{(a,1]}(z)dw + \frac{1}{a}\int_{z - a}^{1}1_{(1, a + 1]}(z)dw$$
$$\Rightarrow f_{Z}(z) =  \frac{z}{a}1_{[0,a]}(z) + 1_{(a,1]}(z) + \frac{1 - z + a}{a}1_{(1, a + 1]}(z)$$
Thanks for the help, Graham. I didn't realize that I could "divide" the region of integration into subregions in order to find the integration bounds. Hehe, this is a somewhat common integration technique now that I think of it.
