# Covariance of a certain kind

Suppose that $X$ and $Y$ are two random variables defined on a say, finite sample space $A$ and suppose that $p$ is a probability distribution on $A$. Is there a special name for the following quantity? $$\sum_{a\in A} X(a)Y(a)p(a)-\sum_{a\in A} X(a)p(a)\cdot \sum_{a\in A} Y(a)p(a)$$ It's certainly not covariance. Covariance of $X$ and $Y$ is $$\sum_{a,b\in A} X(a)Y(b)p_{X,Y}(a,b)-\sum_{a\in A} X(a)p_{X}(a)\cdot \sum_{a\in A} Y(a)p_Y(a)$$ where $p_{X,Y},p_X,p_y$ are the joint distribution on $A\times A$ and marginals on $A$ respectively. I don't know whether this can be thought of as a covariance of $X$ and $Y$ in some sense. Or am I missing something here?

• You might try to give an example, perhaps where $X$ and $Y$ each take two values and they are neither independent not completely dependent. In particular, you might try to say what $p_X(a)$ means, and look at whether $\sum_{a \in A} p_X(a) =1$. – Henry Jan 4 '14 at 12:30
• @Henry: Yes $X(a)$ and $Y(a)$ could be different and independent. $P_X(a)=\sum_{b\in A}P_{X,Y}(a,b)$. – Ashok Jan 4 '14 at 12:43

Your first expression is covariance, but the space $A$ may not be what you expect, and is not the same as the $A$ in your second expression.

For example if $A$ has four distinct parts $e_1, e_2, e_3, e_4$ with

• $p(e_1)= 0.4, \qquad X(e_1)=6, \qquad Y(e_1)=6$
• $p(e_2)= 0.1, \qquad X(e_2)=6, \qquad Y(e_2)=7$
• $p(e_3)= 0.2, \qquad X(e_3)=7, \qquad Y(e_3)=6$
• $p(e_4)= 0.3, \qquad X(e_4)=7, \qquad Y(e_4)=7$

then your first expression gives $41.7-6.5\times 6.4 =0.1$, which is the covariance of $X$ and $Y$.

• Thank you Henry. But, the actual covariance is 0 because $E[XY]=\sum_{x,y}x~y~P(X=x,Y=y)=41.6$. What's wrong here? Am I missing something? – Ashok Jan 5 '14 at 7:54
• $0.4 \times 6 \times 6 + 0.1 \times 6 \times 7 + 0.2 \times 7 \times 6 + 0.3 \times 7 \times 7 = 41.7$. In my example the covariance must be positive as low/low and high/high are more likely than high/low or low/high. – Henry Jan 5 '14 at 16:20
• Yes you are right. Sorry for the confusion. – Ashok Jan 6 '14 at 5:12