# find covariance between x and y when given joint pdf

I don't know what I'm doing wrong as my answer doesn't match the answer our prof gave us and the exam is tomorrow please help!!!

Joint pdf of two random variables is

$$f(x,y)= 6x$$ if $$0 and $$0$$ otherwise

find the covariance between x and y

My solution: Cov(x,y)= E(XY)-E(X)E(Y)

E(XY)= $$\int _0^1\int _0^{\frac{y}{6}}xy\cdot \:6xdxdy=\frac{1}{540}$$

E(X)=$$\int _0^1\int _0^{\frac{y}{6}}x\cdot \:6xdxdy=\frac{1}{432}$$

E(Y)= $$\int _0^1\int _0^{\frac{y}{6}}y\cdot \:6xdxdy=\frac{1}{48}$$

so cov(x,y)= $$\frac{1}{540}$$-($$\frac{1}{432}$$)($$\frac{1}{48}$$)= $$1.8\cdot \:10^{-3}$$

the answer our prof gave is $$\frac{1}{40}$$

Since you have $$x \lt y$$, try $$\int\limits_0^1 \int\limits_0^{y} \cdots$$ rather than $$\int\limits_0^1 \int\limits_0^{y/6} \cdots$$. Done for all three integrals, this will get you to $$\frac1{40}$$
As a check, $$\int\limits_0^1 \int\limits_0^{y} 6x\, dx\, dy = 1$$ as you would hope
If $$a+2,\,a+b+3$$ are both positive, $$\Bbb EX^aY^b=\int_0^1 dy\int_0^y 6x^{a+1}y^b dx=\int_0^1\frac{6}{a+2}y^{a+b+2}dy=\frac{6}{(a+2)(a+b+3)}.$$(Sanity check: $$a=b=0$$ gives $$\Bbb E 1=1$$.) Hence $$\operatorname{Cov}(X,\,Y)=\frac{6}{3\times 5}-\frac{6}{3\times 4}\times\frac{6}{2\times 4}=\frac{1}{40}.$$