handout two

73
Introduction to Probability and Statistics Probability & Statistics for Engineers & Scientists, 9th Ed. 2010 Handout #2 Instructor: Lingzhou Xue TA: Daniel Eck 1

Upload: doomy-jones

Post on 19-Feb-2016

220 views

Category:

Documents


0 download

DESCRIPTION

Handout two

TRANSCRIPT

Page 1: Handout Two

Introduction to Probability and Statistics

Probability & Statistics for Engineers & Scientists, 9th Ed.

2010

Handout #2

Instructor: Lingzhou Xue

TA: Daniel Eck

1

Page 2: Handout Two

Chapter 3

Random Variables

and

Probability Distributions

2

Page 3: Handout Two

• Concept of a Random Variable

• Discrete Probability Distributions

• Continuous Probability Distributions

• Joint Probability Distribution

3

Page 4: Handout Two

3.1 Concept of a Random Variables

4

Page 5: Handout Two

Random variable

A random variable is a numerical description of the outcome

of an experiment. Each experimental outcome gets assigned

a numerical value. In fact, most of the time the experimental

outcome is a number so we just use that number as the number

we assign.

Example 1

Roll a dice. Suppose X = i if the outcome of the throw is

number i. That is, X = 1 represents the ”1” showing up. Then

X is a random variable.

5

Page 6: Handout Two

Random variable

A random variable is a function that associates a real number

with each element in the sample space. So there is a function

such that

X : S → R

This statement is not 100% mathematically accurate, because

what a random variable does is to take subsets of S and maps

them to the real line R, but for us, this definition will suffice.

Example 2

Roll a dice. Suppose X = 1 if the outcome of the throw is an

even number, i.e., one of = {2, 4, 6}; and X = 0 otherwise.

Then X is a random variable.6

Page 7: Handout Two

Random variables are interesting because probability calculations

are streamlined with these. For each random variable, we have to

know the range of values that it can take on the real line, and the

probability to be assigned to every point in this range. The way

these probabilities stated is called a probability distribution of a

random variable. Random variables can be discrete if the range

of values taken is a subset of integers, or it can be continuous.

7

Page 8: Handout Two

Discrete Sample Space

If a sample space contain a finite number of a possibilities or

an unending sequence with as many elements as there are whole

numbers, it is called a discrete sample space.

Continuous Sample Space

If a sample space contain a infinite number of a possibilities

equal to the number of points on a line segment, it is called a

continuous sample space.

8

Page 9: Handout Two

Discrete Random Variable

A random variable is called a discrete random variable if its

set of possible outcomes is countable.

Continuous Random Variable

When a random variable can take on values on a continuous

scale, it is called a continuous random variable.

9

Page 10: Handout Two

Example 3: Discrete

Two balls are drawn in succession without replacement from anurn containing 4 red balls and 3 black balls. The possible out-comes and the values y of the random variable Y , where Y is thenumber of red balls are

Sample Space yRR 2RB 1BR 1BB 0

Example 4: Continuous

Let X be the random variable defined by the waiting time, inminute, for a bus at a specific bus stop. The random variable X

takes on all values x for which x ≥ 0.

10

Page 11: Handout Two

3.2 Discrete Probability Distributions

11

Page 12: Handout Two

Frequently, it is convenient to represent all the probabilities of

a random variable X by a formula. Such a formula would nec-

essarily be a function of the numerical values f(x) = P (X = x);

for instance, f(3) = P (X = 3).

Probability Function

For random variable X of the discrete type, the probability P (X =

x) is frequently denoted by f(x), and this function f(x) is called

the probability function, probability mass function or prob-

ability distribution.

12

Page 13: Handout Two

Example 5

In the case of tossing a coin twice, the random variable X, repre-

sents the number of heads. The possible value x of X and their

probabilities are

x 0 1 2

f(x) = P (X = x) 14

24

14

13

Page 14: Handout Two

Definition

The probability function, probability mass function or prob-

ability distribution, f(x), of a discrete random variable X if,

for each possible outcomes x, it satisfies the following properties:

1. f(x) ≥ 0,

2.∑

x f(x) = 1,

3. P (X = x) = f(x).

14

Page 15: Handout Two

Example 6

Determine the value c so that each of the following functions

can serve as a probability distribution of the random variable X:

1. f(x) = c(x2 + 1), for x = 1, 3, 5.

2. f(x) = c(5− x2), for 0 ≤ x ≤ 2.

15

Page 16: Handout Two

Solution:

16

Page 17: Handout Two

Example 7

Let a random experiment be the cast of a pair dice, each having

six faces, and let the random variable X denote the sum of the

dice. Determine the probability function f(x) of X.

17

Page 18: Handout Two

Solution:

18

Page 19: Handout Two

Example 8

A shipment of 8 similar microcomputers to a retail outlet con-

tains 3 that are defective. If a school makes a random purchase

of 2 of these computers, find the probability distribution for the

number of defectives.

Solution:

Let X be a random variable whose values x are the possible num-

bers of defective computers purchased by the school. Then x

can be any of the numbers 0, 1, and 2. Now,

19

Page 20: Handout Two

f(0) = P (X = 0) =

(30

)(52

)(

82

) =10

28,

f(1) = P (X = 1) =

(31

)(51

)(

82

) =15

28,

f(2) = P (X = 2) =

(32

)(50

)(

82

) =3

28.

Thus the probability distribution of X is

x 0 1 2f(x) = P (X = x) 10

281528

328

Page 21: Handout Two

Goal

Wish to compute the probability that the observed value of a

random variable X will be less than or equal to some real

number x.

Cumulative Distribution Function: Discrete

The cumulative distribution function (c.d.f.) F (x) of a dis-

crete random variable X with probability distribution f(x) is

F (x) = P (X ≤ x) =∑t≤x

f(t), for −∞ < x <∞.

20

Page 22: Handout Two

Example 5 Cont’d

In the case of tossing a coin twice, the random variable X repre-

sents the number of heads. The possible value x of X and their

probabilities are

x 0 1 2

f(x) = P (X = x) 14

24

14

Find the cumulative distribution function of the random variableX in Example 5.

F (0) = P (X ≤ 0) = f(0) =1

4,

F (1) = P (X ≤ 1) = f(0) + f(1) =1

4+

2

4=

3

4,

F (2) = P (X ≤ 2) = f(0) + f(1) + f(2) =1

4+

2

4+

1

4= 1.

21

Page 23: Handout Two

F (x) =

0, for x < 0;14, for 0 ≤ x < 1;34, for 1 ≤ x < 2;1, for x ≥ 2.

f(2) = F (2)− F (1) = 1−3

4=

1

4.

Page 24: Handout Two

22

Page 25: Handout Two

23

Page 26: Handout Two

Example 8 Cont’d

Find the cumulative distribution function of the random variable

X in Example 8. Then using F (x), verify that f(1) = 1528.

F (x) =

0, x < 0;1028, 0 ≤ x < 1;2528, 1 ≤ x < 2;1, x ≥ 2.

24

Page 27: Handout Two

f(1) = P (X = 1) = F (1)− F (0) =15

28

Page 28: Handout Two

Example 9: Finding Probability Using CDF

The cumulative distribution function of X is given by

F (x) =

0, x < 1;15, 1 ≤ x < 5;13, 5 ≤ x < 7;35, 7 ≤ x < 10;1, x ≥ 10.

Find

1. P (X = 6);

2. P (X > 7);

3. P (2.5 < X < 9.2).

25

Page 29: Handout Two

26

Page 30: Handout Two

Solution:

f(x) = P (X = x) =

15, if x = 1;2

15, if x = 5;4

15, if x = 7;25, if x = 10.

1. P (X = 6) = 0.

2. P (X > 7) = 1− P (X ≤ 7) = 1− F (7) = 25.

3. P (2.5 < X < 9.2) = P (X = 5) + P (X = 7) = 25.

27

Page 31: Handout Two

Definition of the Integral as an Anti-Derivative

If the derivative of F (x) is f(x), then we say that an indefinite

integral of f(x) with respect to x is F (x).

d

dx[F (x)] = f(x)⇒

∫f(x) = F (x) + c,

where c is the arbitrary constant.

Example 10

d

dxx4 = 4x3, so

∫4x3 = x4 + c

28

Page 32: Handout Two

Example 11

Let f(x) be the derivative of F (x), what is the derivative of the

following integral ∫ x

af(u)du

Solution: ∫ x

af(u)du = F (x)− F (a)

⇒d

dx[∫ x

af(u)du] =

d

dxF (x)−

d

dxF (a) = f(x)

29

Page 33: Handout Two

Indefinite Integral Formulas

1.∫

cf(x)dx = c∫

f(x)dx + constant.

2.∫

[af(x) + bg(x)] dx = a∫

f(x)dx + b∫

g(x)dx + constant.

3.∫

xndu = 1n+1xn+1 + constant, if n 6= −1.

4.∫ 1

x = ln |x|+ constant.

5.∫

exdu = ex + constant.

30

Page 34: Handout Two

3.3 Continuous Probability Distributions

31

Page 35: Handout Two

Definition

The function f(x) is a probability density function (p.d.f.) for

the continuous random variable X, defined over the set of real

number R, if

1. f(x) ≥ 0, for all x ∈ R.

2.∫∞−∞ f(x) = 1,

3. P (a < X < b) =∫ ba f(x)dx.

32

Page 36: Handout Two

Cumulative Distribution Function: Continuous

The cumulative distribution function (c.d.f.) F (x) of a ran-

dom variable X with probability distribution f(x) is

F (x) = P (X ≤ x) =∫ x

−∞f(t)dt, −∞ < x <∞.

As an immediate consequence in the previous definition one can

write the two results,

P (a < X < b) = F (b)− F (a), and f(x) =dF (x)

dx,

if the derivative exists.

33

Page 37: Handout Two

Example 12

Suppose that the error in the reaction temperature, in ◦C, for acontrolled laboratory experiment is a continuous random variableX having the probability density function

f(x) =

{x2

3 , −1 < x < 2;0, elsewhere.

1. Verify f(·) is a probability density function for continuousrandom variable X

2. Find P (0 < X ≤ 1).

3. Find the cumulative distribution function, F (x), of X anduse it to evaluate P (0 < X ≤ 1).

34

Page 38: Handout Two

Solution:

1. ∫ ∞−∞

f(x)dx =∫ 2

−1

x2

3dx =

x3

9|2−1 =

8

9+

1

9= 1.

2. For −1 < x < 2,

F (x) =∫ x

−∞f(t)dt =

∫ x

−1

t2

3dt =

t3

9|x−1 =

x3 + 1

9.

Therefore,

F (x) =

0, x < −1;x3+1

9 , −1 ≤ x < 2;1, x ≥ 2.

Page 39: Handout Two

3.

P (0 < X ≤ 1) = F (1)− F (0) =2

9−

1

9.

Page 40: Handout Two

A continuous random variable has a probability of zero ofassuming exactly any of its values. (It is because

∫ aa f(x)dx =

0.) So, when X is continuous

P (a < X ≤ b) = P (a < X < b) + P (X = b) = P (a < X < b).

That is, it doesn’t matter whether we include an endpoint of theinterval or not. This is not true, though, when X is discrete.

35

Page 41: Handout Two

Example 13

The Department of Energy (DOE) puts projects out on bid and

generally estimates what a reasonable bid should be. Call the

estimate b. The DOE has determined that the density function

of winning (low) bid is

f(y) =

{58b,

2b5 < y < 2b;

0, elsewhere.

Find F (y) and use it to determine the probability that the winning

bid is less than the DOE’s preliminary estimate b.

36

Page 42: Handout Two

Solution:

For 2b5 < y < 2b

F (y) =∫ y

2b/5

5

8bdt =

5t

8b|y2b/5 =

5y

8b−

1

4.

Thus

F (y) =

0, if y < 2b

5 ;5y8b −

14, if 2b

5 ≤ y < 2b;1, if y ≥ 2b.

To determine the probability that the winning bid is less than

the preliminary bid estimate b, we have

P (Y ≤ b) = F (b) =5

8−

1

4=

3

8.

37

Page 43: Handout Two

Example 14: Challenging Problem

1. Sketch the graph of the function

f(x) =

{12 −

14|x− 3|, if 1 ≤ x ≤ 5;

0, otherwise,

and show that it is the probability density function of a ran-

dom variable X.

2. Find the cumulative distribution function, F , of X.

38

Page 44: Handout Two

Solution:

1.

f(x) = P (X = x) =

0, if x < 1;12 + 1

4(x− 3), if 1 ≤ x < 3;12 −

14(x− 3), if 3 ≤ x < 5;

0, if x ≥ 5.

39

Page 45: Handout Two

2. To calculate the c.d.f. of X, we use the formula F (x) =∫ x−∞ f(t)dt.

For x < 1

F (x) =∫ x

−∞f(t)dt =

∫ x

−∞0dt = 0.

For 1 ≤ x < 3

F (x) =∫ x

−∞f(t)dt =

∫ x

1

[1

2+

1

4(t− 3)

]dt =

1

8x2 −

1

4x +

1

8.

Page 46: Handout Two

For 3 ≤ x < 5

F (x) =∫ x

−∞f(t)dt

=∫ 3

1

[1

2+

1

4(t− 3)

]dt +

∫ x

3

[1

2−

1

4(t− 3)

]dt

=1

2+(−

1

8x2 +

5

4x−

21

8

)= −

1

8x2 +

5

4x−

17

8.

For x ≥ 5

F (x) =∫ x

−∞f(t)dt

=∫ 3

1

1

2+

1

4(t− 3)dt +

∫ 5

3

1

2+

1

4(t− 3)dt

= 1.

Page 47: Handout Two

F (x) =

0, if x < 1;18x2 − 1

4x + 18, if 1 ≤ x < 3;

−18x2 + 5

4x− 178 , if 3 ≤ x < 5;

1, if x ≥ 5.

Page 48: Handout Two

3.4 Joint Probability Distributions

40

Page 49: Handout Two

Joint Probability Distribution

If X and Y are two random variables, the probability distribu-

tion for their simultaneous occurrence can be represented by a

function with values f(x, y) for any pair of values (x, y). It is

customary to refer to this function as the joint probability dis-

tribution of X and Y .

41

Page 50: Handout Two

Definition: Discrete

The probability function f(x, y) of a joint probability distribu-

tion of the discrete random variables X and Y if

1. f(x, y) ≥ 0, for all (x, y),

2.∑

x∑

y f(x, y) = 1,

3. P (X = x, Y = y) = f(x, y).

For any region A in xy plane, P [(X, Y ) ∈ A] =∑∑

A f(x, y)

42

Page 51: Handout Two

Example 15

Two balls are selected from a box that contains 3 blue balls, 2

red balls, and 3 green balls. If X is the number of blue balls and

Y is the number of red balls selected, find

1. the joint probability function f(x, y),

2. P [(X, Y ) ∈ A], where A is the region {(x, y)|x + y ≤ 1}.

43

Page 52: Handout Two

Solution:

1. The possible pairs of values (x, y) are (0, 0), (0, 1), (1, 0),(1, 1), (0, 2), and (2, 0). Now

f(1, 1) =6

28:

represents the probability that a red and a green ball are slected.

• The total number of equally likely ways of selecting 2 balls

from the 8 is

(82

)= 28.

• The number of ways of selecting 1 red and 1 green ball is(21

)(31

)(30

)= 6

The joint probability distribution of (X, Y ) can be represented

44

Page 53: Handout Two

by the formula

f(x, y) = P (X = x, Y = y) =

(3x

)(2y

)(3

2− x− y

)(

82

)for x = 0, 1, 2; y = 0, 1, 2; and 0 ≤ x + y ≤ 2.

xf(x, y) 0 1 2 h(y)

y0 3

289

283

281528

1 628

628 0 12

282 1

28 0 0 128

g(x) 1028

1528

328 1

Page 54: Handout Two

2.

P [(X, Y ) ∈ A] = P (X+Y ≤ 1) = f(0, 0)+f(1, 0)+f(0, 1) =9

14

Page 55: Handout Two

Definition: Continuous

The probability function f(x, y) of a joint probability distribu-

tion of the continuous random variables X and Y if

1. f(x, y) ≥ 0, for all (x, y),

2.∫∞−∞

∫∞−∞ f(x, y) = 1,

3. P [(X, Y ) ∈ A] =∫ ∫

A f(x, y)dxdy, for any region A in xy plane.

45

Page 56: Handout Two

Example 16

A candy company distributes boxes of chocolates with a mixture

of creams, toffees, and nuts coated in both light and dark choco-

late. For a randomly selected box, let X and Y , respectively, be

the proportions of the light and dark chocolates that are creams

and suppose that the joint density function is

f(x, y) =

{25(2x + 3y), 0 ≤ x ≤ 1, 0 ≤ y ≤ 1;0, elsewhere.

1. Verify f(x, y) is a joint density function.

2. Find P [(X, Y ) ∈ A], where A = {(x, y)|0 < x < 12, 1

4 < y < 12}.

46

Page 57: Handout Two

Solution:

1. ∫ ∞−∞

∫ ∞−∞

f(x, y)dxdy =∫ 1

0

∫ 1

0

2

5(2x + 3y)dxdy

=∫ 1

0

2

5(x2 + 3yx)|x=1

x=0dy

=∫ 1

0

2

5(1 + 3y)dy

=2

5(y +

3

2y2)|y=1

y=0

=1

2.

P [(X, Y ) ∈ A] = P (0 < X <1

2,1

4< Y <

1

2) =

13

160.

47

Page 58: Handout Two

Marginal Distribution

Given two jointly distributed random variables X and Y , the

marginal distribution of X is simply the probability distribution

of X ignoring information about Y .

The marginal distributions of X alone and of Y alone are

Discrete case:

g(x) =∑y

f(x, y) and h(y) =∑x

f(x, y),

Continuous case:

g(x) =∫ ∞−∞

f(x, y)dy and h(y) =∫ ∞−∞

f(x, y)dx,

48

Page 59: Handout Two

Example 14 Cont’d

x 0 1 2

g(x) 1028

1528

328

y 0 1 2

h(y) 1528

1228

128

Solution:

g(0) =∑y

f(0, y) = f(0, 0) + f(0, 1) + f(0, 2) =5

14,

g(1) =∑y

f(1, y) = f(1, 0) + f(1, 1) + f(1, 2) =15

28,

g(2) =∑y

f(2, y) = f(2, 0) + f(2, 1) + f(2, 2) =3

28.

49

Page 60: Handout Two

Example 16 Cont’d

g(x) =∫ ∞−∞

f(x, y)dy =∫ 1

0

2

5(2x + 3y)dy =

{4x+3

5 , 0 ≤ x ≤ 1;0, elsewhere.

h(y) =∫ ∞−∞

f(x, y)dx =∫ 1

0

2

5(2x + 3y)dx =

{2+6y

5 , 0 ≤ y ≤ 1;0, elsewhere.

The marginal distributions g(x) and h(y) are indeed the proba-

bility distributions of the individual variables X and Y alone.∫ ∞−∞

g(x) =∫ ∞−∞

∫ ∞−∞

f(x, y)dydx = 1,

and

P (a < X < b) = P (a < X < b,−∞ < Y <∞)

=∫ b

a

∫ ∞−∞

f(x, y)dydx =∫ b

ag(x)dx

50

Page 61: Handout Two

Conditional Distribution

Let X and Y be two random variables, discrete or continuous.

Suppose f(x, y) is the joint probability density function of X and

Y , and g(x) and h(y) are the marginal distributions for X and

Y , respectively. The conditional distribution of the random

variable Y given that X = x is

f(y|x) =f(x, y)

g(x), g(x) > 0,

Similarly the conditional distribution of the random variable X

given that Y = y is

f(x|y) =f(x, y)

h(y), h(y) > 0.

51

Page 62: Handout Two

Conditional Distribution

If we wish to find the probability that the discrete random variable

X fall between a and b when it known that the discrete variable

Y = y, we evaluate

P (a < X < b|Y = y) =∑

a<x<b

f(x|y),

where the summation extends over all values of X between a and

b.

When X and Y are continuous, we evaluate

P (a < X < b|Y = y) =∫ b

af(x|y)dx.

52

Page 63: Handout Two

Example 15 Cont’d

Find the conditional distribution of X, given that Y = 1, and use

it to determine P (X = 0|Y = 1).

Solution:

h(1) =2∑

x=0

f(x, 1) =3

14+

3

14+ 0 =

6

14.

f(x|1) =f(x, y)

h(1)=

7

3f(x, 1), for x = 0, 1, 2.

Therefore, if it is know that 1 of the 2 balls selected is red, we

have the probability equal to 12 that the other ball is not blue.

x 0 1 2

f(x|1) 12

12 0

53

Page 64: Handout Two

Example 17

Given the joint density function

f(x, y) =

{x(1+3y2)

4 , 0 < x < 2, 0 < y < 1;0, elsewhere.

find g(x), h(y), f(x|y), and evaluate P (14 < X < 1

2|Y = 13).

Solution:

• g(x) =∫∞−∞ f(x, y)dy =

∫ 20

x(1+3y2)4 dy = x

2, 0 < x < 2.

• h(y) =∫∞−∞ f(x, y)dx =

∫ 10

x(1+3y2)4 dx = 1+3y2

2 , 0 < y < 1.

• f(x|y) = f(x,y)h(y) = x(1+3y2)/4

1+3y2/2= x

2, 0 < x < 2.

54

Page 65: Handout Two

• P (14 < X < 1

2|Y = 13) =

∫ 1/21/4

x2dx = 3

64

Page 66: Handout Two

Statistical Independent

Let X and Y be two random variables with joint probability dis-

tribution f(x, y) and marginal distributions g(x) and h(y), respec-

tively. The random variables X and Y are said to be statistically

independent if and only if

f(x, y) = g(x)h(y)

for all (x, y) within their range.

55

Page 67: Handout Two

Example 15 Cont’d

• f(0, 1) = 628.

• g(0) =∑2

y=0 f(0, y) = 1028.

• h(1) =∑2

x=0 f(x, 1) = 1228.

• Clearly, f(0, 1) 6= g(0)h(1).

Therefore, X and Y are not statistically independent.

56

Page 68: Handout Two

Example 18

Let X and Y have joint probability density function (p.d.f.)

f(x, y) =

{3x2y32 , if 0 < x < 2 and 1 < y < 3;

0, otherwise.

Find the marginal probability density functions of X and Y , re-

spectively, and determine if X and Y are independent ?

Solution:

g(x) =∫ 3

1

3x2y

32dy =

3x2

8, 0 < x < 2;

h(y) =∫ 2

0

3x2y

32dy =

y

4, 1 < y < 3.

Since f(x, y) = g(x)h(y), they are independent.

57

Page 69: Handout Two

Example 19

Consider the following joint probability density function of the

random variables X and Y

f(x, y) =

{3x−y

18 , 1 < x < 4, 1 < y < 2;0, elsewhere.

1. Find the marginal density functions of X and Y .

2. Are X and Y are independent?

3. Find P (X > 2|Y = 2).

58

Page 70: Handout Two

Solution:

1.

g(x) =∫ 2

1f(x, y)dy =

1

6(x−

1

2) 1 < x < 4;

h(y) =∫ 4

1f(x, y)dx =

1

6(15

2− y) 1 < y < 2.

2. Since f(x, y) 6= g(x)h(y), they are not independent.

3.

P (X > 2|Y = 2) =∫ 4

2

f(x, 2)

h(2)dx =

12

33.

59

Page 71: Handout Two

Statistical Independent: General Case

Let X1, X2, . . . , Xn be random variables, discrete or continuous,

with joint probability distribution f(x1, x2, . . . , xn) and marginal

distributions f1(x1), f2(x2), . . . , f(xn), respectively. The random

variables X1, X2, . . ., Xn are said to be statistically independent

if and only if

f(x, y) = f1(x1)f2(x2) · · · fn(xn)

for all (x1, x2, . . . , xn) within their range.

60

Page 72: Handout Two

Example 20

Suppose that the shelf life, in years, of a certain perishable food

product packaged in cardboard containers is a random variable

whose probability density function is given by

f(x) =

{e−x, x > 0;0, otherwise.

Let X1, X2 and X3 represent the shelf lives for three of these

containers selected independently and find

P (X1 < 2, 1 < X2 < 3, X3 > 2).

61

Page 73: Handout Two

Solution:

Since the containers were selected independently, we can assume

that the random variables X1, X2 and X3 are statistically inde-

pendent, having the joint probability density

f(x1, x2, x3) =

{f(x1)f(x2)f(x3) = e−x1−x2−x3, x1 > 0, x2 > 0, x3 > 0;0, elsewhere.

Hence,

P (X1 < 2, 1 < X2 < 3, X3 > 2) =∫ ∞

2

∫ 3

1

∫ 2

0e−x1−x2−x3dx1dx2dx3

= (1− e−2)(e−1 − e−3)e−2

= 0.0372.

62