Suppose we have random variable X1 distributed as U[0,1] and X2 distributed as U[0,X1], where U[a,b] means uniform distribution in interval [a,b].

I was able to compute joint pdf of (X1,X2) and marginal pdf of X1.

p(x1,x2)=1x1, for 0≤x1≤1,0≤x2≤x1,

p(x1)=1, for 0≤x1≤1.

However while computing marginal pdf of X2 I am encountering limits problem. The resultant of integral through marginal of X2 is log(X1) and the limits are from 0 to 1. As log(X1) is not defined for X1=0, I am facing a difficulty.

Am I wrong somwhere? Thanks.

**Answer**

In the “marginalisation” integral, the lower limit for x1 is not 0 but x2 (because of the 0<x2<x1 condition).

So the integral should be:

p(x2)=∫p(x1,x2)dx1=∫I(0≤x2≤x1≤1)x1dx1=∫1x2dx1x1=log(1x2)

You have stumbled across, what I think is one of the hardest parts of statistical integrals - determining the limits of integration.

NOTE: This is consistent with Henry's answer, mine is the PDF, and his is the CDF. Differentiating his answer gives you mine, which shows we are both right.

**Attribution***Source : Link , Question Author : Community , Answer Author : probabilityislogic*