# Joint Random Variables Probability — Covariance and Correlation

If I have two random variables ($A$ and $B$) and a joint probability function whose output is dependent on the values of both random variables (i.e both variables are part of the function's equation), how would I go about finding the correlation and covariance of $A$ and $B$?

Let's say that the two variables both take on the values 0 and 1.

The formula for covariance is $$E[XY] - E[X]E[Y]$$ so in this case, I would first need to find $E[AB], E[A]$ and $E[B]$. The part that's confusing me is, how would I use this joint probability function in order to get the individual expectations of each variable? Do I just plug in the values that each variable takes on and sum up the values?

EDIT: Here's an example joint probability function in order to make my question more clear: $P(A = q, B = p) = 10q - 3p$

• If $(A,B)$ is discrete, then, for example, $$E(A)=\sum_{a,b}aP(A=a,B=b)$$ – Did Jun 6 '17 at 7:57
• Hmm, okay that makes sense! Also, for E(AB), would it be the same except with a * b inside the summation multiplied by the same probability? – corecase Jun 6 '17 at 8:13
• Yes. Kind of... the definition, you know. – Did Jun 6 '17 at 8:29