Distribution Difference of Two Independent Random Variables

  • Thread starter izelkay
  • Start date
  • #1
115
3

Homework Statement


Z = X - Y and I'm trying to find the PDF of Z.

Homework Equations


Convolution

The Attempt at a Solution



Started by finding the CDF:
Fz(z) = P(Z ≤ z)

P(X - Y ≤ z)

So I drew a picture

jXF8OPD.png

So then should Fz(z) be:
L3ergX2.png

since, from my graph, it looks as though Y can go from negative infinity to positive infinity, and X can go from negative infinity on the left but is bounded by z+y on the right

then should the pdf be:
Edit: sorry I forgot to include the fact that, because fx and fy are independent, f(x,y) = fxfy in the following derivation
lTE7FtX.png

?
 
Last edited:

Answers and Replies

  • #2
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,728

Homework Statement


Z = X - Y and I'm trying to find the PDF of Z.

Homework Equations


Convolution

The Attempt at a Solution



Started by finding the CDF:
Fz(z) = P(Z ≤ z)

P(X - Y ≤ z)

So I drew a picture

jXF8OPD.png

So then should Fz(z) be:
L3ergX2.png

since, from my graph, it looks as though Y can go from negative infinity to positive infinity, and X can go from negative infinity on the left but is bounded by z+y on the right

then should the pdf be:
Edit: sorry I forgot to include the fact that, because fx and fy are independent, f(x,y) = fxfy in the following derivation
lTE7FtX.png

?
What is your question?
 
  • #3
Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
16,829
6,643
Your approach looks reasonable. Is there something you are particularly worried about?
 
  • #4
115
3
Oh yes, sorry I was wondering if what I arrived at for the PDF of the difference of two independent random variables was correct.
proxy.php?image=http%3A%2F%2Fi.imgur.com%2FlTE7FtX.png

I tried Googling but all I could find was the pdf of the sum of two RVs, which I know how to do already.
 
  • #5
Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
16,829
6,643
Yes, it looks ok. You should note that if you know the pdf of the sum and the pdf of the negative of a distribution (i.e., if you know how the the distribution of ##Y##, what is the distribution of ##-Y##), then you can use these two to obtain the distribution of ##X-Y##.
 
  • Like
Likes izelkay
  • #6
115
3
Yes, it looks ok. You should note that if you know the pdf of the sum and the pdf of the negative of a distribution (i.e., if you know how the the distribution of ##Y##, what is the distribution of ##-Y##), then you can use these two to obtain the distribution of ##X-Y##.
I'm going to modify the problem a little bit, can you tell me if I do it right/wrong?

X and Y are two independent random variables, each of which are uniform on (0,1). Find the pdf of Z = X - Y

Using my result from above, the pdf of Z is given by:
s%3A%2F%2Fwww.physicsforums.com%2Fproxy.php%3Fimage%3Dhttp%253A%252F%252Fi.imgur.com%252FlTE7FtX.png

X ~ U(0,1) and Y ~ U(0,1)

The pdf of fx(x) and fY(y) are both 1 on (0,1) and 0 otherwise.

z goes from -1 to 1 because of X - Y right?

For -1 ≤ z ≤ 0
fy is uniform only on (0,1) so my integral limits should be z+1 to z

For 0 ≤ z ≤ 1 I wouldn't need to change the limits here, just from 0 to 1

So then the pdf of X - Y is:

R2EM2LA.png

Is this correct?
 
  • #7
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,728
I'm going to modify the problem a little bit, can you tell me if I do it right/wrong?

X and Y are two independent random variables, each of which are uniform on (0,1). Find the pdf of Z = X - Y

Using my result from above, the pdf of Z is given by:
s%3A%2F%2Fwww.physicsforums.com%2Fproxy.php%3Fimage%3Dhttp%253A%252F%252Fi.imgur.com%252FlTE7FtX.png

X ~ U(0,1) and Y ~ U(0,1)

The pdf of fx(x) and fY(y) are both 1 on (0,1) and 0 otherwise.

z goes from -1 to 1 because of X - Y right?

For -1 ≤ z ≤ 0
fy is uniform only on (0,1) so my integral limits should be z+1 to z

For 0 ≤ z ≤ 1 I wouldn't need to change the limits here, just from 0 to 1

So then the pdf of X - Y is:

R2EM2LA.png

Is this correct?
No, it cannot possibly be correct, because you would have f(z) = -1 for -1 < z < 0 and f(z) = 1 for 0 < z < 1. That kind of f cannot be a probability density function.

You need to go back and evaluate the limits more carefully; in cases like this, drawing an x,y diagram of the integration region would be helpful.
 
  • Like
Likes izelkay
  • #8
115
3
No, it cannot possibly be correct, because you would have f(z) = -1 for -1 < z < 0 and f(z) = 1 for 0 < z < 1. That kind of f cannot be a probability density function.

You need to go back and evaluate the limits more carefully; in cases like this, drawing an x,y diagram of the integration region would be helpful.
I don't have much practice drawing integration regions of density functions and I wouldn't know where to start with this one besides drawing the box with vertices (0,0), (0,1), (1,0), (1,1).

I think I found another way to look at it though:

If -1 ≤ z ≤ 0,

If I want fx(z+y) to be 1, I need to shift the bounds by +1, and then I'll need z+y+1 ≥ 0 , or y ≥ -1-z

So
JuURESd.png


Then on 0 ≤ z ≤ 1,

I need z+y ≤ 1, or y ≤ 1 - z

So
do0sH.png


Then all together this is:

1 + z , -1 ≤ z ≤ 0
1 - z , 0 ≤ z ≤ 1

I got the same answer as here: http://www.math.wm.edu/~leemis/chart/UDR/PDFs/StandarduniformStandardtriangular.pdf
but I'm not sure my process is correct because my bounds are a little different than theirs, and I don't know how they computed the cdf
 
  • #9
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,728
I don't have much practice drawing integration regions of density functions and I wouldn't know where to start with this one besides drawing the box with vertices (0,0), (0,1), (1,0), (1,1).

I think I found another way to look at it though:

If -1 ≤ z ≤ 0,

If I want fx(z+y) to be 1, I need to shift the bounds by +1, and then I'll need z+y+1 ≥ 0 , or y ≥ -1-z

So
JuURESd.png


Then on 0 ≤ z ≤ 1,

I need z+y ≤ 1, or y ≤ 1 - z

So
do0sH.png


Then all together this is:

1 + z , -1 ≤ z ≤ 0
1 - z , 0 ≤ z ≤ 1

I got the same answer as here: http://www.math.wm.edu/~leemis/chart/UDR/PDFs/StandarduniformStandardtriangular.pdf
but I'm not sure my process is correct because my bounds are a little different than theirs, and I don't know how they computed the cdf
You already drew part of the diagram in Post #1. You just need to add the boundary lines x = 0, x = 1, y = 0, y = 1 and you are done---that's your drawing!

You say you "don't know how they computed the cdf". Well, you claimed before that you know how to compute the cdf of a SUM, and that is all you need to do.

If ##Z = X-Y## then ##S = Z+1## has the form ##S = X + (1-Y) = X + Y'##, where ##X## and ##Y' = 1-Y## are independent and ##\rm{U}(0,1)## random variables. Thus, ##S## is the sum of two uniforms, and has a well-known, widely-documented triangular density:
[tex] f_S(s) = \begin{cases} s, & 0 < s < 1\\ 2-s, & 1 < s < 2\\
0 & \rm{elsewhere}
\end{cases} [/tex]
Now just shift the graph of ##f_S(s)## one unit to the left, and that would be your density of ##Z##: ##f_Z(z) = f_S(1+z), \; -1 < z < 1##.
 
Last edited:
  • Like
Likes izelkay

Related Threads on Distribution Difference of Two Independent Random Variables

Replies
1
Views
9K
Replies
21
Views
8K
Replies
7
Views
271
  • Last Post
Replies
5
Views
2K
  • Last Post
Replies
6
Views
572
Replies
1
Views
2K
  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
1
Views
1K
Top