Вы находитесь на странице: 1из 15

Chapter 4

Discrete random variables

4.1 Definition, Mean and Variance


Let X be a (discrete) r.v. taking on the values xi with corresponding probabilities
pi = f (xi ), i = 1, ..., n.
Function f (x) is called probability density function (p.d.f).
It is convenient to present the values of a (discrete) r.v. and the corresponding
probabilities in a tabular form as follows.
x x1 ... xn Total
f (x) p1 ... pn 1

The cumulative distribution function of a discrete random variable X,


denoted as F (x) is defined as
X
F (x) = P (X x) = f (xi )
xi x

For a discrete random variable X, F (X) satisfies the following properties:

1. 0 F (x) 1

2. If x y, then F (x) F (y)

The cumulative distribution function can be used to calculate the probabilities:

P (a < x b) = P (x b) P (x a) = F (b) F (a)

The mathematical expectation of r.v. X (or just expectation or mean value


of X or just mean of X) is denoted by E[X] and is defined by:
n
X
E[X] = xi f (xi ).
i=1

The alternative notations (X) or are also often used.

1
CHAPTER 4. DISCRETE RANDOM VARIABLES 2

Example 4.1

Suppose an insurance company pays the amount of 1,000 for lost luggage on
an airplane trip. From past experience, it is known that the company pays this
amount in 1 out of 200 policies it sells. What premium should the company charge?

Solution

Define the r.v. X as follows: X = 0 if no loss occurs, which happens with


1
probability 1 (1/200) = 0.995, and X = 1, 000 with probability 200 = 0.005.

x 0 1, 000 Total
f (x) 0.995 0.005 1

Then the expected loss to the company is: E[X] = 0 0.995 + (1, 000 0.005) =
5. Thus, the company must charge 5 to break even.

Properties of mean:
1. E[cX] = cE[X]

Proof

n
X n
X
E[cX] = cxi f (xi ) = c xi f (xi ) = cE[X]
i=1 i=1

2. E[cX + d] = cE[X] + d

Proof

n
X n
X n
X
E[cX + d] = (cxi + d)f (xi ) = cxi f (xi ) + f (xi )
i=1 i=1 i=1
Xn n
X
= c xi f (xi ) + d f (xi ) = cE[X] + d
i=1 i=1

The variance of a r.v. X is denoted by Var(X) and is defined by:

V ar[X] = E[X E[X]]2

. The alternative notations 2 (X) and X


2
are also often used for the V ar(X).
CHAPTER 4. DISCRETE RANDOM VARIABLES 3

The variance account for the difference in size of the range of the distributions
of r.v. More generally, for a r.v. X taking on finitely many values x1 , ..., xn with
respective probabilities
Pn f (x1 ), ..., f (xn ), the variance is:
V ar[X] = i=1 (xi E[X])2 f (xi )
and represents the sum of the weighted squared distances of the points xi ,
i = 1, ..., n from the center of location of the distribution, E[X]. Thus, the further
from E[X] the xi s are located, the larger the variance, and vice versa. Because
of this characteristic property of the variance, the variance is referred to as a
measure of dispersion of the underlying distribution.
The positive square root of the V ar[X] is called the standard deviation (s.d.)
of X. Unlike the variance, the s.d. is measured in the same units as X.
Properties of variance:

1. V ar[X] = E[X]2 (E[X])2

Proof

n
X
2
V ar[X] = E[X E[X]] = (xi E[X])2 f (xi )
i=1
n
X
= (x2i 2xi E[X] + E[X]2 )f (xi )
i=1
n
X n
X n
X
= x2i f (xi ) 2E[X] xi f (xi ) + E[X]2
f (xi )
i=1 i=1 i=1
= E[X 2 ] 2E[X]E[X] + E[X]2 = E[X 2 ] E[X]2

2. V ar[cX] = c2 V ar[X]

Proof

V ar[cX] = E[(cX)2 ] E[cX]2 = E[c2 X 2 ] (cE[X])2


= c2 E[X 2 ] c2 E[X]2 = c2 (E[X]2 (E[X])2 ) = c2 V ar[X]

3. V ar[cX + d] = c2 V ar[X]

Proof
CHAPTER 4. DISCRETE RANDOM VARIABLES 4

V ar[cX + d] = E[(cX + d)2 ] E[cX + d]2


= E[c2 X 2 + 2cdX + d2 ] (cE[X] + d)2
= c2 E[X 2 ] + 2cdE[X] + d2 c2 E[X]2 2cdE[X] d2
= c2 (E[X]2 (E[X])2 ) = c2 V ar[X]

4. V ar[X] = E[X(X 1)] + E[X] E[X]2

Proof

We know that V ar(X) = E[X 2 ] E[X]2


E[X(X 1)] = E[X 2 X] = E[X 2 ] E[X] = V ar[X] + E[X]2 E[X], so
that V ar[X] = E[X(X 1)] + E[X] E[X]2

Example 4.2

The r.v. X has p.d.f. f given by:




0, x < 4
0.1, x = 4




0.3, x = 5


f (x) = 0.3, x = 6
0.2, x = 8




0.1, x = 9




0, x > 9.

1. Draw the graph of p.d.f f .

2. Calculate the probabilities P (X 6.5), P (X > 8.1), P (5 < X < 8).

3. Calculate and draw the graph of c.d.f F .

4. Calculate mean E[X].

5. Calculate variance V ar[X].

6. If we define new r.v. Y = 5 2X, calculate E[Y ] and V ar[Y ].

Solution

1.
CHAPTER 4. DISCRETE RANDOM VARIABLES 5

2. P (X 6.5) = P (X = 4) + P (X = 5) + P (X = 6) = 0.1 + 0.3 + 0.3 = 0.7


P (X > 8.1) = P (X = 9) = 0.1
(P (5 < X < 8) = P (X = 6) = 0.3
3.


0, x<4
0.1, 4x<5




0.4, 5x<6

F (x) =

0.7, 6x<8
0.9, 8x<9




1.0, x 9.

4. E[X] = 0.1 4 + 0.3 5 + 0.3 6 + 0.2 8 + 0.1 9 = 6.2


5. E[X 2 ] = 0.1 42 + 0.3 52 + 0.3 62 + 0.2 82 + 0.1 92 = 40.8
V ar[X] = E[X 2 ] E[X]2 = 40.8 6.22 = 2.36
6. E[Y ] = E[5 2X] = 5 2 E[X] = 5 2 6.2 = 7.4
V ar[Y ] = V ar[5 2X] = (2)2 V ar[X] = 4 2.36 = 9.44
Answer: 0.7; 0.1; 0.3.

Example 4.3

The number of light switch turn-ons at which the first failure occurs is a r.v.
9 x1

X whose p.d.f. is given by: f (x) = c 10 , x = 1, 2, ... (and 0 otherwise).
(a) Determine the constant c.
(b) Calculate the probability that the first failure will not occur until the
10th turn-on.
(c) Determine the corresponding c.d.f. F .

Solution

P
(a) The constant c is determined through the relationship: f (x) = 1
P 9 x1
 P 9 x1
 Px=1 9 x1
or x=1 c 10 = 1. However, x=1 c 10 = c x=1 10 =
1 1
c 1 9 = 10c, so that c = 10 .
10
h  i
9 x1 9 10 9 11
P  
(b) P (X > 10) = P (X 11) = c x=11 10 = c 10 + 10 + ...
10
( 109 ) 9 10 1 9 10
= (0.9)10 0.349.
 
=c 9
1 10
= c10 10
= 10
10 10

9 t1
(c) First, for x < 1, F (x) = 0. Next, for x 1, F (x) = xt=1 c 10
P 
=
9 x
P t1 t1 ( ) 9 x
9
= 1c 9 1
 P  
1 t=x+1 c 10 t=x+1 10 = 1 10 110
9 = 1 10 .
10
9
 x
Thus, F (x) = 0 for x < 1, and F (x) = 1 10 for x 1.
CHAPTER 4. DISCRETE RANDOM VARIABLES 6

Exercises

Exercise 4.1

A roulette wheel consists of 18 black slots, 18 red slots, and 2 green slots.
If a gambler bets 10 on red, what is the gamblers expected gain or loss?

Solution

Define the r.v. X by: X = 10 with probability 18/38 and X = 10 with


probability 20/38:
x 10 -10 Total
f (x) 18/38 20/38 1
Then E[X] = 10 18/38 10 20/38 = 0.526 i.e. he looses 0.53.

Answer: Loss of 0.53.

Exercise 4.2

Let X be a r.v. with p.d.f. f (x) = cx + d, for 0 x 1, and suppose that


P (X > 12 ) = 31 . Then:
(a) Determine the constants c and d.
(b) Find the c.d.f. F of X.

Solution
R1
(a) We need two relations which are provided by: 0 (cx + d)dx = 1 and
R1 1
1 (cx + d)dx = , or: c + 2d = 2 and 9c + 12d = 8, and hence c =
2
3
34 , d = 35 .
Rx 2
(b) For 0 x 1, F (x) = 0 43 t + 35 )dt = 2x3 + 5x
3
. Thus,

0, x<0
2x2 5x
F (x) = 3 + 3, 0x1 (4.1)
1, x > 1.


CHAPTER 4. DISCRETE RANDOM VARIABLES 7

4.2 The Binomial distribution


Lets say that we have an experiment, whose outcome can be labeled as a
success or a failure. If we let X = 1 denote a successful outcome and
X = 0 represent a failure, then we can write the probability density function
as

P (X = 0) = 1 p

P (X = 1) = p
where p represents the probability of a successful outcome. A random vari-
able that follows the probability density function given above for 0 < p < 1
is called a Bernoulli random variable.
Now suppose we repeat this experiment for n trials, where each trial is in-
dependent (the outcome from one trial does not influence the outcome of
another) and results in a success with probability p. If X denotes the num-
ber of successes in these n trials, then X follows the binomial distribution
which we will denote X B(n, p).
To calculate a binomial probability, we use the following formula:
 
n x
P (X = x) = p (1 p)nx x = 0, 1, 2, . . . , n.
x
 
n n!
=
x x!(n x)!

The p.d.f. of the B(10, 21 ) distribution is shown in a figure below.

For selected n and p, the c.d.f. F (x) = xj=0 nj pj (1 p)nj is given in table
P 

1 of the New Cambridge Statistical Tables (NCST) by D.V. Lindley. Then


following properties are useful for calculating probabilities: P (X = x) =
F (x) F (x 1) and P (X x) = 1 F (x 1).
CHAPTER 4. DISCRETE RANDOM VARIABLES 8

Example 4.4

The National Institute of Mental Health estimates that there is a 20 %


chance that an adult American suffers from a psychiatric disorder. Twenty
adult Americans are randomly selected. If we let X represent the number
who have a psychiatric disorder, then X takes on values according to the
binomial distribution with parameters (20, 0.20). Find the probability that
at most 3 of the selected people have such a disorder.

Solution

X B(20, 0.2)
From Table 1 P (X 3) = 0.4114

Answer: 0.4114

The mean and variance of a binomial distribution are given by

E[X] = np,

and

V [X] = np(1 p).

Proof

For expectation:
n n  
X X X n i
E(X) = xi f(xi ) = i f(i) = i p (1 p)ni
i i=0 i=0
i
n n
X n! X n (n 1)!
= i pi (1 p)ni = i p pi1 (1 p)ni
i=1
i!(n i)! i=1
i (i 1)!(n i)!
n
X (n 1)!
= np pi1 (1 p)ni
i=1
(i 1)!(n i)!
m m  
X (m)! s ms
X m s
= np p (1 p) = np p (1 p)ms
s=0
(s)!(m s)! s=0
s
= np 1 = np
CHAPTER 4. DISCRETE RANDOM VARIABLES 9

For variance:

Var(X) = E(X 2 ) (E(X))2 .


n n  
2
X
2
X
2 n i
E(X ) = i f(i) = i p (1 p)ni
i=0 i=0
i
m   m  
X m s ms
X m s
= np i p (1 p) = np (s + 1) p (1 p)ms
s=0
s s=0
s
X m   m   
m s ms
X m s ms
= np s p (1 p) + 1 p (1 p)
s=0
s s=0
s
= np (mp + 1) = np((n 1)p + 1) = np(np p + 1)
Var(X) = E(X 2 ) (E(X))2 = np(np p + 1) (np)2 = np(1 p)

Exercises

Exercise 4.3

Suppose that 15 people, chosen at random from a target population, are


asked if they favor a certain proposal.If 43.75% of the target population
favor the proposal,calculate the probability that:

(a) At least 5 of the 15 polled favor the proposal.


(b) A majority of those polled favor the proposal.

Solution

Let X be the number of those favoring the proposal, then X B(15, 0.4375).

(a) P (X 5) = 1 P (X 4) = 1 (P (X = 0) + P (X = 1) + P (X =
2) + P (X= 3) + P (X = 4)) = 
= 1 15 0 15 15 1 14 15
0.43752 0.562513 +

0
0.4375 0.5625 + 1
0.4375 0.5625 + 2

15 15
0.43753 0.562512 + 0.43754 0.562511 = 0.859;
 
+ 3 4
(b) P (X 8) = 1P (X 7) = 1(P (X 5)+P (X = 6)+P (X = 7)) =
15 15
0.43756 0.56259 + 0.43757 0.56258 = 0.3106.
  
= 1 0.859 + 6 7
CHAPTER 4. DISCRETE RANDOM VARIABLES 10

Exercise 4.4

Suppose you are throwing darts at a target and that you hit the bull s eye
with probability p. It is assumed that the trials are independent and that p
remains constant throughout.

(a) If you throw darts 100 times,what is the probability that you hit the
bull s eye at least 40 times?
(b) What does this expression become for p = 0.25?
(c) What is the expected number of hits, and what is the s.d. around this
expected number?

Solution

Let X is the number of times the bulls eye is hit, then X B(100, p).

(a) P (X 40) = 100 100 x 100x


P 
x=40 x p (1 p)

(b) P (X 40) = 100 100 x 100x


P 
x=40 x 0.25 0.75
(c) E[X] = np = 100p, V ar[X] = np(1 p) = 100p(1 p)
For p = 0.25, E[X] = 25, V ar[X] = 18.75 and s.d. = 18.75 = 4.33

Answer: 25; 4.33.

4.3 The Poisson distribution


A random variable X is a Poisson random variable with parameter , > 0,
denoted X P () if it follows the probability density function given by

x
P (X = x) = e , x = 0, 1, . . .
x!
The expected value and variance of a Poisson random variable are both ,
thus,

E[X] = ,

and

V ar[X] = .

The p.d.f. of the P (5) distribution is shown in figure below:


CHAPTER 4. DISCRETE RANDOM VARIABLES 11

Example 4.5

Suppose that accidents at a certain intersection occur in a manner that


satisfies the conditions for a Poisson process with a rate of 2 per week ( = 2).
What is the probability that at most 3 accidents will occur during the next
2 weeks?

Solution

3
X
P (X 3) = P (X = k)
k=0

4 4 42 4 43 4
P (X 3) = e + 4e + e + e = 0.4335
2! 3!

Answer: 0.4335

Table 2 of the NCST gives the probability that a Poisson random variable
with mean will be less than or equal to r. These tables can be used in the
same way as the binomial tables.

Exercises

Exercise 4.5

The number of particles emitted by a radioactive source in an hour has a


Poisson distribution with mean 20. Find the probability that exactly one
particle is emitted in a period of 2 minutes.
CHAPTER 4. DISCRETE RANDOM VARIABLES 12

Solution

Let X be a number of particle emitted in 2 minutes period.


= 220
60
= 23 (20 particles per 60 minutes)
X P (2/3)
1
P (X = 1) = e 1!(2/3) = 0.342
2/3

Answer: 0.342.

Exercise 4.6

A manufacturer makes a type of PC which develops serious faults at a rate


of 0.1 faults per year during its design life. The warranty period for the PC
is 2 years. What is the probability a customers PC does not develop a fault
during the warranty.

Solution

Let X be a number of faults in a 2-year period.


= 0.1 2 = 0.2 (0.1 per 1 year, 0.2 per 2 year period)
X P (0.2)
0
P (X = 0) = e 0!0.2 = e0.2 = 0.82
0.2

Answer: 0.82.

4.4 The discrete uniform distribution


The general discrete uniform distribution takes on k distinct values x1 , x2 ,
..., xk with equal probabilities 1/k, where k is a positive integer. In general,
we consider a random variable X which is equally likely to take any integer
value between two limits, a + 1 and b say. Then
1
P (X = r) = r = a + 1, a + 2, ..., b.
ba

We will use the notation


X U (a, b)
for the corresponding standard discrete uniform distribution.
CHAPTER 4. DISCRETE RANDOM VARIABLES 13

4.5 Probability generating functions


We saw in the previous section that we could derive the mean and variance
of a Binomially distributed random variable but it was quite hard work. In
this section we introduce a method of finding the mean and variance of a
discrete random variable which is often useful.
We use the idea of a generating function. The particular function we employ
is called a probability generating function. This is defined as
X
GX (s) = E[sX ] = sx P (X = x)
x

for any real s for which the sum converges. If we expand the sum we see
that the coefficient of sx is the probability that X = x. The quantity s
is a dummy
P variable, we could have used any letter we chose. Note that
GX (1) = x P (X = x) = 1.
Now we can see why GX is useful if we differentiate it with respect to s
X
GX (s) = xsx1 P (X = x)
x

and put s = 1 X
GX (1) = xP (X = x) = [X].
x

Similarly if we differentiate again with respect to s


X
GX (s) = x(x 1)sx2 P (X = x)
x

and put s = 1
X
GX (1) = x(x 1)P (X = x) = [X(X 1)].
x
CHAPTER 4. DISCRETE RANDOM VARIABLES 14

Now

V ar[X] = E[X 2 ] (E[X])2


= E[X(X 1)] + E[X] (E[X])2
= GX (1) + GX (1) [GX (1)]2 .

In general
k
E[X(X 1)(X 2)...(X k + 1)] = d GdsXk(1)
k
where d G X (l)
dsk
is the kth derivative of X (s) wrt s and evaluated at s = 1.
Note that thePprobability generating function is only going to be useful if we
can simplify x sx P (X = x).

Example 4.6

Discrete rv X has probability density function


1
ax e a
P (X = x) =
x!
1
(a) Show that probability generating function GX (s) for X is equal to e a (s1) .
(b) Using GX (s) find E[X].
(c) Using GX (s) find V ar[X].

Solution
P x ax e a1 a1 (sa1 )x
(a) GX (s) = E[sx ] =
P x
P
x=0 s P (X = x) = x=0 s x!
= e x=0 x!
=
s
a1 1
(s1)
e e =e a a
1
(b) GX (s) = a1 e a (s1)
E[X] = Gx (1) = a1
1
(c) GX (s) = a12 e a (s1)
GX (1) = a12
1 1 1 1
V ar[X] = GX (1) + GX (1) (GX (1))2 = a2
+ a
a2
= a

Exercises

Exercise 4.7

Consider a binomial random variable X with parameters n and p.Find the


probability generating function and hence calculate the mean and variance
of X.
CHAPTER 4. DISCRETE RANDOM VARIABLES 15

Solution
Pn x n x
Pn n
GX (s) = E[sx ] = nx x nx
 
x=0 s x p (1 p) = x=0 x (ps) (1 p) =
n
(ps + (1 p))
GX (s) = n (p + (1 p))n1 p
E[X] = GX (1) = n(p + (1 p))n1 p = np
GX (s) = n(n 1)(ps + (1 p))n2 p2
GX (1) = n(n 1)(p + (1 p))n2 p2 = n(n 1)p2
V ar[X] = GX (1) + GX (1) (GX (1))2 = n(n 1)p2 + np (np)2 = np(1 p)

Exercise 4.8

A random variable X is said to have a geometric distribution if it has the


probability function

p(x) = p(1 p)x x = 0, 1, 2, . . . 0<p<1

Find the probability generating function for this distribution and hence show
that it has mean (1 p)/p and find the variance.

Solution

(s(1 p))x = p
P P
GX (s) = E[sx ] = x=0 sx p(1 p)x = p x=0 1s(1p)
p(1p)
GX (s) = (1s(1p)) 2
1p
E[x] = GX (1) = p
2p(1p)2
GX (s) = (1s(1p))3
2
GX (1) = 2(1p)
p2
2(1p)2 1p (1p)2 1p
V ar[X] = GX (1) + GX (1) (GX (1))2 = p2
+ p
p2
= p2

Вам также может понравиться