The variance of a r.v. is the second most important parameter that summarises its behaviour. It is an index of how much the values of the r.v. are spread around its expected value.
∑xk(xk−E(X)): no, it does not take into account pX(xk).
∑xk(xk−E(X))pX(xk): no, it is always equal to 0 (this is the barycenter condition of the mechanical interpretation).
∑xkxk−E(X)pX(xk): this could be OK because it takes into account pX(xk) and the variations of both signs + and − with respect to E(X), but it is difficult to work with because of the absolute value.
∑xk(xk−E(X))2pX(xk): this is it!
Definition. Let X∼pX(xk), xk∈X. The variance of X, denoted var(X), is defined as
var(X)=xk∈X∑(xk−E(X))2pX(xk).
Example.X∼b(p), then E(X)=p and
var(X)=xk∑(xk−E(X))2pX(xk)=(0−p)2(1−p)+(1−p)2p=p(1−p).
Example.X=c (degenerate): var(X)=0 (to be checked: the only term is (c−c)2⋅1=0).
Applied to the motivation (computed here from the definition, not on the page): var(X)=31(36+0+36)=24 for Giovanni, var(Y)=31(1+0+1)=32 for Paolo.
2.var(X)≥0, and var(X)=0 iff X is degenerate.
Proof. The function (xk−E(X))2≥0 for all xk∈X, therefore ∑xk(xk−E(X))2pX(xk)≥0 for all pX(⋅). If var(X)=0 then for all xk with pX(xk)>0 it is (xk−E(X))2=0, i.e. xk=E(X); this means that there exists a unique value xk∈X with positive probability, which is exactly the case of a degenerate r.v. Vice versa, if X=c is a degenerate r.v. then trivially var(X)=0. □
3.var(aX)=a2var(X). Special case: var(−X)=var(X).
Proof.E(aX)=aE(X), therefore
var(aX)=E((aX−E(aX))2)=E((aX−aE(X))2)=E(a2(X−E(X))2)=a2var(X).□
5.var(X)=E(X2)−[E(X)]2.
Proof.var(X)=E((X−E(X))2)=E(X2−2E(X)X+[E(X)]2)=E(X2)−2E(X)E(X)+[E(X)]2=E(X2)−[E(X)]2.□
(Linearity of E is used, with E(X) treated as a constant; E(X2) is computed with the LOTUS.)
Corollary.E(X2)≥[E(X)]2, with equality iff X is degenerate (since var(X)≥0 with equality iff degenerate).
Worked example
Example 1. Let X be a r.v. with alphabet and density
X={1,2,3,4,5},pX(1)=0.2,pX(2)=α,pX(3)=0.2,pX(4)=β,pX(5)=0.1,
and moreover E(X)=2.7. Find (a) P(2<X≤4) (as stated on the page; see the note below), (b) E(5−4X), (c) var(X), (d) var(7−3X).
Solution. (b) and (d) follow immediately from the properties:
E(5−4X)=5−4E(X)=5−4⋅2.7(=−5.8),var(7−3X)=var(−3X)=var(3X)=9var(X),
(property 4 removes the shift 7, property 3 gives (−3)2=9) therefore to solve (d) it is necessary to solve (c).
To solve (a) and (c) it is necessary to find α,β. The constraints are ∑xkpX(xk)=1 and E(X)=2.7, i.e.
{0.2+α+0.2+β+0.1=11⋅0.2+2α+3⋅0.2+4β+5⋅0.1=2.7⟹{α+β=0.52α+4β=1.4⟹{α=0.5−β2(0.5−β)+4β=1.4⟹{α=0.3β=0.2.
The answer to (a) on the page is written as P(2<X≤5)=pX(3)+pX(4)+pX(5)=0.2+0.2+0.1=0.5.
Note on the page: the statement on the previous page reads P(2<X≤4) (upper bound 4) while the computation sums pX(3),pX(4),pX(5), which corresponds to an upper bound of 5. With the upper bound 4 the result would be 0.2+0.2=0.4. The handwriting of the bound is ambiguous; this is flagged rather than guessed.
As for (c), first compute E(X2) with the LOTUS:
E(X2)=12⋅0.2+22⋅0.3+32⋅0.2+42⋅0.2+52⋅0.1
(the page writes the exponent of the third term as 33, apparently a slip for 32), then var(X)=E(X2)−[E(X)]2. The page stops here; completing the computation: E(X2)=0.2+1.2+1.8+3.2+2.5=8.9, so
var(X)=8.9−2.72=8.9−7.29=1.61,var(7−3X)=9×1.61=14.49.
Versione ripasso
Definition.var(X)=∑xk∈X(xk−E(X))2pX(xk): the spread around E(X). (The signed deviations sum to 0 and the absolute value is hard to handle, so the square is used.)
Examples: b(p): var=(0−p)2(1−p)+(1−p)2p=p(1−p); degenerate: 0; G(p): p21−p. Two r.v.'s with the same mean (U{18,24,30} vs U{23,24,25}, both 24) can have very different variance.
Properties.
var(X)=E((X−E(X))2) (LOTUS).
var(X)≥0; =0 iff X degenerate.
var(aX)=a2var(X); var(−X)=var(X).
var(X+c)=var(X).
var(X)=E(X2)−[E(X)]2 (expand the square, use linearity).
Worked example.X={1,…,5}, p=(0.2,α,0.2,β,0.1), E(X)=2.7: normalisation α+β=0.5 and mean 2α+4β=1.4 give α=0.3, β=0.2. E(5−4X)=5−4⋅2.7; E(X2)=8.9, var(X)=8.9−7.29=1.61; var(7−3X)=9⋅1.61=14.49. Flag: statement reads P(2<X≤4) but the page sums pX(3)+pX(4)+pX(5)=0.5.
Typical mistakes: forgetting to square the multiplier in var(aX); adding the shift c to the variance; using E(X2)=[E(X)]2.