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$