Density of $Y\sim \text{Unif}(0,X)$ where $X\sim \text{Unif}(0,a)$

165 Views Asked by At

As the title says, I'm trying to find the probability density function of $Y\sim \text{Unif}(0,X)$ where $X\sim \text{Unif}(0,a)$ and $a>0$.

Since both variable are uniformly distributed, I know $p_X(x) = \frac{1}{a}$ and that the conditional pdf of $Y$ given $X=x$ is $p_Y(y \mid X=x) = \frac{1}{x}$.

I'm computing \begin{equation} p_Y(y) = \int_{-\infty}^{\infty} p_X(x) \: p_Y(y \mid X=x) dx = \int_{0}^{a} \frac{1}{a} \frac{1}{x} dx = \frac{1}{a} \int_{0}^{a} \frac{1}{x} dx \end{equation}

but $\frac{1}{x} $ is not integrable in the interval $[0,a]$. What am I overlooking?

I'm asking this because for a side project I'm intuitively generating a skewed distribution in $[0,a]$ by doing random(0,random(0,2)) but was curious to prove what the resulting distribution would analytically be.

Thanks in advance!

2

There are 2 best solutions below

1
On

$p(y \mid X=x)$ is $\frac{1}{x}$ only when $0 < y < x$. So the integral with respect to $x$ should actually be $\int_y^a$ instead of $\int_0^a$.

1
On

You need to consider the fact that $Y$ is always less than $X$. The conditional density is actually $$f_{Y|X}(y|x) = \begin{cases} \frac{1}{x} & 0 < y < x <a \\ 0 &\text{otherwise}\end{cases}$$ The marginal density then becomes: $$f_Y(y) = \frac{1}{a} \int_y^a \frac{1}{x} \: dx = \frac{\log(a) - \log(y)}{a}$$