Definition of Variance

If random variable X has expected value (mean) μ=E(X), then the variance Var(X) of X is given by:

Var(X)=E[(X-μ)2].

In practice we collect data and estimate the Var(X) as either

sn2=1ni=1n(xi-x¯)2=(1ni=1nxi2)-x¯2

(which makes clear the nature of the variance as a mean), or as

s2=1n-1i=1n(xi-x¯)2=1n-1i=1n(xi-1nj=1nxj)2=1n-1i=1n(1nj=1n(xi-xj))2,
(which provides a correction to the slight bias in the estimated value).

Let's play around with that last formula a little bit:

s2=1n-1i=1n(1nj=1n(xi-xj))(1nk=1n(xi-xk))
Replacing the mean x¯ by the sum which defines it,
s2=1n2(n-1)i=1nj=1nk=1n(xi-xj)(xi-xk).
Adding an appropriate form of zero (a favorite trick!),
s2=1n2(n-1)i=1nj=1nk=1n(xi-xj)(xi-xj+xj-xk),
which is
s2=1n(n-1)i=1nj=1n(xi-xj)2-1n2(n-1)i=1nj=1nk=1n(xj-xi)(xj-xk).
Notice that the second sum in the previous expression as exactly s2, so
s2=12n(n-1)i=1nj=1n(xi-xj)2,
or, finally,
s2=1n(n-1)i=1nj=i+1n(xi-xj)2,
This you can think of as
s2= average distinct pair deviation squared
(which we knew!;)