# Joint PDF of two random variables with Uniform Distribution

I have random variables X and Y. X is chosen randomly from the interval (0,1) and Y is chosen randomly from (0, x). I want to calculate the conditional PDF of Y given X. I want to do this by calculating the joint PDF of X and Y and dividing that by the marginal PDF of X.

The marginal PDF of X is simply 1, since we're equally likely to pick a number from the range of (0,1). We can verify this using calculus by taking the derivative of the CDF, which is simply F(X <= x) = x/1, or x. The derivative of xdx = 1.

I'm struggling with the joint PDF. I have a strong feeling it's 1/x, however I'd like some advice on how to get it.

Yes.   The density function for a random variable uniformly distributed over support $(0;1)$ is: $$f_X(x)= \mathbf 1_{x\in(0;1)}$$

Then, assuming that $Y$ is uniformly selected in the interval $(0;X)$ , the conditional probability density function is, indeed, $$f_{Y\mid X}(y\mid x) = \frac 1 x \; \mathbf 1_{y\in(0;x), x\in(0;1)}$$

The joint density function is: $f_{X,Y}(x,y) = f_X(x) \; f_{Y\mid X}(y\mid x)$

And the marginal of Y, is $f_Y(y)=\int_0^1 f_{Y\mid X}(y\mid x)\;f_X(x)\,\operatorname d x$

You can do the rest.

• thanks, this was very helpful Jun 25, 2015 at 4:00
• In the OP, it says $Y$ is "chosen from $U(0,x)$. Typically, when it's worded like that, it means $f_Y(y) = \frac{1}{x}$, right? But here it appears to mean that it's the conditional pdf, rather than the marginal. Apr 1, 2021 at 14:34

The conditional pdf of $Y$ given $X$ is given to you. Choose $X$ from $(0,1)$, then choose $Y$ from $(0,X)$. It is telling you that given $X$, you know the distribution of $Y$.

$$f_{Y\mid X}(y \mid x) = 1_{[0,x]} \cdot \frac{1}{x}$$

for all $x,y \in (0,1)$.