Calculate $cov(X,Y)$ for $f(x,y)=2$; $0<x<y$, $0<y<1$
Using the equation $cov(x,y)=E[XY]-E[X]E[Y]$, I got that $cov(x,y)=1/4-y^2$.
My question is, can the covariance have a variable? or should I have used different bounds for the integrals with respect to $dx$ rather than $0$ and $y$?
I suspect that you used: $$\mathsf E(XY) = \int_0^y\int_0^1 xy f(x,y)\operatorname d y\operatorname d x$$
Rather, you should use:
$$\mathsf E(XY) = \int_0^1\int_0^y xy f(x,y)\operatorname d x\operatorname d y$$
The important check: The variable of integration for the inner integral should never appear in the bounds of the outer integral.
PS: Similarly $$\mathsf E(X) = \int_0^1\int_0^y x f(x,y)\operatorname d x\operatorname d y$$ $$\mathsf E(Y) = \int_0^1\int_0^y y f(x,y)\operatorname d x\operatorname d y$$