# Finding the pdf of $f(x,y) = e^{-x-y}$ where $Z = X+Y$

I am having trouble understanding how to find the pdf $$f_Z(z)$$ when $$f_{X,Y}(x,y) = e^{-x-y}, x,y \space \epsilon(0,\infty)$$ where $$Z = X+Y$$

My approach is that

$$x = x, y = z-x$$

so using transformation

$$f_z(z)=f_{X,Y}(x,z-x)|J|$$

where J is the Jacobian.

From this I calculated

$$f_Z(z) = e^{-z}$$

but it does not seem to be the correct answer...

What did I do wrong?

The Jacobian that I calculated was

$$\left | \begin{matrix} \frac{\partial x}{\partial x} =1 & \frac{\partial x}{\partial z} =0 \\ \frac{\partial y}{\partial x} =1 & \frac{\partial y}{\partial z} =-1 \\ \end{matrix} \right | = 1$$

and I am not confident that this is right.

• There are many solutions to $x+y=z$, you need to integrate over them, so what you seek is $f_Z(z) = \int_{0}^\infty f_{X,Y}(x,z-x) dx$. Ususally in order to not make any mistakes, I use the cdf instead because it is always a probability and not a density. – P. Quinton Feb 17 at 7:30
• In your formula, it should be $f_{X,Z}(x,z)$ on the left hand side, not $f_Z$. Once you get the joint pdf for $X,Z$ you marginalize to get $f_Z$. This is basically equivalent to P. Quinton's comment. – GReyes Feb 17 at 7:36
• Thank you for your help! I will see where I can get. – hyg17 Feb 17 at 7:38
• Also, observe that $f_{X,Y}(x,z-x)=e^z$ only if $z-x>0$! – GReyes Feb 17 at 7:46
• You could choose for an alternative: from $f_{X,Y}(x,y)=e^{-x-y}$ it follows (almost) immediately that $X,Y$ are iid with standard exponential distribution. Based on that you can find $1-F(z)=P(Z>z)$ and take the derivative of $F$. Personally I am not fond of Jacobians and always try to avoid them. – drhab Feb 17 at 8:04

Approach 1: By the joint density of $$(X, Y)$$, it can be seen that $$X, Y$$ i.i.d. $$\sim \text{Exp(1)}$$, therefore $$Z = X + Y$$ has $$\Gamma(2, 1)$$ distribution (this is a property of exponential distribution, see this link).
Approach 2: Calculate the distribution function of $$Z$$ directly, for $$z > 0$$: \begin{align} & P[Z \leq z] = P[X + Y \leq z] \\ = & \int_0^z\int_0^{z - x} f_{X, Y}(x, y)dy dx \\ = & \int_0^z \int_0^{z - x}e^{-x - y}dy dx \\ = & \int_0^z e^{-x}(1 - e^{-(z - x)})dx \\ = & \int_0^ze^{-x}dx - \int_0^z e^{-z}dx \\ = & 1 - e^{-z} - ze^{-z}. \end{align} Therefore, $$f_Z(z) = \frac{dP[Z \leq z]}{dz} = e^{-z} - (e^{-z} - ze^{-z}) = ze^{-z}$$, which is the density of $$\Gamma(2, 1)$$ distribution.
Approach 3: This is your attempt. You may not use $$x$$ in both the pre-transformation and post-transformation versions. It's better to write the transformation as $$\begin{cases} W = X \\ Z = X + Y. \end{cases}$$ The Jacobian then becomes \begin{align}\frac{\partial(x, y)}{\partial(w, z)} = & \det\begin{pmatrix}\partial x / \partial w & \partial x / \partial z \\ \partial y / \partial w & \partial y / \partial z \end{pmatrix} \\ = & \det\begin{pmatrix} 1 & 0 \\ -1 & 1 \end{pmatrix} = 1. \end{align} Hence the joint density of $$(W, Z)$$ is $$f_{W, Z}(w, z) = e^{-w - (z - w)} \times 1 = e^{-z}, 0 < w < z < \infty$$. Finally, do marginalization (pay attention to the integration range of $$W$$, which probably is the reason you didn't get the correct answer): \begin{align} f_Z(z) = \int_0^z e^{-z} dw = ze^{-z}, 0 < z < \infty. \end{align}
• +1 Remark on approach 2: I would rather go for $P(Z>z)$. Makes calculations more easy. – drhab Feb 17 at 8:06
• @drhab In my opinion, go for $P(Z \leq z)$ or $P(Z > z)$ are equivalently convenient in this problem. Calculating $P(Z > z)$ is not significantly easier than $P(Z \leq z)$ (maybe slightly easier as you work with one term throughout). – Zhanxiong Feb 17 at 8:10
• My preference is actually based on a slightly different approach in calculation. For $z>0$ we have:$$P\left(Z>z\right)=\int_{0}^{z}P\left(Z>z\mid X=x\right)f_{X}\left(x\right)dx+\int_{z}^{\infty}P\left(Z>z\mid X=x\right)f_{X}\left(x\right)dx=$$$$\int_{0}^{z}e^{-z}dx+\int_{z}^{\infty}e^{-x}dx=ze^{-z}+e^{-z}$$ Negative derivative is $ze^{-z}$. – drhab Feb 17 at 8:28
• Thank you so much! It's just that the fact that $f(z)$ is the marginal does not click with me very well, so I will approach this problem using probability then take the derivative. Thank you for clarifying my approach, though. That was awesome. – hyg17 Feb 17 at 8:38