I'm doing this exercise: $$ f(x,y)= \begin{cases} 2x + 3y, & \text{0 ≤x ≤1, 0 ≤y ≤1} \\ 0, & \text{otherwise} \end{cases} $$ Find $Var(X), Var(Y), cov(X, Y), cor(X, Y)$
But when I try to calculate $Var(X), Var(Y)$ using the formula: $$Var(X) = E(X^2) - [E(X)]^2$$ my result is negative.
This is the result I have calculated:
$f(x) = 2x + \frac{3}{2} \\ f(y) = 3y + 1 \\ E(X) = \frac{17}{12}, E(Y) = \frac{3}{2}, \\ E(X^2) = 1, E(Y^2) = \frac{13}{12}, E(XY) = \frac{5}{6}, \\ Var(X) = \frac{-145}{144}, Var(Y) = \frac{-7}{6}$
Therefore I can't use the result to calculate $\sigma_X, \sigma_Y,...$
Could anyone tell me where is the problem here? What to do if the value of the variance is negative?
Thank you in advance for any help you can provide.
Your work seems fine. So it looks like the function they gave you is not a density. W|A gives $$\int_0^1\int_0^1 f(x,y) dydx = \frac{5}{2}.$$
There might have been a typo or they meant to include a step where you solve for a normalizing constant. Here the constant would be $k = 2/5$. If you rework the problem with the factor $k$, you should get sensible values.