Conditional probabilities from a joint density function The joint density function of two continuos random variables $X$ and $Y$ is given by:
$f(x,y) = 8xy$ if $0\le y\le x\le 1$ and $0$ otherwise.


*

*Calculate $P(X \le \frac{1}{2})$

*Calculate $P(Y \le \frac{1}{4} \mid X = \frac{1}{2})$

*Calculate the expected value of $Y^3$ if $X = \frac{1}{2}$
I would just like to check whether I am solving these questions in the right way. For question a), I think you first need to derive the marginal density function for $X$. However, I am unsure whether I obtain this by integrating over from $0$ to $x$ or from $0$ to $1$ (which one is correct and why?). Also, I wasnt entirely sure about how to do b, could anyone show me how that probability would be obtained?. 
I think I can do c, however, for it to be correct, I first need te correct answer to question a. Could anyone please help me out?
 A: To answer the first question, we do not need to find the marginal density. We can just integrate directly. The answer is
$$\int_0^{1/2}\left(\int_0^x 8xy\,dy\right)\,dx.$$
Remark: The reason the inner integral does not have upper limit $1$ is that, for example, when we have reached $x=1/10$, it is impossible for $y$ to be, say, in the neighbourhood of $3/10$, We can rewrite the answer as
$$\int_{-\infty}^{1/2}\left(\int_{-\infty}^{\infty} f(x,y)\,dy\right)\,dx,$$
where $f(x,y)$ is the joint density. We could then keep the limits, and replace $f(x,y)$ by $8xy$ times an appropriate characteristic function $I(x,y)$ which is $1$ on our triangle and $0$ elsewhere. 
A: (1) The marginal PDF of $X$ is
$$f_X(x)=\int_{-\infty}^\infty f(x,y)\,dy\\ =\begin{cases}\int_0^x  8xy\,dy & ,\text{if} \,\,\, 0<x<1\\0 & \text{otherwise}\end{cases}$$
The marginal PDF of $Y$ is 
$$f_Y(y)=\int_{-\infty}^\infty f(x,y)\,dx\\ =\begin{cases}\int_y^1  8xy\,dx & ,\text{if} \,\,\, 0<y<1\\0 & \text{otherwise}\end{cases}$$
(2)  The conditional PDF of $Y|X=x$ is 
$$f_{Y|X}(y|x)=\dfrac{f_{X,Y}(x,y)}{f_X(x)}\\ =\begin{cases}\dfrac{8xy}{\int_0^x  8xy\,dy} & ,\text{if} \,\,\, 0<y<x\\0 & \text{otherwise}\end{cases}\\=\begin{cases}\dfrac{2y}{x^2} & ,\text{if} \,\,\, 0<y<x\\0 & \text{otherwise}\end{cases}$$
 So $P(Y \le \frac{1}{4} \mid X = \frac{1}{2})=\int_0^{1/4}\dfrac{2y}{(1/2)^2}\,dy$
A: When you're finding
$$
f_X(x) = \int_{-\infty}^\infty f_{X,Y}(x,y)\,dy
$$
the question is: for which values of $y$ is the joint density equal to $8xy$?  And the answer is that it's when $y$ is between $0$ and $x$.  Unless, of course, $x>1$ or $x<0$ in which case the density is $0$.
So the integral becomes $\displaystyle\int_0^x$ or else just $0$ (if $x<0$ or $x>1$).
