Chapter 9 Random Variables, Normal Distribution, and Statistics

Chapter 9
Random Variables, Normal Distribution, and Statistics
D. S. Malik
Creighton University, Omaha, NE
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
1 / 43
Random Variables
A gambler goes to a casino and sees a new gambling machine and
wants to play.
The gambler has only $60.00 to bet.
To play, the gambler must choose a number between 1 and 6.
The gambler can bet $1.00 each time the gambler plays.
If the machine shows the number selected by the gambler, then the
gambler wins $10.00.
To minimize the risk, the gambler would like to know not only the
chances of winning, but also the amount of money the gambler can
win.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
2 / 43
Suppose the machine is fair, so the probability of selecting any
number between 1 and 6 is the same.
The gambler’s winnings are as follows: If the machine selects 5, then
the gambler can win $10; otherwise the gambler loses $1.
We can display this information in the following table:
Outcome
1
2
3
4
5
6
Probability
1
6
1
6
1
6
1
6
1
6
1
6
Winning
1.00
1.00
1.00
1.00
9.00
1.00
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
3 / 43
Suppose that the gambler plays 60 times.
Each of the numbers 1 to 6 is likely to appear 10 times.
So, the expected winnings, or the average winnings, of the gambler is
10( 1) + 10( 1) + 10( 1) + 10( 1) + 10(9) 10( 1)
60
90 50
40
2
=
=
=
0.67.
60
60
3
If the gambler plays 60 times, then on each bet the gambler is likely
to win $0.67.
Note that
1
1
1
1
1
1
( 1) + ( 1) + ( 1) + ( 1) + (9) + ( 1)
6
6
6
6
6
6
9 5
=
0.67
6
In other words,
Pr[1] ( 1) + Pr[2] ( 1) + Pr[3] ( 1) + Pr[4] ( 1)
+ Pr[5] (9) + Pr[6] ( 1) = 9 6 5 0.67
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
4 / 43
Empty Slide for Notes
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
5 / 43
De…nition
Let S be a sample space. A random variable on S, (is a function that),
assigns exactly one real number to an outcome of S.
Example
Suppose that a fair coin is tossed twice. Then S = fHH, HT , TH, TT g.
Let us de…ne a random variable on S as follows: The real number assigned
by the random variable to an outcome is the number of heads in that
outcome.
Then we have the following table:
Outcome
HH
HT
TH
TT
Probability
1
4
1
4
1
4
1
4
Random Variable
2
1
1
0
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
6 / 43
Example
An experiment consists of rolling a fair die. Then the sample space of this
experiment is S = f1, 2, 3, 4, 5, 6g.
Let us de…ne a random variable, x, on S as follows: If the number rolled is
an even number, then the value assigned by the random variable to the
outcome is 0; otherwise the value assigned by the random variable is the
number rolled.
Thus, we have
Outcome
1
2
3
4
5
6
Probability
1
6
1
6
1
6
1
6
1
6
1
6
Random Variable
1
0
3
0
5
0
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
7 / 43
Remark
Let S be a sample space and s 2 S be an outcome of the experiment.
Then 0 Pr[s ] 1. Suppose a random variable x on S assigns the value
xs to the outcome s. Then xs is a real number. Note that the probability
of an outcome is a real number between 0 and 1 (inclusive), while the
value assigned by the random variable to the outcome is a real number,
which can be 0 or a positive or a negative real number. That is, xs is any
real number.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
8 / 43
De…nition
Let S = fs1 , s2 , . . . , sk g be the sample space of an experiment such that
Pr[si ] = pi , for all i = 1, 2, . . . , k. Let x be a random variable on S such
that the value assigned by x to the outcome si is xi . Then the expected
value of x, written as E [x ], is defnied by
E [x ] = p1 x1 + p2 x2 +
+ pk xk .
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
9 / 43
Let S = fs1 , s2 , s3 , s4 g be a sample space. Suppose that the probability of
the outcomes and the values assigned by the random variables are as given
in the following table:
Outcome
s1
s2
s3
s4
Probability
0.30
0.35
0.15
0.20
Random Variable
4
3
2
1
Then the expected value of the random variable is
E [x ] = 0.30 4 + 0.35 ( 3) + 0.15 2 + 0.20 1
= 1.20
1.05 + 0.30 + 0.20 = 0.65.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
10 / 43
Empty Slide for Notes
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
11 / 43
De…nition
Let S be a Bernoulli process. The random variable, x, that assigns values
to the outcomes of S is called the binomial random variable.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
12 / 43
Probability Density Function
A weighted coin is tossed three times. Suppose that Pr[H ] = 23 and
Pr[T ] = 31 . We want to …nd the expected number of heads that can occur
in three tosses.
Let S = fHHH, HHT , HTH, HTT , TTH, THT , TTH, TTT g be the
sample space of this experiment. Because we want to …nd the expected
number of heads in three tosses, we de…ne a random variable, x, on S as
follows: The real number assigned by the random variable to an outcome
is the number of heads in that outcome.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
13 / 43
The following table shows the probability of an outcome and the value
assigned by the random variable to that outcome.
Outcome
HHH
HHT
HTH
HTT
THH
THT
TTH
TTT
Probability (p )
8
27
4
27
4
27
2
27
4
27
2
27
2
27
1
27
Random Variable (x )
3
2
2
1
2
1
1
0
8
27
4
27
4
27
2
27
4
27
2
27
2
27
1
27
px
3=
2=
2=
1=
2=
1=
1=
0=0
E [x ] =
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
24
27
8
27
8
27
2
27
8
27
2
27
2
27
54
27
= 2.
14 / 43
Note that
E [x ] = Pr[HHH ] 3 + Pr[HHT ] 2 + Pr[HTH ] 2 + Pr[THH ] 2+
Pr[HTT ] 1 + Pr[THT ] 1 + Pr[TTH ] 1 + Pr[TTT ] 0
= Pr[HHH ] 3 + (Pr[HHT ] + Pr[HTH ] + Pr[THH ]) 2+
(Pr[HTT ] + Pr[THT ] + Pr[TTH ]) 1 + Pr[TTT ] 0
= Pr[HHH ] 3 + PrfHHT , HTH, THH g 2+
PrfHTT , THT , TTH g 1 + Pr[TTT ] 0
= 2.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
15 / 43
Event
fHHH g
fHHT , HTH, THH g
fHTT , THT , TTH g
fTTT g
Prob. of the
event (p )
8
27
12
27
6
27
1
27
Random
var (x )
3
2
1
0
px
8
27
12
27
6
27
2
27
3=
2=
1=
0=0
E [x ] =
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
24
27
12
27
6
27
54
27
= 2.
16 / 43
Empty Slide for Notes
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
17 / 43
Theorem
Let S = fs1 , s2 , . . . , sk g be the sample space of an experiment such that
Pr[si ] = pi , for all i = 1, 2, . . . , k. Let x be a random variable on S such
that the distinct values assigned by x to the outcomes of S are fx1 , x2 ,
. . . , xm g, where x1 < x2 <
< xm . Let Fi be the event (subset of S )
such that if the value assigned by the random variable to the outcome s is
xi , then s 2 Fi . That is,
Fi = fs 2 S j the value assigned by the random variable x to s is xi g.
Then
E [x ] = Pr[F1 ] x1 + Pr[F2 ] x2 +
+ Pr[Fm ] xm
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
18 / 43
De…nition
Let S = fs1 , s2 , . . . , sk g be the sample space of an experiment such that
Pr[si ] = pi , for all i = 1, 2, . . . , k. Let x be a random variable on S such
that the distinct values assigned by x to the outcomes of S are fx1 , x2 ,
. . . , xm g. Let Fi be the event (subset of S ) such that if the value assigned
by the random variable to the outcome s is xi , then s 2 Fi . That is,
Fi = fs 2 S j the value assigned by the random variable x to s is xi g.
Then
Pr[x = xi ] = Pr[Fi ].
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
19 / 43
Example
Ron has 4 pop music CDs and 5 jazz music CDs. On a trip he can take 3
CDs. Let us …nd the expected number of pop CDs.
Ron can take either 3 or 2 or 1 or 0 pop music CDs. Let x be the random
variable on the sample space such that the value assigned by x is the
number of pop music CDs. Then the values assigned by x are 3, 2, 1, or 0.
We have the following table:
Random Variable (x )
3
2
1
0
3
2
1
0
pop
pop
pop
pop
Event
and 0 jazz
and 1 jazz
and 2 jazz
and 3 jazz
CDs
CDs
CDs
CDs
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
20 / 43
Example
The following table shows the probabilities of the events.
Random Var (x )
3
Event
3 pop and 0 jazz CDs
2
2 pop and 1 jazz CDs
1
1 pop and 2 jazz CDs
0
0 pop and 3 jazz CDs
Probability of the event (p )
C (4,3 )
4
= 84
C (9,3 )
C (4,2 ) C (5,1 )
= 6845
C (9,3 )
C (4,1 ) C (5,2 )
= 48410
C (9,3 )
C (5,3 )
= 10
84 .
C (9,3 )
30
84
40
= 84
=
Hence, the expected number of pop CDs is:
E [x ] =
4
30
40
10
112
3+
2+
1+
0=
84
84
84
84
84
1.33.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
21 / 43
If E is the event that all three selected CDs are pop music CDs, then from
the preceding table,
4
.
Pr[E ] =
84
This implies that
4
Pr[x = 3] =
.
84
Similarly,
Pr[x = 2] =
30
,
84
Pr[x = 1] =
40
,
84
and Pr[x = 0] =
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
10
,
84
22 / 43
Empty Slide for Notes
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
23 / 43
Example
To raise money to help the school buy computers and books for the library,
the school o¢ cials want to sell 1000 ra- e tickets. The price of each ticket
is $5.00. There are a total of 6 prizes. One …rst prize is worth $100, 2
second prizes are each worth $25.00, and 3 third prizes are each worth
$10.00. If Linda buys a ra- e ticket, then she wants to know how much
can she win?
If Linda wins the …rst prize, then her net gain is $100 $5 = $95. If she
wins a second prize, then her net gain is $25 $5 = $20. Similarly, if she
wins a third prize, then her net gain is $10 $5 = $5. Otherwise her net
gain is $5.00.
Let x be the random variable such that the value assigned by x is the net
winning gain. Then we have the following table
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
24 / 43
Example
Random Variable (x )
95
Event
…rst prize
20
second prize
5
third prize
5
Probability of the event (p )
1
1000
2
1000
3
1000
no prize
Hence, the expected value of x is
E [x ] =
=
1
2
3
95 +
20 +
5
1000
1000
1000
95 + 40 + 15 4970
= 4.82.
1000
Linda’s expected gain is
994
5
1000
$4.82.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
25 / 43
Empty Slide for Notes
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
26 / 43
Remark
Let x be a random variable (on the sample space S ). Sometimes we say
that x assumes the values x1 , x2 , . . . , xk with probabilities p1 , p2 , . . . , pk ,
respectively. It means that there is an event Fi such that the values
assigned to each outcome in Fi is xi and Pr[Fi ] = pi . Note that
E [x ] = p1 x1 + p2 x2 +
+ pk xk .
Example
Let x be a random variable such that x assumes the values 2, 1, 4, 7,
and 8 with probabilities 0.10, 0.20, 0.35, 0.25, 0.10, respectively. Then
E [x ] = 0.10( 2) + 0.20(1) + 0.35(4) + 0.25(7) + 0.10(9) = 4.05.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
27 / 43
Theorem
E [x ] = np,
where n is the number of trials and p is the probability of success.
Example
Suppose that a biased coin with Pr[H ] = 0.60 is tossed 50 times. Then
n = 50 and p = 0.60. Then the expected number of heads is
E [x ] = 50(0.60) = 30.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
28 / 43
Random Variables and Histograms
Consider the random variable given by the following table:
x
p
1
0.25
2
0.30
3
0.40
4
0.05
This information can be displayed pictorially as follows:
0.5
0.4
0.3
0.2
0.1
1
2
3
4
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
29 / 43
0.5
0.4
0.3
0.2
0.1
1
2
3
4
Such a bar graph is called a histogram. The horizontal axis shows the
values of the random variable and the vertical axis shows the probabilities.
The bars in the …gure are all of the same width, typically of 1 unit. The
heights of the bar are the probabilities of the values shown in the middle
(at the bottom) of the rectangles.
The …rst rectangle represents the probability of the value 1, the second
value represents the probability of the value 2, and so on.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
30 / 43
The …rst rectangle represents the probability of the value 1, the second
value represents the probability of the value 2, and so on.
As we can see, the height of the …rst rectangle is 0.25 and width is 1 unit.
So the area of the …rst rectangle is 0.25(1) = 0.25. Similarly, the area of
the rectangle is 0.30(1) = 0.30, and so on. It follows that area of each
rectangle is the probability of the value represented by that rectangle.
Now
Pr[x = 1] = 0.25 = area of the …rst rectangle,
Pr[x = 2] = 0.30 = area of the second rectangle,
and so on.
Now
Pr[x
2] = Pr[x = 2] + Pr[x = 3] + Pr[x = 4] = 0.30 + 0.40 + 0.05 = 0.75.
Note that
Pr[x > 2] = Pr[x = 3] + Pr[x = 4] = 0.40 + 0.05 = 0.45.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
31 / 43
Empty Slide for Notes
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
32 / 43
Example
A fair coin is tossed 12 times. We determine the probability density
function, draw the histogram, …nd the expected number of heads, and
various probabilities.
Because the coin is tossed 12 times, the number of heads can be any
number from 0 to 12. The following table gives the probability density
function.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
33 / 43
x
Event
Probability of the event (p )
0
0 heads
C (12, 0) (1/2)0 (1/2)12 = 1/4096 = 0.00024
1
1 head
C (12, 1) (1/2)1 (1/2)11 = 12/4096 = 0.0029
2
2 heads
C (12, 2) (1/2)2 (1/2)10 = 66/4096 = 0.016
3
3 heads
C (12, 3) (1/2)3 (1/2)9 = 220/4096 = 0.054
4
4 heads
C (12, 4) (1/2)4 (1/2)8 = 495/4096 = 0.120
5
5 heads
C (12, 5) (1/2)5 (1/2)7 = 792/4096 = 0.193
6
6 heads
C (12, 6) (1/2)6 (1/2)6 = 924/4096 = 0.230
7
7 heads
C (12, 7) (1/2)7 (1/2)5 = 792/4096 = 0.193
8
8 heads
C (12, 8) (1/2)8 (1/2)4 = 495/4096 = 0.120
9
9 heads
C (12, 9) (1/2)9 (1/2)3 = 220/4096 = 0.054
10
10 heads
C (12, 10) (1/2)10 (1/2)2 = 66/4096 = 0.016
11
11 heads
C (12, 11) (1/2)11 (1/2)1 = 12/4096 = 0.0029
12
12 heads
C (12, 12) (1/2)12 (1/2)0 = 1/4096 = 0.00024
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
34 / 43
E [x ] =
1
4096
792
4096
66
4096
24576
4096
12
4096
924
5 + 4096
12
10 + 4096
0+
1+
6+
66
4096
792
4096
11 +
2+
7+
1
4096
220
4096
495
4096
3+
8+
495
4096
220
4096
4+
9+
12+
=
= 6
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
35 / 43
.226
.1882
.1506
.1130
.0752
.0376
0
1
2
3
4
5
6
7
8
9
10
11
12
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
36 / 43
P [x = 5] =
P [x
792
.
4096
9] = P [x = 9] + P [x = 10] + P [x = 11] + P [x = 12]
220
12
1
495
+ 4096
+ 4096
+ 4096
= 4096
=
728
4096
0.178
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
37 / 43
Remark
In the previous example, we determined the expected value using the
probability density function and its table. However because tossing a coin
is a Bernoulli process, we can also …nd E [x ] by using the fact that
E [x ] = np = 12
1
= 6.
2
So you might be wondering why we used the long process to …nd E [x ].
Our main interest in the previous example is to draw a histogram and
show the relationship between the histogram bars and the probabilities.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
38 / 43
Empty Slide for Notes
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
39 / 43
Mean and Standard Deviation of a Random Variable
Let x be a random variable such that x takes the values x1 , x2 , . . . , xk with
probabilities p1 , p2 , . . . , pk . Then
E [x ] = x1 p1 + x2 p2 +
+ xk pk
is called the expected value of x. The expected value of x is also called the
mean of x and is typically denoted by µ (the Greek symbol mu). Thus,
µ = x1 p1 + x2 p2 +
+ xk pk .
Let x be a random variable as described above. Let µ = E [x ] be the mean
of x. The variance of x, written as Var [x ] is de…ned by
Var [x ] = (x1
µ ) 2 p1 + ( x 2
µ ) 2 p2 +
+ (xk
µ ) 2 pk
The standard deviation of x, written σ (the Greek symbol sigma), is
de…ned by
q
σ = Var [x ],
i.e.,
σ=
q
(x1
µ)2 p1 + (x2
µ ) 2 p2 +
+ (xk
µ ) 2 pk .
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
40 / 43
Example
Let x be a random variable that takes the values 2, 3, 4, 6 with
probabilities 0.1, 0.4, 0.2, and 0.3, respectively. Then
µ = E [x ] = ( 2)(0.1) + 3(0.4) + 4(0.2) + 6(0.3) = 3.6.
The variance of x is
Var [x ] = ( 2 3.6)2 (0.1) + (3 3.6)2 (0.4)
+(4 3.6)2 (0.2) + (6 3.6)2 (0.3)
= ( 5.6)2 (0.1) + ( 0.6)2 (0.4) + (0.4)2 (0.2) + (2.4)2 (0.3)
= 5.04.
Thus, the standard deviation of x is
p
σ = 5.04
2.24.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
41 / 43
Empty Slide for Notes
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
42 / 43
Theorem
Let x be a binomial random variable. Then
q
µ = E [x ] = np and σ =
np (1
p ).
Example
A fair die is rolled 60 times and the number rolled is observed. If the
number rolled is a 2, it is a success, otherwise it is a failure. Let x be the
random variable such that the value assigned by x to an outcome is the
number of times 2 appears in that outcome. Then x is a binomial random
variable, such that n = 60 and p = 61 . Hence,
µ = E [x ] = np = 60
and
σ=
r
1
60 (1
6
1
)=
6
r
1
= 10
6
50
6
2.89.
D. S. Malik Creighton University, Omaha, NEChapter
()
9 Random Variables, Normal Distribution, and Statistics
43 / 43