I have 4 random variables:
$X\sim Pois(6)$
$Y \sim Geom (\frac{1}{4})$
$Z=6X-Y$
$U=2X-1$
What is the covariance of X and Y if Cov(Z,U)=0?
What I did:
$Cov(X,Y)=E(XY)-E(X)E(Y)$, I know $E(X)$ and $E(Y)$ as well, I only need $E(XY)$
From $Cov(Z,U)=E(ZU)-E(Z) E(U)=0$, and I know $E(Z)=32$ and $E(U)=11$
$E(ZU)=E([6X-Y][2X-1])=32\cdot 11$
I expanded the expression and got $E(XY)=60$
So $Cov(X,Y)=60-24=36$
Is that right? I generated such X,Y, U and Z in R, but didn't get this 36 covariance.
Per your response to my comment, your simulation did not capture the true behavior of X and Y, since you modeled them as independent when they are not independent. This is the source of your numerical error. The theoretically calculated covariance is correct though (36). Simulation of correlated variables with arbitrary marginals is an intermediate/advanced topic, involving copulas and other techniques for inducing the correct relationships.