Let $$(\Omega, \mathrm{F}, \mathbb{P})$$ be a discrete probability space let $$X: \Omega \to S_x$$ and $$Y : \Omega \to S_y$$, be two random variables, where $$S_x$$ and $$S_y$$ are finite subsets of $$\mathbb{R}$$. Then the covariance of $$X$$ and $$Y$$ is defined as the mean of the following random variable:
[$Z = \;\; ? \;$]
In terms of $$X$$ and $$Y$$, the calculation for covariance is thus:
[$\mathrm{Cov}[X, Y] = \sum_{?} ? (? - \mathrm{E}[X])(? - \mathrm{E}[Y]))$]