Marginal density function based on conditional density example could you please help me to solve this training example for my exam? I need to find marginal density $f_X (x)$ based on knowing conditional density $f_{X|Y}$ and marginal density $f_{Y}$.
$$
f_{X\mid Y} (x\mid y) = \frac{2x}{y^2-1}~\mathbf 1_{1 \le x \le y \le 2}
$$
$$
f_{Y} (y) = \frac{4}{9}y(y^2 - 1)~\mathbf 1_{1 \le y \le 2}
$$

I am very insecure at statistics so please correct me when I am wrong:
based on this formula:
$$
f_{X,Y}(x,y) = f_Y(y) \cdot f_{X\mid Y} (x\mid y)
$$
I got this:
$$
\frac{4}{9}y(y^2 - 1)\frac{2x}{y^2 - 1} = \frac{8}{9}xy
$$
and then I computed $f_X (x)$ by inserting limits to $f(x,y)$:
$$
f_X(x) = \int_x^{\pi/2} f(x,y)~dy =  \int_x^{\pi/2} \frac{8}{9}xy~dy = \frac{1}{9}x(\pi - 4x^2)
$$
My friend says it is probably wrong but he is not able to help Is there logical mistake or numeric one? Could someone assist, please? Also if you could help me to understand the logic behind, I would appreciate it.

You were doing well, except that the upper limit $\pi/2$ comes from nowhere. It should be
$$
f_X(x) = \int_x^{2} f_{X,Y}(x,y)~dy =  \int_x^{2} \frac{8}{9}xy~dy = \frac{16 x}{9}-\frac{4 x^3}{9}\ ,
$$
for $1\leq x\leq 2$. As a check, you observe that the marginal is correctly normalized:
$$
\int_1^2 dx\ f_X(x)=1\ .
$$
To be completely precise, when you write the joint pdf of $x$ and $y$, you should also specify the domain over which $x$ and $y$ are running, so
$$
f_{X,Y}(x,y)=\frac{8}{9}xy\ ,
$$
for $1\leq x\leq y\leq 2$. This means that the joint pdf above is normalized to $1$ over the region defined as follows:
$$
\int_1^2 dx\int_x^2 f_{X,Y}(x,y)dy=1\ .
$$
