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.

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

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

3. 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?

-
The easiest way to find the marginal density of $X$ (which, as André Nicolas's answer points out, is really not needed to solve #1) is first draw a sketch of the $x$-$y$ plane and figure out the region where $f(x,y)$ is nonzero. Then, to find the value of $f_X(x)$ at a specific number $x_0$, $0 \leq x_0 \leq 1$, all you have to do is integrate the function $f(x_0,y)$ which is what you encounter as you travel along the vertical line through $x_0$. Look at your figure, and you will see that $f(x_0,y)$ is nonzero only for $0\leq y\leq x_0$. Lather, rinse, repeat for $f_X(x_1), f_X(x_2),\ldots$ –  Dilip Sarwate Mar 24 '13 at 15:06
Thank you for your explanation! –  dreamer Mar 24 '13 at 15:20

(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$

-
Thank you very much for your help! However, from the conditional pdf that you gave for (2), how would I find the probability that I need to answer the question? Because from your expression I find 8xy/(4x^3), which gives me (8*1/8) / (4*1/8) = 2, when I fill in the values for x and y, which obviously doesn't make sense. –  dreamer Mar 24 '13 at 15:25
@mause: I edit my answer and the answer will be $\frac{1}{4}$. –  A.D Mar 24 '13 at 15:42
Thanks a lot!!! –  dreamer Mar 24 '13 at 16:23

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.

-
Still though, wouldnt the marginal density function of X be equal to the inner integral in your solution? Or what else would it be? Thank you for your help! –  dreamer Mar 24 '13 at 15:19
@mause : I think I've given what may be the simplest answer to the question in your comment above. I've concentrated my answer only on the aspect you seemed to have a question about and left the rest to you. –  Michael Hardy Mar 24 '13 at 15:26
Ok :). Thanks again for the help! –  dreamer Mar 24 '13 at 15:28

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$).

-
It is true that the density is $0$ when $x>1$. But still one might say that the bounds of integration for $y$ in that case are $0$ and $1$. The integral would of course be $0$. –  Michael Hardy Mar 25 '13 at 14:13
OK, I've edited the answer so that it's simple. –  Michael Hardy Mar 25 '13 at 14:44