$$f(x,y) = \begin{cases} 2 & 0< x< y<1 \\ 0 &\text{otherwise} \end{cases} $$

I need to find

  1. the density function of $y$ and
  2. conditional pdf of $X$ given $Y$.

My answer is coming out to be

  1. $2y$
  2. $\frac1y$
  • 2
    $\begingroup$ Welcome to SE. Can you show how you arrived at those answers? $\endgroup$ Sep 6, 2018 at 22:24
  • $\begingroup$ To find the density function of y, I integrated over x , the joint density function f(x, y) from 0 to y and got the density function of y as above. For conditional density of x, I used the joint density / f(y) to get 1/y. Sorry for the bad formatting this is literally my first comment. $\endgroup$
    – Piyush
    Sep 6, 2018 at 23:32
  • 1
    $\begingroup$ But you didn't mention the support of the distributions, without which the answers are meaningless. $\endgroup$ Sep 8, 2018 at 7:45
  • $\begingroup$ Sorry, but I got this question in exam and this is all I know about the density function of X. It's not a complicated statistical distribution but just a question testing the knowledge of joint pdfs. $\endgroup$
    – Piyush
    Sep 9, 2018 at 14:32

2 Answers 2


The marginal density of $Y$ can be found by "averaging over" the $X$ values:

$$ f_Y(y) = \int_{0}^{y} 2 \, dx . $$

Once you have this marginal density you can combine it with the joint density to arrive at the conditional:

$$ f_{X|Y}(x, y) = \frac{f_{XY}(x, y)}{f_{Y}(y)} . $$

If you carry out these calculations you should get the answer you gave.


This is the kind of problem where it helps tremendously to have a visual image of the meaning of all those mathematical formulas in your book or notes.

  • The graph of the pdf $f_X(u)$ of one random variable $X$ is a curve that lies (on or) above the $u$ axis, and the area under the curve is $1$. This is what all that gobbledygook $f_X(u) \geq 0$ and $\int_{-\infty}^\infty f_X(u)\, \mathrm du =1$. "But, but, ...., " you splutter, "the pdf of $X$ is $f_X(x)$, not $f_X(u)$ and so what you are saying makes no sense!" OK, sketch the graph of $f_X(x)$ on axes labeled $x$ and $f_X(x)$, and also the graph of $f_X(u)$ on axes labeled $u$ and $f_X(u)$. Apart from the labels on the axes, is there any difference between the two curves?
  • Similarly, the graph of the joint pdf $f_{X,Y}(u,v)$ of two random variables $X$ and $Y$ is a surface that lies (on or) above the $u$-$v$ plane, and the volume of the solid bounded by the surface and the $u$-$v$ plane is $1$. This is what $f_{X,Y}(u,v) \geq 0$ and $\int_{-\infty}^\infty \int_{-\infty}^\infty f_{X,Y}(u,v)\, \mathrm du\, \mathrm dv =1$ means.
  • For the given fixed real number $u_0$, the value of the marginal density $f_X$ of $X$ equals the area of the cross-section of the joint pdf solid when the solid is sliced by the plane $u = u_0$. Note that the cross-section of interest is the curve $f_{X,Y}(u_0,v)$ plotted as a function of $v$, and its area can be expressed as $\int_{-\infty}^\infty f_{X,Y}(u_0,v)\, \mathrm dv,$ that is, $$f_X(u_0) = \int_{-\infty}^\infty f_{X,Y}(u_0,v)\, \mathrm dv.\tag{0}$$ Similarly, for the given fixed real number $u_1$, the value of the marginal density $f_X$ of $X$ is $$f_X(u_1) = \int_{-\infty}^\infty f_{X,Y}(u_1,v)\, \mathrm dv\tag{1}$$ while for the given fixed real number $u_2$, the value of the marginal density $f_X$ of $X$ is $$f_X(u_2) = \int_{-\infty}^\infty f_{X,Y}(u_2,v)\, \mathrm dv\tag{2}$$ and so on. After a few more calculations of this kind, some smart-ass exclaimed "Hey Ma, I think I see a pattern here. For any fixed real number $u$, I can write $$f_X(u) = \int_{-\infty}^\infty f_{X,Y}(u,v)\, \mathrm dv\tag{*}$$ "Isn't that neat?" and the world has not been the same ever since. All the textbook writers began using $(*)$ without ever reminding their readers that all that you need to understand is that the value of the marginal pdf is the area of the cross-section of the joint pdf solid.
  • For the given fixed real number $u_0$, the conditional pdf $f_{Y\mid X=u_0}(v\mid X=u_0)$ of $Y$ given that $X=u_0$ is shaped exactly like the the curve $f_{X.Y}(u_0,v)$ regarded as a function of $v$: the only difference is that the area under this curve might not be 1. But, any nonnegative function $g(v)$ whose area is finite (say, Area $A$) an be converted into a pdf by dividing $g(v)$ by $A$: $$g(v) \geq 0 ~\forall v~\text{and} \int_{-\infty}^\infty g(v)\, \mathrm dv = A \implies \int_{-\infty}^\infty \dfrac{g(v)}{A}\, \mathrm dv = 1\implies \dfrac{g(v)}{A} ~\text{is a pdf}.$$ Now, Eq. (0) tells us that the area under $f_{X,Y}(u_0,v)$ is just $f_X(u_0)$ and so the the conditional pdf $f_{Y\mid X=u_0}(v\mid X=u_0)$ of $Y$ given that $X=u_0$ is just $$f_{Y\mid X=u_0}(v\mid X=u_0) = \dfrac{f_{X,Y}(u_0,v)}{f_X(u_0)}.$$

    Put more simply, the conditional pdf is just the cross-sectional shape "normalized" to have area 1.

Applying these ideas to the question at hand, the joint pdf of $X$ and $Y$ is a surface at height $2$ above the plane, and the joint pdf solid is just a right prism of height $2$ whose base is a triangle with vertices at $(0,0), (0,1), (1,1)$. Its cross-section by the plane $v_0=0.2$ is a rectangle of height $2$ and base extending from $u=0$ to $u=0.2$. Consequently, the conditional pdf of $X$ given $Y=0.2$ is the uniform pdf $U(0,0.2)$, that is, $$f_{X\mid Y=0.2}(u\mid Y=0.2) = \begin{cases}5,&0 < u < 0.2,\\0, &\text{otherwise.}\end{cases}$$ I will leave it to the OP to have a Hey Ma! moment and come to the realization that for any fixed $y \in (0,1)$, we can write $$f_{X\mid Y=y}(u\mid Y=y) = \begin{cases}\frac 1y,&0 < u < y,\\0, &\text{otherwise.}\end{cases}$$ and not his glib answer $1/y$. Similarly, I will leave it to the OP to figure out why his glib calculation of $f_Y(y)=2y$ is incomplete, and how the area of cross-section idea makes finding the actual pdf $f_Y(y)$ an almost trivial calculation.

I now await the inevitable downvotes....

  • $\begingroup$ I forgot to tell you, I'm a lazy student and unless I am being tested, I usually don't write my answers or show my calculations very formally. In my exam, I obviously have specified the limits, which you've made a very big deal about. I'm still hung up on some of your arguments and trying to understand it. I'm not fully ready to comment on that yet, but I agree to most of your answer. $\endgroup$
    – Piyush
    Sep 9, 2018 at 14:57
  • 1
    $\begingroup$ The limits are indeed a very big deal, and you have provided no indication that you had included the limits in your answer on your exam. As @StubbornAtom commented on your question above, unless you specify the support of the $2y$ and $1/y$, your answers that you state in your question are meaningless. $\endgroup$ Sep 9, 2018 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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