# Pdf of sum of exponential random variables

I am trying to understand the following:

Let $$X$$ and $$Y$$ be independent and exponential random variables with parameter $$1$$, so $$f_X(x) =e^{-x}$$ and $$f_Y(y) =e^{-y}$$. Let $$Z=X+Y, X and $$Z=X-Y, X\geq Y$$. Determine the pdf of $$Z$$.

The solution to the exercise first calculates the cdf $$F_Z(z)=P(Z\leq z, X and then takes its derivative to obtain $$f_Z(z)=\frac{e^{-z}}{2}(1+z)$$.

This is fine but it is a bit long so I would like to do the exercise by computing the convolution to obtain $$f_Z(z)$$ directly, so I did: $$f_Z(z)=\int_{0}^{z}e^{-x}e^{-(z-x)}dx=ze^{-z}$$ for the $$X part but when doing the $$X\geq Y$$ part I get $$f_Z(z)=\int_{0}^{x}e^{-z-y}e^{-y}dy=\frac{1}{2}(e^{-z}-e^{-z-2x})$$ which is wrong.

Could someone please explain to me what I am doing wrong?

Thanks

Note: $$X$$ and $$Y$$ are non-negative random variables.

We have $$Z=X+Y$$ (ie $$Y=Z-X$$), exactly when $$Z>X$$, which is only supported when also $$X, ie $$2X.

We have $$Z=X-Y$$ (ie $$Y=X-Z$$), exactly when $$Z\leqslant X$$, which isn't further restricted by the support.

Thus we have the support joint pdf for $$X$$ and $$Z$$, and this gives the bounds for your integration.

\begin{align}f_{X,Z}(x,z) &= f_{X,Y}(x,z-x)\cdot\mathbf 1_{0\leqslant 2x

• It is a bit confusing to write $f_{X,Z}(x,z)$ in stead of $f_{Z|X}(z|x)f_{X}(x)$.
– Tan
Jan 29 at 1:45
• Uh, ... Why? @Tan Jan 29 at 1:51
• Because $f_{Z|X}(z|x)=f_{Y+x|X}(Y+x=z|x)=f_{Y|X}(z-x|x)=f_{Y}(z-x)$, where independence between $X$ and $Y$ is demonstrated clearly. However, $f_{X,Z}(x,z)$ becomes $f_{X,Y}...$ is a bit confusing.
– Tan
Jan 29 at 2:06
• When $Z=X+Y$ then clearly $f_{\small X,Z}(x,z) = f_{\small X,X+Y}(x,z)= f_{\small X,Y}(x,z-x)$; whether or not we have any independence. $\tiny\text{where, of course, such pdf exist}$ The fact of independence is only required to say $f_{\small X,Y}(x,z-x)=f_{\small X}(x)\,f_{\small Y}(z-x)$ . Jan 29 at 2:50
• @Graham Kemp great answer, thank you. Jan 29 at 9:39