I have two independent random variables, $X \sim exp(\lambda)$ and $Y \sim unif(-1,0)$.
I would like to compute the density function $f_Z(z) = \int_{-\infty}^{\infty} f_Y(y) f_X(z-y) dy$, where $Z = X + Y$.
Since the supports of $X$ and $Y$ are, respectively, $x \ge 0$ and $-1 \le y \le 0$ :
- $y \ge -1$.
- $y \le 0$.
- $y \le z$ (because $z-y \ge 0$).
Thus $-1 \le y \le min(0,z)$, the convolution is then:
$$ f_Z(z) = \int_{-1}^{min(0,z)} f_Y(y) f_X(z-y) dy.$$
With solutions
$$f_Z(z) = \int_{-1}^{z} f_Y(y) f_X(z-y) = 1-e^{-\lambda(z+1)} \;,\;-1 \le z \le 0$$ and $$f_Z(z) = \int_{-1}^{0} f_Y(y) f_X(z-y) = e^{-\lambda z}(1-e^{-\lambda}) \;,\; z \ge 0$$
However the solutions are clearly wrong since the total area under the density function is not equal to one. Which brings me to my question, what am i missing?
The integral of $f_Z(z)$ over $z\in[-1,\infty)$ is one:
You have correctly calculated \begin{align} f_Z(z)&=\int_{-1}^z\lambda\,e^{-\lambda (z-y)}\,dy=1-e^{-\lambda(z+1)}\,,\quad -1\le z\le 0\,,\\ f_Z(z)&=\int_{-1}^0\lambda\,e^{-\lambda (z-y)}\,dy=e^{-\lambda z}(1-e^{-\lambda})\,,\quad 0\le z\,. \end{align} Somewhere here you made a mistake: \begin{align} \int_{-1}^0f_Z(z)\,dz&=\int_{-1}^01-e^{-\lambda(z+1)}\,dz=1-e^{-\lambda}\frac{e^{\lambda}-1}{\lambda}=1-\frac{1-e^{-\lambda}}{\lambda}\,,\\[2mm] \int_0^\infty f_Z(z)\,dz&=\int_0^\infty e^{-\lambda z}(1-e^{-\lambda})\,dz=(1-e^{-\lambda})\frac{1}{\lambda}=\frac{1-e^{-\lambda}}{\lambda}\,. \end{align}