## (probability and statistics:)

Variance is a measure of how much a random variable deviates from its expected value. Defined for the random variable X by:

Var(X) = E((X-EX)2) =
= E(X2) - (EX)2
(so it might not exist, even if X has expected value).

Both lines are used as definitions, and it is hard to pick the one over the other. To see the equality between the 2 lines, just open brackets on the first, and use the fact that expectation is linear, and that μ=EX is some constant.

The square root of the variance is the standard deviation of the variable.

A variance2) is a measure of how spread out a distribution is. It is computed as the average squared standard deviation (σ) of each number from its mean.

σ2 = Σ((x - μ)2) / N

Where μ is the mean, and N is the number of elements in the set. It can also be expressed as:

σ2 = Σ(x2) / N - μ2

And, if you want to substitute in the definition of the mean:

σ2 = Σ(x2) / N - (Σx / N)2

This last definition is useful for calculating the variance on the fly from a supplied series of elements, without having to store them in a list or array. (ie, you can keep a running total of Σx and Σ(x2) and then put those values (along with N) into the above equation at the end.)

Va"ri*ance (?), n. [L. variantia.]

1.

The quality or state of being variant; change of condition; variation.

2.

Difference that produce dispute or controversy; disagreement; dissension; discord; dispute; quarrel.

That which is the strength of their amity shall prove the immediate author of their variance. Shak.

3. Law

A disagreement or difference between two parts of the same legal proceeding, which, to be effectual, ought to agree, -- as between the writ and the declaration, or between the allegation and the proof.

Bouvier.

A variance, in disagreement; in a state of dissension or controversy; at enmity. "What cause brought him so soon at variance with himself?"

Milton.