Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to calculate a CDF of a random variable $x$ which has an upper bound $z$, which is itself a random variable with distribution $G(z)$ on some interval $[z1,z2]$.

E.g. $x \sim U[0,z]$ and $z \sim U[1,2]$.

share|cite|improve this question
Hint: When you write x ~ U[0,z] you actually mean that, for a given value of $z$, $x$ is uniform in $[0,z]$. Which is to say that the conditional probability of $x$ is known. – leonbloy Oct 3 '12 at 17:02
$f(x,z)=f(x|z)f(z)$. Integrate out $z$ and get marginal pdf of $x$. Then integrate to get CDF for $x$. – Patrick Li Oct 3 '12 at 17:33
What this means, if it is to make any sense, is that the CONDITIONAL distibution of $x$ given $z$ is uniform on $[0,z]$. It's easy to neglect to say that, but it's worthwhile to be precise about it. People also often forget to mention independence where it's assumed. – Michael Hardy Oct 3 '12 at 18:12
Guys, thank you so much. I tried that way, but seem to be making a mistake. In my example, f(x|z)=1/z and f(z)=1, right? Then f(x,z)=1/z and thus f(x)=ln2. But since the support for x is [0,2], the resulting F(x) is not a distribution. Moreover, logically (and using simulations), F(x) in my example should be a positively skewed function (not linear). What am I doing wrong? – TAK Oct 3 '12 at 18:57
@TAK Yes, you are right that $f(x,z)=\frac{1}{z}$ but be careful about their supports. Since $0<x<z$ and $1<z<2$, the actual joint density is $f(x, z)=\frac{1}{z}\mathbb{I}[0<x<z]\mathbb{I}[1<z<2]$. – Patrick Li Oct 3 '12 at 19:47
up vote 1 down vote accepted

The conditional pdf of $X$ given $Z$ is $f(x|z)=\frac{1}{z}\mathbb{I}[0<x<z]$. The marginal pdf of $Z$ is $f(z)=\mathbb{I}[1<z<2]$. So the joint pdf of $X$ and $Z$ is $$f(x,z)=f(x|z)f(z)=\frac{1}{z}\mathbb{I}[0<x<z]\mathbb{I}[1<z<2]$$ Then we can integrate over $z$ and get $$f(x)=\int_{\max(x,1)}^{2} f(x,z)dz=\int_{\max(x,1)}^{2}\frac{dz}{z}=\log2-\log(\max(x,1))$$

You can proceed by integrating it to get the CDF of $X$. You need to consider two different conditions when $x > 1$ and $x < 1$.

share|cite|improve this answer
Patrick, fantastic, thank you so much, you helped me a lot :):):) – user43531 Oct 3 '12 at 21:40
@TAK Glad to help. Could you accept my answer if you think it's helpful? – Patrick Li Oct 5 '12 at 12:09
Patrick, sorry for the delay. I would be more than happy to accept your answer. But I am new, could you help me to find a way to do so? Do I understand it correctly I need to earn more reputation points first? Many thanks in advance – TAK Oct 16 '12 at 13:55
@TAK The accepting answer option should be somewhere on this page. If you can't find it, that's fine with me. Glad to help. I learn something from this as well. – Patrick Li Oct 16 '12 at 19:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.