# Marginal density knowing joint density

I have a probability density function:

$f_{X,Y}(x,y) = \begin{cases}24xy, & 0 \le x < 1, \ 0 \le y < 1, \ x+y<1, \\ 0 & \text{otherwise} \end{cases}$

I have to find the marginal density $f_X(x)$ and the conditional probability of $X$ given Y=1/2.

$$f_X(x)= \int_{x=0}^{x=1} f_{X,Y}(x,y), dx= \int_{x=0}^{x=1} 24 x y, dx= 24 [x^2/2]_{x=0}^{x=1}=12y$$

$$f_{X|Y}(x|y= \frac{1}{2})= \frac{f(x,y= \frac{1}{2})}{f_Y(y= \frac{1}{2})}= \frac{24x \frac{1}{2}}{12* \frac{1}{2}}=2x$$

but I'm not sure. Could someone check my solution?

For the marginal density you have to also consider the bound $x+y<1$: $$f_X(x) = \int_{0}^{1-x} f_{X,Y}(x,y) \;dy = 24x \int_0^{1-x}y \;dy = 12x(1-x)^2, \quad x \in [0,1).$$ I am not 100% sure what you mean by the conditioned probability of $X$ but I assume you mean the conditional density of $X$ given $Y=\frac 12$. Therefore you first need the marginal density of $Y$ which is given by $$f_Y(y) = \int_{0}^{1-y} f_{X,Y}(x,y) \;dx = 12y(1-y)^2, \quad y \in [0,1)$$ Then $$f(x|Y=\frac12) = \frac{f_{X,Y}(x,\frac12)}{f_Y(\frac 12)} = \frac{12x}{\frac 32} = 8x, \quad x \in [0,\frac 12).$$