Summary


Variance

Definition

For a random variable 𝑋, we define the variance of 𝑋 as

Var(𝑥)=𝔼[𝑋2]𝔼[𝑋]2

Theorem

Var(𝑋)=𝔼[(𝑋𝔼[𝑋])2]

We can think of variance as a notion of expected distance from the expected value.

Example

𝑋Ber(𝑝). (𝑋=1)=𝑝, (𝑋=0)=1𝑝. 𝔼[𝑋]=𝑝, 𝔼[𝑋2]=𝔼[𝑋] since it is an indicator. Hence, Var(𝑋)=𝑝𝑝2=𝑝(1𝑝).

Example

𝑋Geom(𝑝). Var(𝑋)=?. To make it easier, we compute

𝔼[𝑋(𝑋1)]=𝑘=0𝑘(𝑘1)(𝑋=𝑘)=𝑝(1𝑝)(𝑘=0)𝑘(𝑘1)(1𝑝)𝑘2=𝑝(1𝑝)𝑘=0𝑑2𝑑𝑝2(1𝑝)𝑘=𝑝(1𝑝)𝑑2𝑑𝑝211(1𝑝)=𝑝(1𝑝)𝑝3=2(1𝑝)𝑝2

𝔼[𝑋]=1𝑝 so 𝔼[𝑋2]=𝔼[𝑋(𝑋1)]+𝔼[𝑋]. Hence Var(𝑋)=1𝑝𝑝2.

Notice that we employed the useful trick of calculating something simpler: 𝔼[𝑋(𝑋1)] and then found 𝔼[𝑋2] from that. This let us notice that there was a useful double integral.

Example

𝑋Unif([𝑎,𝑏]). 𝔼[𝑋2]=𝑥2𝑓𝑋(𝑥)𝑑𝑥=𝑏𝑎𝑥2𝑏𝑎𝑑𝑥=1𝑏𝑎𝑏3𝑎33(𝑏𝑎)212

Problem

Compute Var(𝑋) when 𝑋Poiss(𝜆), 𝑋Exp(𝜆), 𝑋𝑁(𝜇,𝜎2). Are they the same?

𝔼[𝑋2]=𝔼[𝑋(𝑋1)]+𝔼[𝑋]=𝜆2+𝜆

Hence

Var(𝑋)=𝔼[𝑋2]𝔼[𝑋]2=(𝜆2+𝜆)𝜆2=𝜆.

𝑋Exp(𝜆): Using 𝑓𝑋(𝑥)=𝜆𝑒𝜆𝑥 for 𝑥0,

𝔼[𝑋]=1𝜆,𝔼[𝑋2]=0𝑥2𝜆𝑒𝜆𝑥𝑑𝑥=2𝜆2.

Hence

Var(𝑋)=𝔼[𝑋2]𝔼[𝑋]2=2𝜆21𝜆2=1𝜆2.

𝑋𝑁(𝜇,𝜎2): By definition, the normal distribution has mean 𝜇 and variance 𝜎2, so

Var(𝑋)=𝜎2.

They are not all the same. For Poisson, the variance is 𝜆. For exponential, it is 1𝜆2. For normal, it is 𝜎2.

Note

Var(𝑏𝑋+𝐶)=𝑏2Var(𝑋). Prove it.

Covariance

What was nice about Expected Value was that it was linear, but variance is not. Covariance will help us dissect this idea more.

Definition

Given two random variable 𝑋 and 𝑌, the covariance of 𝑋 and 𝑌 is

Cov(𝑋,𝑌)=𝔼[(𝑋𝔼[𝑋])(𝑌𝔼[𝑌])]

Note

Cov(𝑋,𝑋)=Var(𝑋)

Proposition

Let 𝑋1,,𝑋𝑛 be 𝑛 random variables. 𝑌1,,𝑌𝑚 are 𝑚 random variables. Set

𝑈=𝑎1𝑋1++𝑎𝑛𝑋𝑛𝑎𝑖𝑉=𝑏1𝑌1++𝑏𝑚𝑌𝑚𝑏𝑖

Then Cov(𝑈,𝑉)=𝑛𝑖=1𝑚𝑗=1𝑎𝑖𝑏𝑗Cov(𝑋𝑖,𝑌𝑗).

In other words, covariance is bilinear, which means it is linear in both variables.

Example

Cov(𝑎1𝑋1+𝑎2𝑋2,𝑏1𝑌1+𝑏2𝑌2)=𝑎1𝑏1Cov(𝑋1,𝑌1)+𝑎1𝑏2Cov(𝑋1,𝑌2)+𝑎2𝑏1Cov(𝑋2,𝑌1)+𝑎2𝑏2Cov(𝑋2,𝑌2).

There are a few consequences of bilinearity in covariance.