Suppose we have two variables $x,y$ , where
$f_{X,Y}(x,y) = 3x, $ where $0\leq y \leq x \leq1$ and
$f_{X,Y}(x,y)=0$ elsewhere
I am having trouble finding $E(Y)$.
$E(Y) = \int_{0}^{1}y*f_Y(y)dy$
$ = \int_{0}^{1}y* (\int_0^xf_{X,Y}(x,y) dx)dy$
$=\int_{0}^{1}y*(\int_0^x3xdx)dy$
$= \int_{0}^{1}y*\frac{3x^3}{2}dy$
Which will not lead to a constant. Expectation of Y cannot be in terms of X, so this is a wrong approach. What is my mistake?
Here is a screenshot of the problem stem (Wackerly's Mathematical Statistics):

First of all note that the given function is not a valid joint pdf, since it integrates to $1/2$, not to $1$: $$ \int_0^1 \int_0^y 3x\,dx\,dy = \frac12. $$ So I supposed that it should be $6x$ instead of $3x$.
Next, $f_Y(y)$ depends on $y$, not on $x$. In order to find it, you should integrate joint pdf over all possible range of $x$. For any $y\in(0,1)$, $x$ belongs to $[0,y]$, so $$ f_Y(y) = \int_0^y f_{X,Y}(x,y)\,dx. $$