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

I was able to compute joint pdf of $(X_1,X_2)$ and marginal pdf of $X_1$.

$$ p(x_1,x_2) = \frac{1}{x_1}, \text{ for }\quad 0\le x_1\le 1, \quad 0\le x_2 \le x_1,$$

$$ p(x_1)= 1, \text{ for } \quad 0\le x_1\le 1.$$

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

Am I wrong somwhere? Thanks.

  • Do you by any chance mean that X2 is distributed as U[0, X1]? – SheldonCooper Feb 25 '11 at 19:53
  • SheldonCopper: That's correct. I'll change it. – user1102 Feb 25 '11 at 21:24
  • 1
    The limits for the marginal of $X_2$ are not from 0 to 1 except when $X_2 = 0$. – whuber Feb 25 '11 at 23:04
  • Thanks whuber. You are correct. So, we have to substitute limits for marginal density of X2 as X1=X2 to X1=1. – user1102 Feb 25 '11 at 23:24
up vote 3 down vote accepted

In the "marginalisation" integral, the lower limit for $x_1$ is not $0$ but $x_2$ (because of the $0<x_2<x_1$ condition).

So the integral should be:

$$p(x_2)=\int p(x_1,x_2) dx_1=\int \frac{I(0\leq x_2\leq x_1\leq 1)}{x_1} dx_1=\int_{x_2}^{1} \frac{dx_1}{x_1}=log\big(\frac{1}{x_2}\big)$$

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.

  • Yeah, I figured it out before you gave the answer :) ... Thanks. – user1102 Feb 26 '11 at 4:33
  • $\log (1/x_2) = - \log (x_2)$ which is what I found – Henry Feb 26 '11 at 9:29

You should not have $X_1$ in the marginal distribution for $X_2$

I would expect you to get $P(X_2 \le x_2) = x_2 (1-\log(x_2))$ and so the derivative gives a marginal density of $-\log(x_2)$.

This comes from $P(X_2 \le x_2 |X_1=x_1) = 1$ if $x_1 \le x_2$, and $ P(X_2 \le x_2 |X_1=x_1) = \frac{x_2}{x_1}$ if $x_2 \le x_1$ so the integral is $$P(X_2 \le x_2) = \int_{x_1=0}^{x_2} dx_1 + \int_{x_1=x_2}^{1} \frac{x_2}{x_1} dx_1$$ $$ = \left[ x_1 \right]_{x_1=0}^{x_1=x_2} + \left[x_2 \log(x_1)\right]_{x_1=x_2}^{x_1=1} $$ $$ = x_2 - 0 +x_2 \log(1) - x_2 \log(x_2) $$ $$ = x_2 (1-\log(x_2))$$

  • Henry: log(X1) is after integrating (but before substituting limits) for marginal of X2. Your P(X2) is wrong. I believe you are integrating log(X1) that I said which we get after integration itself. – user1102 Feb 25 '11 at 21:23
  • @Harpreet: testing using R, it is clear to me that $P(X_2 \le x_2) = x_2 (1-\log(x_2))$ is correct for $0 < x_2 < 1$. I have also expanded the integrals to show how this is obtained. So which $P(X_2)$ do you think is wrong? – Henry Feb 25 '11 at 23:16
  • P(X2)=int(1/X1). – user1102 Feb 25 '11 at 23:21
  • Thanks Henry. But I think what you are doing is correct, however marginal of X2 will be $ln(X_1)$ without limits. – user1102 Feb 25 '11 at 23:26
  • $X_1 \le 1$ so $\ln(x_1) \le 0$, which means it cannot be a density or distribution function. And I still think $X_1$ should not appear in the marginal distribution of $X_2$. says the same thing in "The distribution of the marginal variables (the marginal distribution) is obtained by marginalizing over the distribution of the variables being discarded, and the discarded variables are said to have been marginalized out." – Henry Feb 26 '11 at 1:54

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.