I need help understanding the question and its solution below.

> 
> Suppose that X is uniformly distributed in [0,a] and Y is uniformly
>  distributed in [0,b], $0 < a \le b$, and that X and Y are independent.
>  Find the PDF of $Z=X+Y$.
> 
> 
> 

The solution is as follows.

For simplicity, define the unit square pulse

$$q(t) = u(t) - u(t-1)$$

where u(t) is the unit step function. Then the PDFs of X and Y are

$$f\_X(x) = \frac{1}{a} q(\frac{x}{a})$$
$$f\_Y(y) = \frac{1}{b} q(\frac{x}{b})$$

The PDF of Z is the convolution of $f\_x$ and $f\_Y$. i.e.

$$f\_Z(z) = \int\_{-\infty}^{\infty}\frac{1}{ab}q(\frac{\tau}{a})q(\frac{z-\tau}{b})d\tau$$

Therefore, 

\begin{equation}
 f\_Z(z) = \frac{1}{ab}\begin{cases}
 z, & \text{if $0<z\le a$}.\\
 a, & \text{if $a<z\le b$}.\\
 a+b-z, & \text{if $b<z\le a+b$}.\\
 0, & \text{elsewhere}.\\
 \end{cases}
\end{equation}

I have a few questions.

(1) How is the $f\_X(x)$ and $f\_Y(x)$ obtained? Why involve the unit step function instead of just taking $f\_X(x) = \frac{1}{a}$ and $f\_Y(x) = \frac{1}{b}$?

(2) I don't know how to get $f\_Z$. I sketched out the 3 ranges for z.

[![enter image description here](https://i.stack.imgur.com/JHFuB.png)](https://i.stack.imgur.com/JHFuB.png)

[![enter image description here](https://i.stack.imgur.com/yvjpe.png)](https://i.stack.imgur.com/yvjpe.png)

[![enter image description here](https://i.stack.imgur.com/ZlIBA.png)](https://i.stack.imgur.com/ZlIBA.png)

I think my sketches must be wrong. My understanding of the convolution is that it is the resulting overlapping region between $f\_X(x)$ and $f\_Y(z-b)$ (the corresponding q functions seem to be a factor of $f\_Y$ and $f\_X$?), so I don't know how the overlapping region can be more than the red squares, bounded by $x = a$.