Suppose you have a random variable $Z=X_1+X_2$, where $X_1$ and $X_2$ are distributed identically with the following probability distribution function (pdf): $$ p(X_i=x)= \begin{cases} 1-\frac{x}{2},& \text{if } 0\leq x\leq 2;\\ 0, & \text{otherwise.} \end{cases} $$
If I wanted to convolve these two distributions, I thought I could just take the integral $$p(Z=z)=\int_0^2{\left(1-\frac{z-t}{2}\right)\left(1-\frac{t}{2}\right)dt}$$
but that integral evaluates to $\frac{4}{3}-\frac{x}{2}$. Since $Z$ should be valid on the interval $0\le Z \le 4$ the pdf would look like:
However, this doesn't make any sense. The pdf should never be negative. I've tried different bounds of integration, etc., with no luck. What am I missing here?




If $f(x)$ is the pdf of $X_1$ and $X_2$, then the convolution is $$ f_Z(z)=\int_{-\infty}^{\infty}f(z-t)f(t)\;dt=\int_0^2f(z-t)f(t)\;dt $$ since $f(t)$ is zero if $t<0$ or $t>2$.
However, you also have to take this fact into account for $f(z-t)$. For instance, if $z=1$ then the requirement $z-t\geq 0$ implies that we must have $t\leq 1$ in the integral. Similarly, if $z=3$ then $z-t\leq 2$ implies that $t\geq 1$. So you need to be more careful with your bounds before substituting in the definition of $f$.