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.
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$.