Find the density of the sum of two jointly distributed rv's

In summary, to find the distribution of Z=X+Y, we first set the bounds for X and Y and find the probability that Y is less than or equal to z - X. We then use substitution to simplify the integral and find the cumulative distribution function of Z. However, we must also consider the marginal distribution of X and integrate it along with the distribution function to ensure that the result is positive and valid.
  • #1
Eclair_de_XII
1,083
91

Homework Statement


"Given that the joint distribution of ##X## and ##Y## is ##f(x,y)=\frac{1}{2}(x+y)e^{-(x+y)},\text { for } x,y>0## and ##0## otherwise, find the distribution of ##Z=X+Y##."

Homework Equations


##f_Z(z)=\int_{\mathbb{R}}f(x,z-x)dx##
##P(Z<z)=F_Z(z)=P(X+Y<z)=P(Y<z-X)=\int_{\mathbb{R}} \int_{-\infty}^{z-x}f(x,y)dydx##

The Attempt at a Solution


##f_Z(z)=\int_0^\infty \frac{1}{2}[x+(z-x)]e^{-[x+(z-x)]}dx=\frac{1}{2} \int_0^\infty ze^{-z}dx=\frac{1}{2}ze^{-z}x|_0^\infty##

The problem is that the density function seems to always tend towards infinity no matter which equation I use...
 
Last edited:
Physics news on Phys.org
  • #2
It's probably not that simple, but why isn't ## f(z)=\frac{1}{2}z \, e^{-z} ## for z>0 ?
 
  • #3
my motto is start simple and build. I'd start by integrating out / marginalizing ##Y## to get the marginal of ##X## -- you can either re-run the process or use symmetry to then get the marginal of ##Y##. Then confirm that your calculated distribution for ##X## is a bonafide random variable-- i.e. that the density integrates to one.

Then convolve these two. The convolution (sum) of two bonafide random variables always produces an actual random variable.

Eclair_de_XII said:
##f_Z(z)=\int_{\mathbb{R}}f(x,z-x)dx##
##P(Z<z)=F_Z(z)=P(X+Y<z)=P(Y<z-X)=\int_{\mathbb{R}} \int_{-\infty}^{z-x}f(x,y)dydx##

You need to be a lot more careful here. We've been through this before -- while you can get away with sloppy use of strictness of inequalities for purely continuous random variables, at some point this is going to cause immense problems and you'll be blind sided by it. The convention for a CDF is ##P(Z\leq z)=F_Z(z)## -- I highly doubt your book by Grimmett breaks this convention.

by the way in terms of pattern recognition, it should jump out at you that you're dealing with something exponential random variable-ish. For a lot of uses they are the nicest behaved random variables. I'd probably say to just do the convolution directly, but since this is heavily using the exponential, you may want to try using the Moment Generating Function to do the convolution.
 
Last edited:
  • #4
Eclair_de_XII said:

Homework Statement


"Given that the joint distribution of ##X## and ##Y## is ##f(x,y)=\frac{1}{2}(x+y)e^{-(x+y)},\text { for } x,y>0## and ##0## otherwise, find the distribution of ##Z=X+Y##."

Homework Equations


##f_Z(z)=\int_{\mathbb{R}}f(x,z-x)dx##
##P(Z<z)=F_Z(z)=P(X+Y<z)=P(Y<z-X)=\int_{\mathbb{R}} \int_{-\infty}^{z-x}f(x,y)dydx##

The Attempt at a Solution


##f_Z(z)=\int_0^\infty \frac{1}{2}[x+(z-x)]e^{-[x+(z-x)]}dx=\frac{1}{2} \int_0^\infty ze^{-z}dx=\frac{1}{2}ze^{-z}x|_0^\infty##

The problem is that the density function seems to always tends towards infinity no matter which equation I use...
You are correct that ##f_Z(z) = \int_R f(x,z-x) \, dx,## and with the given form of ##f(x,y)## this is about as simple as you can get. Remember also that the integral does not go from ##x = -\infty## to ##x = +\infty##, because of the way the problem was specified; you need to figure out the actual ##x##-range for a given value of ##z > 0.##
 
  • #5
Charles Link said:
It's probably not that simple, but why isn't ## f(z)=\frac{1}{2}z \, e^{-z} ## for z>0 ?

I always do the expected values first. If you use this, then
##E\big[Z\big] = \int_{0}^\infty z \big(\frac{1}{2}z \, e^{-z}\big) = 1##

but
##E\big[Z\big] = E\big[X + Y\big] = E\big[X\big] + E\big[Y\big] = 2 \cdot E\big[X\big] = 3 \gt 1##

- - - -
a more direct explanation is that ## f(z)=\frac{1}{2}z \, e^{-z} ## integrates to one half, not one, so it's not a valid distribution. You could rescale by 2 to make it integrate to one, but you still have a problem with the expected value.
 
  • Like
Likes Charles Link
  • #6
StoneTemplePython said:
I always do the expected values first. If you use this, then
##E\big[Z\big] = \int_{0}^\infty z \big(\frac{1}{2}z \, e^{-z}\big) = 1##

but
##E\big[Z\big] = E\big[X + Y\big] = E\big[X\big] + E\big[Y\big] = 2 \cdot E\big[X\big] = 3 \gt 1##

- - - -
a more direct explanation is that ## f(z)=\frac{1}{2}z \, e^{-z} ## integrates to one half, not one, so it's not a valid distribution. You could rescale by 2 to make it integrate to one, but you still have a problem with the expected value.
Another way would be to compute the Laplace transform of the density of ##X+Y##, which is just
$$\int_{x=0}^\infty \, \int_{y=0}^\infty f(x,y) e^{-s(x+y)} \, dx \, dy.$$
 
Last edited:
  • #7
Ray Vickson said:
Remember also that the integral does not go from ##x = -\infty## to ##x = +\infty##, because of the way the problem was specified; you need to figure out the actual ##x##-range for a given value of ##z>0##.

So I drew a picture (it still surprises me how helpful this is outside of physics class)...

JZCE0fi.png


Basically, I wanted to find the area shaded pink. I set my bounds...

##0\leq y \leq z - x##
##0 \leq x \leq z##

And I want to find ##P(X+Y\leq z)=P(Y\leq z - X)##. So...

##P(Y\leq z - X)=\int_0^z \int_0^{z-x} \frac{1}{2}(x+y)e^{-(x+y)}dydx##

Some substitution...

##u=(x+y)##, ##du=dy##
##z-x\mapsto z##, ##0\mapsto x##

So we have:

##P(Y\leq z - X)=\frac{1}{2} \int_0^z \int_x^z ue^{-u}dudx=\frac{1}{2} \int_0^z[-ue^{-u}-e^{-u}]|_x^z\\
=\frac{1}{2} \int_0^z [(-ze^{-z}-e^{-z})-(-xe^{-x}-e^{-x})]dx\\
=\frac{1}{2}(-ze^{-z}-e^{-z})x|_0^z+\frac{1}{2}\int_0^z (xe^{-x}+e^{-x})dx\\
=\frac{1}{2}(-z^2e^{-z}-ze^{-z})+\frac{1}{2}(-xe^{-x})|_0^z\\
=\frac{1}{2}(-z^2e^{-z}-2ze^{-z})=F_Z(z)##

Something's not right here. ##F_Z(z)## isn't supposed to be negative. I think I forgot to find the marginal of ##X## and integrate that along with the distribution function. On the other hand, I could set the upper bound for ##x## as ##z##, and use my original integrand to get the answer in the back of the book. But I cannot be sure that it's enough.
 

Attachments

  • JZCE0fi.png
    JZCE0fi.png
    2.2 KB · Views: 654
  • #8
$$
\frac{d}{dx} (-x e^{-x}) = - e^x + x e^{-x} \neq x e^{-x} + e^{-x}
$$
 
  • #9
Eclair_de_XII said:
So I drew a picture (it still surprises me how helpful this is outside of physics class)...

View attachment 234165

Basically, I wanted to find the area shaded pink. I set my bounds...

##0\leq y \leq z - x##
##0 \leq x \leq z##

And I want to find ##P(X+Y\leq z)=P(Y\leq z - X)##. So...

##P(Y\leq z - X)=\int_0^z \int_0^{z-x} \frac{1}{2}(x+y)e^{-(x+y)}dydx##

.........

Something's not right here. ##F_Z(z)## isn't supposed to be negative. I think I forgot to find the marginal of ##X## and integrate that along with the distribution function. On the other hand, I could set the upper bound for ##x## as ##z##, and use my original integrand to get the answer in the back of the book. But I cannot be sure that it's enough.

You are doing way too much work, as you already had the correct expression back in post #1:
$$f_Z(z) = \int_R f(x,z-x) \, dx.$$ However, you forgot that ##f=0## outside the region ##\{ x \geq 0, z-x \geq 0 \}##, and inside this region the integrand ##f(x,z-x) = ## a very simple function of ##z## alone.

As to where your error occurred: you computed ##\int_0^z (x e^{-x} + e^{-x} ) \, dx## incorrectly. Use ##\int_0^z e^{-x} \, dx = 1-e^{-z}## and ##\int_0^z x e^{-x} \, dx = 1 - (z+1) e^{-z}.##
 
Last edited:
  • #10
Ray Vickson said:
Use ##\int_0^z e^{-x} \, dx = 1-e^{-z}## and ##\int_0^z xe^{−x} \, dx=1−(z+1)e^{−z}##.

##P(Y\leq z - X)=\frac{1}{2}(-z^2e^{-z}-ze^{-z})+\frac{1}{2}(1-e^{-z}+1-(z+1)e^{-z})\\
=\frac{1}{2}(-z^2e^{-z}-2ze^{-z}+2-2e^{-z})=F_Z(z)##

##\frac{d}{dz}F_Z(z)=\frac{1}{2}[(-2ze^{-z}+z^2e^{-z})-(2e^{-z}-2ze^{-z})+2e^{-z})=\frac{1}{2}z^2e^{-z}=f_Z(z)##

Okay, thank you everyone for your help.
 
  • #11
So we end up with ##Z## is Erlang of order 3 with ##\lambda = 1##. Given the exponential underneath I wonder if there is an 'easy' way, other than pattern recognition, of going from this

Ray Vickson said:
Another way would be to compute the Laplace transform of the density of ##X+Y##, which is just
$$\int_{x=0}^\infty \, \int_{y=0}^\infty f(x,y) e^{-s(x+y)} \, dx \, dy.$$

(or with a negative sign in front of s, the MGF) to the final PDF for Z...
 
  • #12
Eclair_de_XII said:
##P(Y\leq z - X)=\frac{1}{2}(-z^2e^{-z}-ze^{-z})+\frac{1}{2}(1-e^{-z}+1-(z+1)e^{-z})\\
=\frac{1}{2}(-z^2e^{-z}-2ze^{-z}+2-2e^{-z})=F_Z(z)##

##\frac{d}{dz}F_Z(z)=\frac{1}{2}[(-2ze^{-z}+z^2e^{-z})-(2e^{-z}-2ze^{-z})+2e^{-z})=\frac{1}{2}z^2e^{-z}=f_Z(z)##

Okay, thank you everyone for your help.
Even easier and faster (following your post #1):
$$f_Z(z) = \int_{x=0}^z \underbrace{f(x,z-x)}_{(1/2) z e^{-z}} \, dx = (1/2) z^2 e^{-z}.$$
 

FAQ: Find the density of the sum of two jointly distributed rv's

What is the formula for finding the density of the sum of two jointly distributed random variables?

The formula for finding the density of the sum of two jointly distributed random variables is given by convolving the individual density functions of the two random variables.

How do you interpret the resulting density function?

The resulting density function represents the probability distribution of the sum of the two random variables.

Can the density of the sum of two jointly distributed random variables be calculated if the individual density functions are unknown?

No, the density of the sum can only be calculated if the individual density functions of the random variables are known.

What assumptions are made when calculating the density of the sum of two jointly distributed random variables?

The main assumption is that the two random variables are independent of each other.

How is the density of the sum affected when the two random variables have different distributions?

The resulting density function will depend on the individual distributions of the two random variables. If the two distributions are similar, the resulting density function will also be similar. If the distributions are significantly different, the resulting density function may have a more complex shape.

Back
Top