# Two Sum of Random Variables Problems

Two "Sum of Random Variables" Problems

## Homework Statement

Problem A:
Consider two independent uniform random variables on [0,1]. Compute the probability density function for Y = X1 + 2X2.

Problem B:
Edit: never mind, solved this one

## Homework Equations

fY(y) = F'Y(y)
FY(y) = double integral (X1+2X2 <= y) fX1X2(x1,x2)
fX1X2(x1,x2) = fX1(x1)*fX2(x2) since they're independent
for uniform RVs on [a,b], fX(x) = 1/(b-a) = 1 in this case

## The Attempt at a Solution

We worked the Y=X1+X2 version of this in class, so I feel like I at least have some idea where to start. Since X only exists inside [0,1], I know I have to break that implicit integral down into several ranges. It looks like I need to break it down into 0<y<1, 1<y<2, and 2<y<3. I can reduce the 0<y<1 case to integral(0 to y/2) dx2 * integral(0 to y-2x2) dx1.

My problem is the other two ranges. I know I can express the 2<y<3 range as 1 - the triangle above the y=X1+2X2 line, I'm just not sure how to describe that triangle. As for the 1<y<2 range, that's not even a triangle so I'm not sure how to explicitly set the limits of integration; don't I need to break it up into 2 different integrals? We haven't worked any examples like that in class, and it's been over ten years since I took calculus, so...

Last edited:

For 2<y<3, it seems like I need to integrate with respect to X2 from (y-x1)/2 to 1, but then I don't know what the limits of integrate with respect to X1 would be.

LCKurtz
Homework Helper
Gold Member

## Homework Statement

Problem A:
Consider two independent uniform random variables on [0,1]. Compute the probability density function for Y = X1 + 2X2.

Problem B:
Edit: never mind, solved this one

## Homework Equations

fY(y) = F'Y(y)
FY(y) = double integral (X1+2X2 <= y) fX1X2(x1,x2)
fX1X2(x1,x2) = fX1(x1)*fX2(x2) since they're independent
for uniform RVs on [a,b], fX(x) = 1/(b-a) = 1 in this case

## The Attempt at a Solution

We worked the Y=X1+X2 version of this in class, so I feel like I at least have some idea where to start. Since X only exists inside [0,1], I know I have to break that implicit integral down into several ranges. It looks like I need to break it down into 0<y<1, 1<y<2, and 2<y<3.

Yes, that's exactly correct.

I can reduce the 0<y<1 case to integral(0 to y/2) dx2 * integral(0 to y-2x2) dx1.

My problem is the other two ranges. I know I can express the 2<y<3 range as 1 - the triangle above the y=X1+2X2 line,

I'm just not sure how to describe that triangle.

As for the 1<y<2 range, that's not even a triangle so I'm not sure how to explicitly set the limits of integration; don't I need to break it up into 2 different integrals? We haven't worked any examples like that in class, and it's been over ten years since I took calculus, so...

For 2<y<3, it seems like I need to integrate with respect to X2 from (y-x1)/2 to 1, but then I don't know what the limits of integrate with respect to X1 would be.

You need the equations of the lines that separate the cases. You are looking at

Y = X1 + 2X2 ≤ y

You are correct that the dividing lines are when y = 1, 2, and 3. And you need to draw those dividing lines, whose equations are:

X1 + 2X2 = 1
X1 + 2X2 = 2
X1 + 2X2 = 3

Those divide the unit square into three regions where your joint density is 1, which I think you already understand. I'm drawing the X2 axis like the y axis and the X1 axis as the x axis. You should integrate in the X2 direction first.

If 0 < y < 1, the line X1 + 2X2 = y will cut through the bottom triangle. X2 will go from 0 to the X2 on the line and X1 will go from 0 to y. Your double integral should look like this:

$$\int_0^{\frac y 2}\int_0^{\frac{y-X_1}{2}}1\, dX_2dX_1$$

Then you do the same thing for the middle range. Unfortunately, you are correct that you will have to break it up into two integrals. However, this might be a good place to point out that a double integral of 1 over a region just gives the area of the region. So you could figure out these integrals with geometry.

Does that help?

The limits of integration for the outer integral in double integrals like this still don't quite make sense to me; I can usually sort of see why the right answer is right, but I'm not really certain how to get there. The way of defining the limits that seems natural to me keeps setting the limits of each X in terms of the other, instead of the first in terms of the second and the second in terms of Y.

For 0<y<1:

I'm not sure why it's your version rather than my version; they give slightly different answers. Can you point out to me where I went wrong?

Yours: integral(X1: 0 to y/2) of dx1 * ( integral(X2: 0 to (y-x1)/2) dx2 )
Mine: integral(X2: 0 to y/2) of dx2 * ( integral(X1: 0 to y-2x2) dx1 )

Yours resolves to (3/16)y2, mine resolves to (1/4)y2.

For 1<y<2:

I'm don't understand what you mean about a double integral of one over the region; I'm going to continue looking at it the normal(?) way.

In splitting it up, it looks like I end up with a rectangle (where neither of the double integrals' limits of integration contains a term from the other variable) and a triangle (which I set up like the other triangles :uhh:).

For the rectangle, it looks like I want integral(X1: 0 to 1) and integral(X2: 0 to y/2). Side note: does the order of integration here matter?

The triangle is even trickier than usual, since I need to make sure I don't include, and thus double-count, any of the rectangle.

My first guess would be something along the lines of integral(X2: y/2 to 1-(y/2)) of integral(X1: 0 to y-2x2).

Am I at least on the right track, here?

For 2<y<3:

I want the upper triangle, so maybe integral(X1: 3-y to 1) of integral(X2: (y-x1)/2 to 1)?

This is due in not quite 7 hours, so quick responses would really be appreciated. Thanks for all the help you've given already!

Last edited:

Talked with someone else who suggested I model it as Y=X1+X3, X3 = X2. I'm going to try working it out that way real quick.

Think I'm making progress this way, but I'm not sure I'm doing it right. Shouldn't my equations for FY(y) for 0<y<1 and for 1<y<2 give the same result at y=1?

fX1X3(x1,x3) = 1/2

0<y<1 => integral(X3: 0 to y) dx3 * integral(X1: 0 to y-x3) (1/2)dx1
1<y<2 => ( integral(X3: 0 to y-1) dx3 * integral(X1: 0 to 1) (1/2)dx1 ) + integral(X3: y-1 to y) dx3 * integral(X1: 0 to y-x3) (1/2)dx1
2<y<3 => 1 - ( integral(X3: y-1 to 2) dx3 * integral(X1: y-x3 to 1) (1/2)dx1 )

Assuming my brain hasn't betrayed me (again), those resolve to:

0<y<1 => (1/4)y2
1<y<2 => (1/2)y
2<y<3 => 1 - (1/4)(y-3)2

I properly get FY(0) = 0 and FY(3) = 1, but when I plug 1 into the first two parts I get different results, and when I plug 2 into the second parts I get different results. Shouldn't I have smooth transitions there rather than jumps?

Edit: Never mind, I worked out the second one wrong, it should be (1/2)y - (1/4). Now I get smooth transitions.

Last edited:
vela
Staff Emeritus
Homework Helper

The limits of integration for the outer integral in double integrals like this still don't quite make sense to me; I can usually sort of see why the right answer is right, but I'm not really certain how to get there. The way of defining the limits that seems natural to me keeps setting the limits of each X in terms of the other, instead of the first in terms of the second and the second in terms of Y.

For 0<y<1:

I'm not sure why it's your version rather than my version; they give slightly different answers. Can you point out to me where I went wrong?

Yours: integral(X1: 0 to y/2) of dx1 * ( integral(X2: 0 to (y-x1)/2) dx2 )
Mine: integral(X2: 0 to y/2) of dx2 * ( integral(X1: 0 to y-2x2) dx1 )

Yours resolves to (3/16)y2, mine resolves to (1/4)y2.
The upper limit for X1 on LCKurtz' integral should be y, not y/2. He described the range correctly in words; he just made a typo in the integral.

The upper limit for X1 on LCKurtz' integral should be y, not y/2. He described the range correctly in words; he just made a typo in the integral.

OK, that explains it. They both looked right at a glance, and I was sure you could express it either way, but they weren't giving me the same answer so I was getting confused.

Doing X3=2X2 and Y=X1+X3 has been way easier for me to visualize, I'm finishing it up now and the answers seem to work (i.e. I get numbers between 0 and 1, smooth transitions, F(0)=0, F(3)=1).

LCKurtz
Homework Helper
Gold Member

Assuming my brain hasn't betrayed me (again), those resolve to:

0<y<1 => (1/4)y2
1<y<2 => (1/2)y
2<y<3 => 1 - (1/4)(y-3)2

I properly get FY(0) = 0 and FY(3) = 1, but when I plug 1 into the first two parts I get different results, and when I plug 2 into the second parts I get different results. Shouldn't I have smooth transitions there rather than jumps?

Edit: Never mind, I worked out the second one wrong, it should be (1/2)y - (1/4). Now I get smooth transitions.

Sorry, I just got back on for a brief moment today. But I'm happy to see you have the above answers, because they are correct. Good work.

vela
Staff Emeritus
Homework Helper

For 1<y<2:

I'm don't understand what you mean about a double integral of one over the region; I'm going to continue looking at it the normal(?) way.

In splitting it up, it looks like I end up with a rectangle (where neither of the double integrals' limits of integration contains a term from the other variable) and a triangle (which I set up like the other triangles :uhh:).

For the rectangle, it looks like I want integral(X1: 0 to 1) and integral(X2: 0 to y/2). Side note: does the order of integration here matter?

The triangle is even trickier than usual, since I need to make sure I don't include, and thus double-count, any of the rectangle.

My first guess would be something along the lines of integral(X2: y/2 to 1-(y/2)) of integral(X1: 0 to y-2x2).

Am I at least on the right track, here?
I didn't read too closely, but it sounds like your approach was fine. That said, you were making it unnecessarily complicated. There's no need to break the region up into two pieces. Just let X1 run from 0 to 1, and X2, from 0 to the line y=X1+2X2.

OK, got it now. Thanks for your help guys, I was definitely making it way too complicated before.