# Calculating PDF conditioned on event

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(Xy') = \frac{d}{dx}\left[\frac{Pr(Xy')}{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

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

• Two such random variables don't exist.
– whuber
Commented Jun 15, 2023 at 13:57
• 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)" ? Commented Jun 15, 2023 at 14:01
• @whuber You are right. I've changed the definition of their distributions. now I think it should make sense Commented Jun 15, 2023 at 14:30
• 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.
– whuber
Commented Jun 15, 2023 at 15:41
• @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)$." Commented Jul 20, 2023 at 13:06

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?

• 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).$
– whuber
Commented Jul 18, 2023 at 16:13
• 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.
– whuber
Commented Jul 18, 2023 at 16:20
• Thanks for that link. And yes, I agree $(X,Y)$ being uniformly distributed is certainly much easier!
– djr
Commented Jul 18, 2023 at 16:25