[Math] Finding convolution of exponential and uniform distribution- how to set integral limits

convolutionprobabilityprobability distributionsrandom variables

I am studying the convolution method for creating the density function of two independent random variables and I am struggling with understanding how the bounds for integrals are created.

There is one example of a problem where I don't get the right answer:

Let $X$ be an exponential random variable with parameter $\lambda$ and $Y$ be a uniform random variable on $[0,1]$ independent of $X$. Find the probability density function of $X + Y$:

so I have two marginal functions

$\mathbf{\\ f_X(x)=\begin{cases}
\lambda e^{-\lambda x} & x\geq 0\\
0 & \text{otherwise}
\end{cases}}
\ \hspace{20pt} \
\mathbf{f_Y(y)=\begin{cases}
1 & 0\leq x\leq 1\\
0 & \text{otherwise}
\end{cases}}$

I am looking for $Z=X+Y$. My understanding is that two cases should be considered. First for $0\leq z\leq 1$ and second for $z>1$

for $\mathbf{0\leq z\leq 1\\
(f_X*f_Y)(z)=\int_{0}^{z} f_Y(z-y) \ f_X(y) \ dy = \int_0^z \lambda e^{-\lambda y} dy =
[-e^{-\lambda y}]_{0}^{z} = 1 – e^{-\lambda z}}$

It seems that I got it correct to this point (in line with the given answer).

for $\mathbf{z>1}\\
\mathbf{(f_X*f_Y)(z)= {\color{Red} \int_1^z f_Y(z-y) \ f_X(y) \ dy = \int_1^z \lambda e^{-\lambda y} \, dy =
[-e^{-\lambda y}]_{1}^{z} = 1 – e^{-\lambda z}=e^{-\lambda}(1-e^{-z})}}$

The result I got for $z>1$ is incorrect. I guess it is because I apply incorrect bounds to the integral and that's because I don't quite get the whole concept. I am looking for help with this example and more for general hint how to construct those intervals.

The correct answer should be:

$\mathbf{f_{X+Y}(z)=\begin{cases}
1-e^{-\lambda z} & 0 \leq z \leq 1 & \\
e^{-\lambda z}(e^\lambda -1) & z \geq 1 & \\
0 & \text{otherwise} &
\end{cases}}$

Best Answer

If $z > 1$, we also require that $0 \le z-y \le 1$, or equivalently, $$z \ge y \ge z-1.$$ Thus your lower limit of integration is not correct: clearly, for a convolution integral of a uniform distribution with width $1$, your interval of integration must also have a width of $1$, and your integral limits do not satisfy this basic property.


Note that you would not be led astray if you expressed the densities in terms of indicator functions: $$f_X(x) = \lambda e^{-\lambda x} \mathbb{1}(x \ge 0), \quad f_Y(y) = \mathbb{1}(0 \le y \le 1).$$ Then our convolution is $$\begin{align*} f_Z(z) &= \int_{x = -\infty}^\infty f_X(x) f_Y(z-x) \, dx \\ &= \int_{x=-\infty}^\infty \lambda e^{-\lambda x} \mathbb{1}(x \ge 0) \mathbb{1}(0 \le z-x \le 1) \, dx \\ &= \int_{x = 0}^\infty \lambda e^{-\lambda x} \mathbb{1}(0 \le z-x \le 1) \, dx \\ &= \int_{x=0}^\infty \lambda e^{-\lambda x} \mathbb{1}(z \ge x \ge z-1) \, dx \\ &= \mathbb{1}(0 \le z \le 1) \int_{x=0}^z \lambda e^{-\lambda x} \, dx + \mathbb{1}(z > 1) \int_{x=z-1}^z \lambda e^{-\lambda x} \, dx . \end{align*}$$

The key point here is that we have a density $f_Y(z-x)$ which is nonzero only when $z-x \in [0,1]$. This is equivalent to saying that $x \in [z-1, z]$. But $x$ must also be nonnegative, because otherwise $f_X(x)$ would be zero. So in order for both densities to be positive, we must require $x \in [0,z]$ if $z \le 1$, and $x \in [z-1, z]$ when $z > 1$. We have to take the lower endpoint to be whichever is the larger of $0$ and $z-1$. This is precisely what the last expression above does. Now it is straightforward to evaluate the integrals to obtain $$\begin{align*} f_Z(z) &= \mathbb{1}(0 \le z \le 1) (1 - e^{-\lambda z}) + \mathbb{1}(z > 1) (e^{-\lambda (z-1)} - e^{-\lambda z}) \\ &= \begin{cases} 0, & z < 0 \\ 1-e^{-\lambda z}, & 0 \le z \le 1 \\ e^{-\lambda z}(e^\lambda-1) & z > 1. \end{cases} \end{align*}$$