# notation in standard form of covariance formula

I'm trying to build my basic intuition on covariance, but am confused about the notation I typically see:

cov(X,Y) = E[(X - E[X])(Y - E[Y])]

Why is there no summation sign in this formula, and why are the X's capitalized? Consider this basic example to see where I'm slipping up.

To find the covariance, it seems like we:

1. find the distance between a single observed value of variable X (thus my confusion with X...why isn't it Xi?) and the expected value of X (the sample mean)
2. do the same for the first observation of variable Y
3. multiply these together
4. repeat this process for each observation separately (again, my confusion on using X instead of Xi)
5. add up these cross-products (thus my confusion with no summation symbol)
6. divide by n-1 because my expected values are sample means (thus my confusion on no division in the formula)

How does the formula I mention (see on Wikipedia) represent the calculation above? I want to know what I am misunderstanding about either the steps or the notation.

You are confusing the sample covariance and population covariance. What you calculate is the sample covariance (because it is based on observations), but the formula you give at the start is the "theoretical" covariance between $$X$$ and $$Y$$.
• Still same thing, although this means you would know the actual expected value, so you can divide by $n$ instead of $n-1$. If you don't know the actual expected value, you estimate it with the sample mean and this makes you lose a "degree of freedom", so you must divide by $n-1$ rather than $n$. The part about the difference between population and sample parameters remains the same. – Dasherman Apr 3 '19 at 17:42