Variance and Standard Deviation: Scott She Eld
Variance and Standard Deviation: Scott She Eld
Variance and Standard Deviation: Scott She Eld
440: Lecture 10
Variance and standard deviation
Scott Sheffield
MIT
18.440 Lecture 10
1
Outline
Defining variance
Examples
Properties
Decomposition trick
18.440 Lecture 10
2
Outline
Defining variance
Examples
Properties
Decomposition trick
18.440 Lecture 10
3
Recall definitions for expectation
� Recall: a random variable X is a function from the state space
to the real numbers.
� Can interpret X as a quantity whose value depends on the
outcome of an experiment.
� Say X is a discrete random variable if (with probability one)
it takes one of a countable set of values.
� For each a in this countable set, write p(a) := P{X = a}.
Call p the probability mass function.
� The expectation of X , written E [X ], is defined by
E [X ] = xp(x).
x:p(x)>0
� Also,
E [g (X )] = g (x)p(x).
x:p(x)>0
18.440 Lecture 10
4
Defining variance
�
I Let X be a random variable with mean µ.
�
I The variance of X , denoted Var(X ), is defined by
Var(X ) = E [(X − µ)2 ].
�
I Taking g (x))= (x − µ)2 , and recalling that
E [g (X )] = x:p(x)>0 g (x)p(x), we find that
X
Var[X ] = (x − µ)2 p(x).
x:p(x)>0
�
I Variance is one way to measure the amount a random variable
“varies” from its mean over successive trials.
18.440 Lecture 10
5
Very important alternate formula
�
I Let X be a random variable with mean µ.
�
I We introduced above the formula Var(X ) = E [(X − µ)2 ].
�
I This can be written Var[X ] = E [X 2 − 2X µ + µ2 ].
�
I By additivity of expectation, this is the same as
E [X 2 ] − 2µE [X ] + µ2 = E [X 2 ] − µ2 .
�
I This gives us our very important alternate formula:
Var[X ] = E [X 2 ] − (E [X ])2 .
�
I Original formula gives intuitive idea of what variance is
the variance.
18.440 Lecture 10
6
Outline
Defining variance
Examples
Properties
Decomposition trick
18.440 Lecture 10
7
Outline
Defining variance
Examples
Properties
Decomposition trick
18.440 Lecture 10
8
Variance examples
�
I If X is number on a standard die roll, what is Var[X ]?
�
I Var[X ] = E [X 2 ] − E [X ]2 =
1 2 1 2 1 2 1 2 1 2 1 2 2 91 49 35
6 1 + 6 2 + 6 3 + 6 4 + 6 5 + 6 6 − (7/2) = 6 − 4 = 12 .
�
I Let Y be number of heads in two fair coin tosses. What is
Var[Y ]?
�
I Recall P{Y = 0} = 1/4 and P{Y = 1} = 1/2 and
P{Y = 2} = 1/4.
�
I Then Var[Y ] = E [Y 2 ] − E [Y ]2 = 14 02 + 12 12 + 14 22 − 12 = 12 .
18.440 Lecture 10
9
More variance examples
�
I You buy a lottery ticket that gives you a one in a million
�
I Let X be the amount you win. What’s the expectation of X ?
�
I How about the variance?
�
I Variance is more sensitive than expectation to rare “outlier”
events.
�
I At a particular party, there are four five-foot-tall people, five
�
I Variance?
18.440 Lecture 10
10
Outline
Defining variance
Examples
Properties
Decomposition trick
18.440 Lecture 10
11
Outline
Defining variance
Examples
Properties
Decomposition trick
18.440 Lecture 10
12
Identity
�
I If Y = X + b, where b is constant, then does it follow that
Var[Y ] = Var[X ]?
�
I Yes.
�
I We showed earlier that E [aX ] = aE [X ]. We claim that
Var[aX ] = a2 Var[X ].
�
I Proof: Var[aX ] = E [a2 X 2 ] − E [aX ]2 = a2 E [X 2 ] − a2 E [X ]2 =
a2 Var[X ].
18.440 Lecture 10
13
Standard deviation
�
I Write SD[X ] = Var[X ].
�
I Satisfies identity SD[aX ] = aSD[X ].
�
I Uses the same units as X itself.
�
I If we switch from feet to inches in our “height of randomly
18.440 Lecture 10
14
Outline
Defining variance
Examples
Properties
Decomposition trick
18.440 Lecture 10
15
Outline
Defining variance
Examples
Properties
Decomposition trick
18.440 Lecture 10
16
Number of aces
�
I Choose five cards from a standard deck of 52 cards. Let A be
�
I Compute E [A] and Var[A].
�
I How many five card hands total?
52
�
I Answer: 5 .
�
I How many such hands have k aces?
4 48
�
I Answer: k 5−k .
(4)( 48 )
�
I So P{A = k} = k 525−k .
(5)
)4
�
I So E [A] = k=0 kP{A = k},
and Var[A] = 4k=0 k 2 P{A = k} − E [A]2 .
)
�
I
18.440 Lecture 10
17
Number of aces revisited
�
I Choose five cards from a standard deck of 52 cards. Let A be
the number of aces you see.
�
I Choose five cards in order, and let Ai be 1 if the ith card
chosen is an ace and zero otherwise.
Then A = 5i=1 Ai . And E [A] = i=1
) )5
�
I E [Ai ] = 5/13.
�
I Now A2 = (A) 1 + A)
2
2 + . . . + A5 ) can be expanded into 25
2 5 5
terms: A = i=1 j=1
Ai Aj .
So E [A2 ] = 5i=1 j=1
) )5
�
I E [Ai Aj ].
�
I Five terms of form E [Ai Aj ] with i = j five with i 6= j. First
five contribute 1/13 each. How about other twenty?
�
I E [Ai Aj ] = (1/13)(3/51) = (1/13)(1/17). So
5 20 105
E [A2 ] = 13 + 13×17 = 13×17 .
105 25
I
� Var[A] = E [A2 ] − E [A]2 = 13×17 − 13×13 .
18.440 Lecture 10
18
Hat problem variance
�
I In the n-hat shuffle problem, let X be the number of people
�
I We showed earlier that E [X ] = 1. So Var[X ] = E [X 2 ] − 1.
�
I But how do we compute E [X 2 ]?
�
I Decomposition trick: write variable as sum of simple variables.
�
I Let Xi be one if ith person gets own
) hat and zero otherwise.
Then X = X1 + X2 + . . . + Xn = ni=1 Xi .
�
I We want to compute E [(X1 + X2 + . . . + Xn )2 ].
�
I Expand this out and using linearity of expectation:
n n n X
n
X X X 1 1
E[ Xi Xj ] = E [Xi Xj ] = n· +n(n−1) = 2.
n n(n − 1)
i=1 j=1 i=1 j=1
�
I So Var[X ] = E [X 2 ] − (E [X ])2 = 2 − 1 = 1.
18.440 Lecture 10
19
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.