CHAPTER 4 - Expectation

Section 4.1, page 188

Problems 4 and 5

The number of letters in each word is:

>   lets:=[3,4,3,2,3,9,3,3];

lets := [3, 4, 3, 2, 3, 9, 3, 3]

So the expected number of letters in a selected word is:

>   sum(lets[i]/8,i=1..8);

15/4

Now for problem 5, there are altogether 30 letters, so we have 30 data points. And the expected value of the number of letters in the word the letter is in is

>   sum(lets[i]^2/30,i=1..8);

73/15

>   evalf(%);

4.866666667

This is higher than the previous answer, because the "9" gets weighted 9 times instead of just once.

Section 4.2, page 196

Problem 8

Since expectation is linear, we have E(X-Y) = E(X) - E(Y).  And E(X) and E(Y) are easily computed:

>   EX:=8*10/25; EY:=8*15/25;

EX := 16/5

EY := 24/5

>   EXmY=EX-EY;

EXmY = -8/5

We expect 8/5 more girls than boys in the group.

Section 4.3, page 203

Problem 3

We calculate the expectation of X and X^2:

>   EX:=int(x/(b-a),x=a..b);

EX := 1/2/(b-a)*(b^2-a^2)

>   EX2:=int(x^2/(b-a),x=a..b);

EX2 := 1/3/(b-a)*(b^3-a^3)

>   Var:=EX2-EX^2;

Var := 1/3/(b-a)*(b^3-a^3)-1/4/(b-a)^2*(b^2-a^2)^2

>   simplify(Var);

1/12*a^2-1/6*b*a+1/12*b^2

>   factor(Var);

1/12*(-b+a)^2

Problem 9

Again, we calculate the expectations of X and X^2:

>   EX:=sum(x/n,x=1..n);

EX := 1/2/n*(n+1)^2-1/2*(n+1)/n

>   EX2:=sum(x^2/n,x=1..n);

EX2 := 1/3/n*(n+1)^3-1/2/n*(n+1)^2+1/6*(n+1)/n

>   Var:=simplify(EX2-EX^2);

Var := 1/12*n^2-1/12