You are on page 1of 17

Applying the definition,

EX kPX k
k

n
n
EX k p k 1 p
nk

k 0 k

n
EX k p k 1 p
n! nk

k 0 k!n k !
n n
EX k p k 1 p 0 k p k 1 p
n! n k n! n k

k 0 k!n k ! k 1 k k 1!n k !
n
nn 1!
EX p k 1 p
nk

k 1 k 1!n k !

We replace

k1 k 1
n1
nn 1!
EX p k1 1 1 p 1
n k 1

k1 0 k1 !n k1 1!

EX n
n1
n 1! pp k 1 p n1k
1 1

k 0 k1!n 1 k1 !
1

EX np
n1
n 1! p k 1 p n1k
1 1

k 0 k1!n 1 k1 !
1

EX np

1
Applying the definition,

EX xf x dx
X

1
b
EX x dx
a
ba
b
1 x
2
EX

b a 2 a
1 b a
2 2
1 b a b a
E X

b a 2 b a 2

ab
EX
2

2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0 0 0 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 5 6

X = Number of children per house

PX X 0 7 20
PX X 1 4 20
PX X 2 4 20
PX X 3 3 20
PX X 5 1 20
PX X 6 1 20

The pmf of X is defined by,

a. Average number of children per household

E X xPX x
x

7 4 4 3 1 1
E X 0 1 2 3 5 6
20 20 20 20 20 20

EX
32
20
EX 1.6

3
b. What is the average number of children in households given that there is at least 1 children?
We define the event A as

A X 1
The conditional pmf is defined by

PX x, X 1
PX A x A
PX 1

PX x
PX A x A for x 1
PX 1
Then,

PX 1 PX 1 PX 2 PX 3 PX 5 PX 6

PX 1
13
20
Therefore,

PX A
x A PX x for x 1
13 20

x0 PX A X 0 A No defined

x 1 PX A X 1 A 4 13
x2 PX A X 2 A 4 13
x3 PX A X 3 A 3 13
x 5 PX A X 5 A 1 13
x6 PX A X 6 A 1 13

The conditional pmf is defined by,

4
Finally,

EX A xPX A x A
x

E X A 1 2 3 5 6
4 4 3 1 1
13 13 13 13 13

EX
32
13
EX 2.46

5
X = time-to-failure in years
By definition we have that,

EX PAEX A PBEX B PC EX C

a. Probabilities

PA 3PB

PB 2PC

PC PB PC 1

PA PB PC
2 2 1
3 9 9

b. Expected values
Since we know that the three pdfs are exponential distributed,

PDF Expected Value


f X A x A e x 5u x
1 EX A 5
5
f X B x B
1 x 6.5
e u x EX B 6.5
6.5
f X C x C e x 10u x
1 EX C 10
10

6
EX PAEX A PBEX B PC EX C

2 2 1
EX 5 6.5 10
3 9 9

EX
30 13 10

9 9 9
EX 5.88 years

7
a. Bernoulli

p k 1

PX k q k 0
0 else

First, we calculate the first moment or expected value

EX kPX k
k

EX 1 p 0q p

Then, we compute the second moment


E X 2 k 2 PX k
k


E X 2 1 p 0 q p
2 2

Finally, we can calculate the variance as


VARX E X E X E X 2 E X
2 2

VARX p p 2

VARX p1 p

VARX pq

b. Binomial

n
PX k p k q n k for k 0,..., n
k
First, we computed the first moment or expected value in Exercise 4.4

EX np

Then, we compute the second moment


E X 2 k 2 PX k
k

8
n
n
E X 2 k 2 p k q nk
k 0 k


n
n!
E X 2 k2 p k q nk
k 0 k!n k !

We observe that the first value is 0, then the first k is 1


n
n!
E X 2 k2 pk qnk
k 1 k k 1!n k !


n
kn!
E X2 pk qnk
k 1 k 1!n k !

Now we change the variable k

k1 k 1

k k1 1

k !nkk1n!1! p
n 1
k1 1 n k1 1
E X2 1
q
k1 0 1 1


n1 n1
k1n! n!
E X2 p k11q nk11 p k11q nk11
k1 0 k1!n k1 1! k1 0 k1!n k1 1!


E X2
n1
k1n!
p k11q nk11 np
n1
n 1! p k1 q n1k1
k1 0 k1!n k1 1! k1 0 k1!n 1 k1 !

n1 n 1
k1 n1k1
n1
k1n!
E X2 p k11q nk11 np p q
k1 0 k1!n k1 1! k1 0 k1


n1
k1n!
E X2 p k11q nk1 1 np
k1 1 k1 k1 1!n k1 1!

Then, we change the variable again for the first summation (we observe that the first k1 = 1
because the first element would be 0)

k2 k1 1

k1 k2 1


n2
n!
E X2 p k2 11q nk2 11 np
k2 0 k 2 !n k 2 1 1!

kn!nn12n k2!! p
n2
E X2 2
p k 2 q n 2 k 2 np
k2 0 2 2

9

E X 2 nn 1 p 2
n2
n 2! p k qn 2 k2 2
np
k 0 k2 !n 2 k2 !
2

n2 n 2

E X 2 nn 1 p 2
k 2 n 2 k 2
p q np
k 2 0 k2


E X 2 nn 1 p 2 np

Finally, we can calculate the variance as


VARX E X 2 EX
2


VARX nn 1 p 2 np n2 p 2
VARX n2 p 2 np 2 np n2 p 2

VARX np1 p

VARX npq

c. Poisson

ak a
PX k e u k
k!
First, we compute the first moment or expected value

EX kPX k
k


a k a
E X k e
k 0 k!

ak
E X k e a
k 1 k k 1!

ak
EX e a
k 1 k 1!

We change the variable

k1 k 1

10
k k1 1

a k1 1
EX e a
k1 0 k1!


a k1
E X ae a

k1 0 k1!

EX ae a e a

E X a

Then, we compute the second moment


E X 2 k 2 PX k
k



ak a
E X 2 k2 e
k 0 k!



k 2a k
E X 2 e a
k 1 k k 1!



kak
E X 2 e a
k 1 k 1!

Now we change the variable k

k1 k 1

k k1 1


E X 2 e a

k1 1a k 1 1

k1 0 k1!

k1a k1 1
a k1 1

E X 2 e a e a
k1 0 k1! k1 0 k1!



k1a k1 a k1
E X 2 ae a ae a
k1 1 k1 k1 1! k1 0 k1!



k1a k1
E X 2 ae a ae a e a
k k
k1 1 1 1 1!

11
Then, we change the variable again for the first summation (we observe that the first k1 = 1
because the first element would be 0)

k2 k1 1

k1 k2 1

a k 2 1


E X 2 ae a a
k 2 0 k2!



ak2
E X 2 a 2e a a
k 2 0 k 2!


E X 2 a2 a

Finally, we can calculate the variance as


VARX E X 2 EX
2

VARX a a a
2 2

VARX a

d. Gaussian

x m 2
f X x
1
exp

2 2 2

First, we calculate the first moment or expected value

EX xf x dx
X


x m 2
EX x
1
exp dx

2 2 2

xm x z m
z

dz dx


EX z me
1 z2 2
dz
2

12


EX
1 z2 2
ze dz m
z 2 2
e dz
2 2

z2
u
2
du zdz
u
EX
2
e du m

EX m
Then, we compute the variance as

x m 2
x m

VARX E X m
1
exp dx
2 2

2 2
2

xm x z m
z

dz dx

2
VARX
1
2 z 2e z 2dz z e
2
2 z2 2
dz
2 2

dz

2
VARX z ze
z 2
2

uz dv ze z 2dz
2

du dz v e z
2
2

2

VARX ze
z
e z 2 dz
2 2
2

2
1 z2 2
VAR X ze z2 2
2 e dz
2 2

2 ze z 2 2 2
VARX
2

VARX 2
e. Rayleigh

13
x2
f X x 2 ux
x
exp
2 2
First, we calculate the first moment or expected value

EX xf x dx
X


x2
x2
EX 2 exp 2 dx
0
2
x
z

dz dx

EX z 2e z 2dz
2

dz

EX z ze z
2
2

uz dv ze z 2dz
2

du dz v e z 2
2



E X ze z2 2
e z 2 dz
2


1 z2 2
E X ze z2 2
2 e dz
2

2
E X ze z 2
2


0 2

2 2
EX
2

2 2 2


E X
2

Then, we compute the second moment as

14

x
E X2 2
f X x dx


x2
x3
E X 2 exp 2 dx
2


0 2

x2

E X2 x
x2
2
exp 2 dx
0 2

x2
z
2
2
dz xdx
2
2

E X2
2 ze
z 2
dz
0

uz dv e z 2 dz
du dz v 2 e z 2
2


EX 2
2 ze
2
z 2
2 e z 2 dz
0

2

E X2
2
2 ze z 2
4e z 2

2

E X2
2
4 2 2

Finally, we can calculate the variance as

VARX E X 2 EX 2




VARX 2 2 2
2


VARX 2 2
2

15
Rolodex Problem
K = number of calls needed to ensure that every student is called at least once.
k 1
n 1
n 1 i 1
Pk 1 1
i

i 0 i n

E k kPk
k n

16
Matlab Program

%Rolodex Program

clc
clear all

%kmax is the number of calls


kmax = 800;
%nmax is the number of students
nmax = 50;

for n = 1:nmax
for r=1:kmax
vec1 = [0:n-1];
vec2 = ones(1,n);
vec3 = ((-1)*ones(1,n)).^[0:n-1]; %(-1)^i
%Compute C(n-1,i)
vec4 = prod(1:n-1)*ones(1,n);
vec5 = factorial(vec1);
vec6 = factorial(n -1 - vec1);
res = vec3.*vec4./(vec5.*vec6);
%Compute term (1-(i+1))^(k-1)
vec7 = (1-((vec1+1)./n)).^(r-1);
tot = res.*vec7;
%Compute the probability P(k)
P(r) = sum(tot);
end
e = (1:kmax).*P;
%Compute the expected value for each n
E(n) = sum(e);
end

plot((1:nmax),E,'Linewidth',2,'Color',[0 0.5 0.9])


xlabel('Number of Students (n)')
ylabel('Expected number of calls')
title('Average number of Rolodex tries to call all students at least once')
grid on
grid minor

17

You might also like