Let $A=\{(x, y) \in \mathbb{R}^{2}: x^{2}-\frac{1}{2 \sqrt{\pi}}<y<x^{2}+\frac{1}{2 \sqrt{\pi}}\}$ and let the joint probability density function of $(X,Y)$
$f(x, y)=\begin{cases} e^{-(x-1)^{2}}, & (x, y) \in A \\ 0, \text { otherwise } \end{cases}.$.
I need to compute the covariance between $X$ and $Y$.
I can see after integrating for $X$ and $Y$ that $X$ follows $N(1, \frac{1}{sqrt{2}})$ and $Y$ folows $Unif[-\frac{1}{2\sqrt{\pi}},\frac{1}{2\sqrt{\pi}}]$. I can also observe that the joint can be written as:
$f(x,y) = \sqrt{\pi} (\frac{1}{\sqrt{\pi}}e^{-(x-1)^2}) = f(x)f(y)$.
Hence, X and Y are independent which means the covariance between them will be zero but I am getting answer as 1.
I think that there is something wrong with the way I factorized the joint pdf. I probably also need to take into account the support over which they are defined but I am exactly sure if that is correct.
I also tried another approach in which I observed that $Cov(X,y) = E(XY] - E(X)E(Y) = E(XY)$ as the for the uniform the expectation is zero. Then I solved for $E(xy)$ by setting up the double integrals and that way also I am getting zero as the answer. I can show my calculation if needed but i have skipped it because it would involve lot of typing in latex.
Please let me know if I am doing anything incorrectly.