Covariance is defined as:
Is the following equation derived from the one above? If yes, how? By treating the expected value as an arithmetic mean? Expected value is indeed equal to arithmetic mean when the probabilities are equal.
The question is - why do we divide by $n-1$ instead of $n$? If it's an arithmetic mean, we are adding up $n$ terms and dividing by the number of terms $n$.