I'm confused about problems where we calculate a PDF conditioned on an event.

Consider this simple problem:

We have two random variables, X and Y, X is uniformly distributed on [a,b], and Y is uniform on [a,X]. We want to find the PDF of f(x|Y>y').

What's the best approach to calculate this?

An approach that comes to my mind is to define this PDF as the derivative of its CDF: $$ f(x|Y>y') = \frac{d}{dx}Pr(X<x|Y>y') = \frac{d}{dx}\left[\frac{Pr(X<x,Y>y')}{Pr(Y>y')}\right]=\frac{d}{dx}\left[\frac{\int_{a}^{x}\int_{y'}^{b}{f(x,y)dydx}}{\int_{y'}^{b}{f_{y}(y)dy}}\right] $$ And we know that: $$ f(y|x) = \begin{cases} \frac{1}{x-a} &a<y<x \\ 0 & \mbox{elsewhere} \end{cases} $$

$$ f(x,y) = f_x(x)*f(y|x) = \begin{cases} \frac{1}{(x-a)(b-a)} &a<y<x<b \\ 0 & \mbox{elsewhere} \end{cases} $$ $$ f_y(y) = \begin{cases} \int_{y}^{b}\frac{1}{(x-a)(b-a)}dx &a<y \\ 0 & \mbox{elsewhere} \end{cases} $$ Is this approach correct? Is there a better approach that's more straightforward?

  • 1
    $\begingroup$ Two such random variables don't exist. $\endgroup$
    – whuber
    Commented Jun 15, 2023 at 13:57
  • $\begingroup$ I'm wondering whether you might have mis-worded the question. If X and Y are uniformly distributed, this implies their distributions are independent of one and other. That means, given they have the same support, it cannot be true that X is always larger than Y. I'm wondering whether maybe you meant to ask something like "given that X,Y are distributed in this way, what if we are told X>Y, i.e. what is p(X|X>Y)" ? $\endgroup$
    – gazza89
    Commented Jun 15, 2023 at 14:01
  • $\begingroup$ @whuber You are right. I've changed the definition of their distributions. now I think it should make sense $\endgroup$ Commented Jun 15, 2023 at 14:30
  • $\begingroup$ The best approach, IMHO, is to draw a diagram of the events in question. The appropriate conditional probabilities are ratios of areas in that diagram. $\endgroup$
    – whuber
    Commented Jun 15, 2023 at 15:41
  • $\begingroup$ @whuber I think we should be more forgiving of the OP's mispunctuation and read the problem as asking "We have two random variables $X$ and $Y$. $X$ is uniformly distributed on $[a,b]$, and $Y$ is uniform on $[a,X]$. We want to find $f_{X\mid Y>y}(x\mid Y>y)$." $\endgroup$ Commented Jul 20, 2023 at 13:06

1 Answer 1


Yes, I think your approach is correct.

Perhaps a slightly simpler way to see this would be to note $f_{X|Y}(x|y) = \frac{f_{X,Y}(x,y)}{f_Y(y)}$ and then to integrate $y$ over $(y', b]$.
This would give $\frac{\int_{(y', b]} f_{X,Y}(x,y) dy}{\int_{(y', b]} f_Y(y) dy}= \frac{\int_{y'}^b f_{X,Y}(x,y) dy}{\int_{y'}^b f_Y(y) dy}$ which, by the Fundamental Theorem of Calculus, is the same as the derivative of the CDF you gave.

A side note, whuber suggests that a simple geometric approach could work as well, but I don't see it; could they elaborate?

  • $\begingroup$ Because $a$ and $b$ just determine location and scale, it suffices to analyze one case, of which the simplest is $a=0,$ $b=1.$ By applying the concepts explained at stats.stackexchange.com/a/584907/919 you can immediately see (in the drawing) that the conditional density of $x$ is supported on $[y^\prime,1]$ and must be proportional to $(x-y^\prime)/x$ on that interval. That's an answer right there. If you need the constant of proportionality, computing the integral is elementary: $\int_{y^\prime}^1(x-y^\prime)/x\,\mathrm dx = 1-y^\prime+y^\prime\log(y^\prime).$ $\endgroup$
    – whuber
    Commented Jul 18, 2023 at 16:13
  • $\begingroup$ BTW, the question changed after I posted my original comment. The first version of the question stated $(X,Y)$ had a uniform distribution. That's considerably easier to analyze. $\endgroup$
    – whuber
    Commented Jul 18, 2023 at 16:20
  • 1
    $\begingroup$ Thanks for that link. And yes, I agree $(X,Y)$ being uniformly distributed is certainly much easier! $\endgroup$
    – djr
    Commented Jul 18, 2023 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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