Hi , I tried to resolve this question by taking the marginal pdf of $Y$ , then find it's expected value . But apparently this is not correct, they used the pdf of $f(x,y)$ in the solution and performed double integral to find $E(Y)$, can someone explain me why?
Thanks

You can do it either way. You can find the marginal PDF of $Y$ by taking
$$f_Y(y)=\int_0^y 2e^{-\left(x+y\right)}dx=2e^{-2y}\left(e^y-1\right)$$
Then
$$E(Y)=\int _0^{\infty }\:2ye^{-2y}\left(e^y-1\right)dy=\frac{3}{2}$$
Or you could take the double integral
$$E(Y)=\int _0^{\infty }\int _0^y\:2ye^{-\left(x+y\right)}\:dxdy=\frac{3}{2}$$
Either way is valid.