• No results found

Probability for Computer Scientists

N/A
N/A
Protected

Academic year: 2021

Share "Probability for Computer Scientists"

Copied!
240
0
0

Loading.... (view fulltext now)

Full text

(1)

Applied Statistics: Probability 1-1

Probability for Computer Scientists

This material is provided for the educational use

of students in CSE2400 at FIT. No further use

or reproduction is permitted.

Copyright G.A.Marin, 2008,

All rights reserved.

(2)

Motivation: Here are some things I’ve done

with prob/stat in my career:

ˆ

Helped Texaco analyze seismic data to find new oil

reserves.

ˆ

Helped Texaco analyze the bidding process for

offshore oil leases.

ˆ

Helped US Navy search for submarines and

develop ASW tactics.

ˆ

Helped US Navy evaluate capabilities of future

forces.

ˆ

Helped IBM analyze performance of computer

networks in health, airline reservation, banking,

and other industries.

ˆ

Evaluated new networking technologies such as

IBM’s Token Ring, ATM, Frame Relay…

ˆ

Analyzed meteor burst communications for US

(3)

Applied Statistics: Probability 1-3

Motivation:

ˆ

I never could have imagined the opportunities I would have

to use this material when I took a course like this one. You

can’t either.

ˆ

Mostly I cannot teach about all of these problem areas

because you must “master” the basics (this course) first. It

is the key.

ˆ

This takes steady work. Have in mind about 6-8 hours per

week (beginning this week!).

 20 hours after 3 weeks is nowhere as good.

ˆ

If you begin now and learn as you go, you’ll likely succeed. If

you don’t do anything, say, until the night before a test or

the day before an assignment is due, you will not be likely to

succeed.

(4)

Applied Statistics: Probability

Suggestions on how to study

ˆ

Do NOT bring a computer to class. It distracts you.

ˆ

Watch, listen and take notes the old fashioned way (pencil

and paper). For example, write:

slide 7 geom series??

Writing notes/questions actually helps you pay attention.

ˆ

As soon after class as possible review the slides covered in

class and your class notes. Do not go to the “next” slide until

you understand everything on the current slide.

 Can’t understand something? Ask next class period or come to my

office hours. In the words of Jerry McGuire: “Help me to help you.”

 Answer all points you raised in your notes. Look things up on the web.

ˆ Read the material in the text that corresponds to the slides

covered. The syllabus gives you a good indication of where to look.

ˆ Work a few homework problems

each night (when homework is

assigned).

 Can’t work one or two of these problems? Come to my office

hours. “Help me to help you.”

 It is much, much worse to come two days before 15 problems

are due and say “I can’t do any of these.” I will help you with some of the work, but it’s like trying to learn a musical

(5)

Applied Statistics: Probability 1-5

Introduction to Mathcad

ˆ Mathcad is computational software by Mathsoft Engineering and

Education, Inc.

ˆ It includes a computational engine, a word processor, and graphing

tools.

ˆ You enter equations “almost” as you would write them on paper.

They evaluate “instantly.”

ˆ You MUST use Mathcad for all homework in this class. Send your

mathcad worksheet to gmarin@fit.edu BEFORE class time on the due date. “I could not get a Mathcad terminal” is NO EXCUSE.

 Name the worksheet HomeworknFirstnameLastname.xmcd  The letter n represents the number of the assignment.  The “type” .xmcd is assigned automatically.

 If you do not follow the instructions, you will receive a zero for the

homework assignment.

ˆ Mathcad is available (at no charge) in Olin EC 272.

ˆ Tutorial and help are included with the software; resources are

also available at mathcad.com.

ˆ Mathcad OVERVIEW is next.

(6)

Review: Finite Sums of Constants

n n-1 1 0 0 n n-1 1 0 0

1

1

1

1

(

1)

, where is any constant.

n i i i n i i i

n

n

n

c

cn

c

c n

c

cn

c

= = = = = =

=

= +

=

=

=

+

=

100 1

Example:

9

900.

i=

=

(7)

Applied Statistics: Probability 1-7

Review: Gauss Sum

When Carl Freidrich Gauss, 1777 – 1855, was in the 3rd grade he was asked

to compute the sum 1+2+3+…+100. He quickly obtained the following formula:

Young Gauss reasoned that if he wrote two of the desired sums as follows: S=1 + 2 + 3 + … + 99 + 100 S=100+ 99 + 98 + … + 1 + 1 then clearly 2S = and S = In general, 100 1

101 100(101)

i=

=

100(101)

5, 050.

2

=

(

)

1

1

.

2

n k

n n

k

=

+

=

(8)

Definition of Infinite Series Sum

1 1

i=0

Begin with the series and define the partial sums , for 1, 2,.... The series is said to converge to if lim .

Example: The geometric series has the partial sums

n i n i i i n n i n S a S a n S s S s p S ∞ = = →∞ ∞ = = = =

1 1 2 1 , for 1, 2,....

1-By division we know that 1 ... . 1

1-By definition the sum of the infinite geometric series is lim lim . 1

1 If 1, then the above limit is .

1 n i i n n n n n n n p n p p p p S p p S p p p = + + →∞ →∞ = = = + + + + = − = − < −

(9)

Applied Statistics: Probability 1-9

Review: Gauss Related Series

k=0

We obtain an infinite "series" when we wish to "add" infinitely many

values. From the sum of constants we might consider the sum

1.

From calculus we know that we cannot obtain a finite sum from t

0

k=

his

series and that it "diverges" to . However, if we multiply each term

1

by

we have the "geometric" series

provided

1.

1

Take the derivative of boths sides to obtain the Gauss series

k k k

z

z

z

z

k

∞ =

=

<

(

)

1 2 1

1

, for

1.

1

k

z

z

z

∞ −

=

<

(10)

Try these

10 0 10 2 0 5

1

( )

2

1

( )

2

1

( )

2

1

( )

2

i i i i i i i i

a

b

c

d

= = ∞ = ∞ =

⎛ ⎞

⎜ ⎟

⎝ ⎠

⎛ ⎞

⎜ ⎟

⎝ ⎠

⎛ ⎞

⎜ ⎟

⎝ ⎠

⎛ ⎞

⎜ ⎟

⎝ ⎠

(11)

Applied Statistics: Probability 1-11

Power Series

(

)

0

Definition: A power series is a function of a variable (say ) and has the form ( ) , where the are constants and is also a constant. In this form the series is said to be "centered"

i i i i z P z c z a c a ∞ = =

− at the value .

Convergence: One of the following is true:

Either (1) the power series converges only for , Or (2) the power series converges absolutely for all , Or (3) there is a positive number

a z a

z R

=

such that the series converges absolutely for z − <a R and diverges for z− >a R R. is called the radius of convergence.

(12)

Ratio Test (Good tool for finding radius of

convergence.)

1

k=0

Consider the series

and suppose that lim

0 (or infinite).

If <1, then the series converges absolutely. If >1 or

, the series

diverges.

k k k k

a

a

a

ρ

ρ

ρ

ρ

∞ + →∞

= >

= ∞

1 1 1

Example: Determine where the series converges. 3

1

1 3

The ratio . The limit lim ;

1 3 1 3 3

1 3

thus, . It follows that the series c 3 k k k k k k k x k x k a k x k x x a x k k k x ρ ∞ = + →∞ ⎛ ⎞⎛ ⎞ ⎜ ⎟⎜ ⎟ ⎝ ⎠⎝ ⎠ ⎛ ⎞⎛ ⎞ ⎜ + ⎟⎜ ⎟ ⎝ ⎠⎝ ⎠ = = = + + ⎛ ⎞⎛ ⎞ ⎜ ⎟⎜ ⎟ ⎝ ⎠⎝ ⎠ =

onverges for 1 3, and 3

the series diverges for 3.

x

x

x

< ⇒ < >

(13)

Applied Statistics: Probability 1-13

Review: Other Useful Series

Exponential function:

The sum of squares:

Binomial sum: Geometric sum: 1 0

1

1

n n k k

z

z

z

+ =

=

(14)

Review: Binomial Coefficients

1 11 121 1331 14641 … Pascal’s triangle: n=0 n=1 n=2 n=3 n=4 …

(

!

)

( 1) ( 1) where ! ! ! ( 1) 1 k n n n n n n k k k n k k k k ⎛ ⎞ = = = − − + ⎜ ⎟ ⎝ ⎠ 3 2 ⎛ ⎞ ⎜ ⎟ ⎝ ⎠ ( )3 3 3 3 2 3 2 3 3 3 2 2 3 3 3 0 1 2 3 x y ⎛ ⎞x ⎛ ⎞x y ⎛ ⎞xy ⎛ ⎞y x x y xy y ⇒ + =⎜ ⎟ +⎜ ⎟ +⎜ ⎟ +⎜ ⎟ = + + + ⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠

(15)

Applied Statistics: Probability 1-15

Floors and Ceilings

As usual we define

the greatest integer less than or equal to where

is any real number. Similarly we define

the smallest integer greater than or equal to .

Thus, 2.3

2

x

x

x

x

x

=

⎢ ⎥

⎣ ⎦

=

⎡ ⎤

⎢ ⎥

=

while 2.3

3.

Also, -7.6

8

while -7.6

7.

Only when is an integer do we have equality of these functions:

.

In fact, when is not an integer, then

1.

x

x

x

x

x

x

x

=

= −

= −

= =

⎢ ⎥

⎡ ⎤

⎣ ⎦

⎢ ⎥

=

⎡ ⎤ ⎢ ⎥

⎢ ⎥ ⎣ ⎦

(16)

Logarithms

10 b

10

log

Conversion formula: log

.

log

Any base may be used in place of 10.

a

a

b

(17)

Applied Statistics: Probability 1-17

Log Function (Base 10)

(18)
(19)

Applied Statistics: Probability 1-19

Logarithmic Identities

(20)

Notation, notation, notation

ˆ

Learning math in many ways is like learning a new language.

You may understand a concept but be unable to write it

down. You may not be able to read notation that represents

a simple concept.

ˆ

The only way to tackle this “language barrier” is through

repetition until the notation begins to look “friendly.”

ˆ

You must try writing results yourself (begin with blank

paper) until you can recall the notation that expresses the

concepts.

 Copy theorems from class or from the text until you can

rewrite them without looking at the material and you understand what you are writing.

ˆ

Probability and statistics introduce their own notation to be

mastered.

ˆ

If you begin tonight, and spend time after every class, you

can learn this new language.

ˆ

If you wait until the week before the test, it will be much

like trying to learn Spanish, or French, or English in just a

few nights (1 night??). It really can’t be done.

(21)

Applied Statistics: Probability 1-21

Math sentences

Math problems, theorem, solutions ... must be written in sentences that make sense when you read them (EVEN WHEN EQUATIONS ARE USED). You will notice that I am careful to do this to the greatest extent possible on these slides (even knowning that I will explain them in class).

My observation is that most students have no idea how to do this. I often see solutions like the following on homework or t

4 2 0 2 3 est papers: Evaluate . The student writes something like

3 64 . 3 x dx x x = = =

The answer is right BUT every step is nonsense. The = sign means “is equal to.” In the first step, we don’t know to what the equality refers. The equality is simply wrong in the next two steps.

4 4 3 2 0 0

Instead write:

64

64

0

.

3

3

3

x

x dx

=

=

− =

(22)

Permutations and Combinations

1 2

Suppose that we have objects , ,..., .

A permutation of order is an "ordered" selection of of these for 1 n. A combination of order is an "unordered" selection of of these.

Com n n O O O k k k k k ≤ ≤

( )

( )

mon notation: , or ( 1) ( 1) , . !

Example: Given the 5 letters a,b,c,d,e how many ways can we list 3 of the 5 when order is n k k k n k P n k P n n n k n n n C n k C k k = − − + = ⎛ ⎞ = =⎜ ⎟ = ⎝ ⎠ 5 3 3 important? Answer: =5 =5*4*3=60.

Note that each choice of 3 letters (such as a,c,e) results in 6 different results: ace, aec, cae, cea, eac, eca...

Example: Given the 5 letters above how ma

P

3

ny ways can we choose 3 of the 5 when order is NOT important?

5 5 5*4*3

Answer: = = 10. In this case we have the 60 that result when we care about order 3 3! 3*2*1

divided by 6 (the number of orderi

⎛ ⎞

= ⎜ ⎟

⎝ ⎠

(23)

Applied Statistics: Probability 1-23

Definition

3 6

(

1)

(

1) for any positive integer and for integers

such that 1

. This symbol is pronouced " to the falling."

Examples: 6

6 5 4 120.

3 is not defined (for our

k

n

n

n

n k

n

k

k

n

n

k

= × − × × − +

≤ ≤

= × × =

5

purposes).

5

5!

Again:

and

.

!

k n k k

n

n

P

n

k

k

=

⎛ ⎞

=

⎜ ⎟

=

⎝ ⎠

(24)

Permutations of Multiple Types

1 2 1

2

1 2

The number of permutations of

objects of which are of

one type,

are of a second type, ..., and are of an

type is

!

.

!

!

!

r r r

n

n

n

n

n

n

n

rth

n

n n

n

= +

+ +

Example: Suppose we have 2 red buttons, 3 white buttons, and 4 blue buttons.

How many different orderings (permutations) are there?

9!

Answer:

1260.

2!3!4!

=

(25)

Applied Statistics: Probability 1-25

Try These

There are 12 marbles in an urn. 8 are white and 4 are red. The white marbles are numbered w1,w2,...,w8 and the red ones are numbered r1,r2,r3,r4.

For (a) - (d): Without looking into the urn you dra

5 w out 5 marbles.

(a) How many unique choices can you get if order matters? 12 95, 040 12

(b) How many unique choices can you get if order does not matter? 792 5

(c) How many ways can you choose 3

=

⎛ ⎞ = ⎜ ⎟ ⎝ ⎠

white marbles and 2 red marbles if order matters? You will fill 5 "slots" by drawing. First determine which

5

two slots (positions) will be occupied by 2 red marbles: 10. Next 2 ⎛ ⎞ = ⎜ ⎟ ⎝ ⎠ 3 2

multiply by orderings of 3 white and 2 red: 10 8 4 40, 320.

(d) How many ways can you choose 3 white marbles and 2 red marbles if 8 4

order does not matter? 336 3 2

(e) How many marbles

= ⎛ ⎞⎛ ⎞ =

⎜ ⎟⎜ ⎟ ⎝ ⎠⎝ ⎠

i i

(26)

Complex Combinations

How many ways are there to create a “full house”

(3-of-a-kind plus a pair) using a standard deck of 52 playing

cards?

13

4

12

4

13 4 12 6

3, 744.

1

3

1

2

⎛ ⎞⎛ ⎞⎛ ⎞⎛ ⎞

=

=

⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟

⎝ ⎠⎝ ⎠⎝ ⎠⎝ ⎠

i i i

(choose denomination)x(choose 3 of 4 of given

denomination)x(choose one of the remaining

denominations)x(choose 2 of 4 of this second

denomination).

(27)

Applied Statistics: Probability 1-27

Try these…

Suppose

. What is ?

11

7

18

18

Suppose

. What is ?

2

n

n

n

r

r

r

⎛ ⎞ ⎛ ⎞

=

⎜ ⎟ ⎜ ⎟

⎝ ⎠ ⎝ ⎠

⎛ ⎞ ⎛

=

⎜ ⎟ ⎜

⎝ ⎠ ⎝

(28)

Examples*

Consider a machining operation in which a piece of sheet metal needs two identical diameter

holes drilled and two identical size notches cut. We denote a drilling operation as d and a

notching operation as n. In determining a schedule for a machine shop, we might be interested

in the number of different possible sequences of the four operations. The number of possible

sequences for two drilling operations and two notching operations is

The six sequences are easily summarized: ddnn, dndn, dnnd, nddn,

ndnd, nndd.

*Applied Statistics and Probability for Engineers, Douglas C. Montgomery, George C. Runger, John Wiley & Sons, Inc. 2006

4!

6

2!2!

=

(29)

Applied Statistics: Probability 1-29

Example*

A printed circuit board has eight different locations in which a component can be placed.

If five identical components are to be placed on the board, how many different designs are possible?

Each design is a subset of the eight locations that are to contain the components. The number of possible designs is, therefore,

3

8

8

8

8* 7 * 6

56.

5

3

3!

3* 2 *1

⎛ ⎞ ⎛ ⎞

=

=

=

=

⎜ ⎟ ⎜ ⎟

⎝ ⎠ ⎝ ⎠

*Applied Statistics and Probability for Engineers, Douglas C. Montgomery, George C. Runger, John Wiley & Sons, Inc. 2006

(30)

Sample Space

ˆ

Definition: The totality of the possible

outcomes of a random experiment is called

the Sample Space,



Finite



Countable



Continuous (We begin with the discrete cases.)

.

Ω

{

}

Outcome from one roll of one die

⇒ Ω =

1, 2, 3, 4, 5, 6 .

{

}

The number of attempts until a message is transmitted successfully when the probability of success on any one attempt is

1, 2, 3, 4, 5, 6,... .

p

+

⇒ Ω = =

{

}

The time (in seconds) until a lightbulb burns out

: 0 , where is the set of all real numbers.

t t

(31)

Applied Statistics: Probability 1-31

Events

ˆ

Definition: An event is a collection of points from the

sample space. Example: the result of one throw of die is

odd.

ˆ

We use sets to describe events.

ˆ

If is finite or countable, then a “simple” event is an event

that contains only one point from the sample space.

ˆ

Suppose we toss a coin until first Head appears. What are

the simple events?

ˆ

Unless stated otherwise, ALL SUBSETS of a sample space

are included as possible events. (Generally we will not be

interested in most of these, and many events will have

probability zero.)

{

}

{

}

From the die example let the set of "even" outcomes be 2, 4, 6 . Let the set of "odd" outcomes be 1, 3, 5 .

E O = =

Ω

{ }

{ }

{ }

1 2 6

(32)

Describe the sample space and events

ˆ

Each of 3 machine parts is classified as

either above or below spec.



At least one part is below spec.

ˆ

An order for an automobile can specify

either an automatic or standard

transmission, premium or standard stereo,

V6 or V8 engine, leather or cloth interior,

and colors: red, blue, black, green, white.



Orders have premium stereo, leather interior,

(33)

Applied Statistics: Probability 1-33

Describe: sample space and events

ˆ

The number of hours of normal use of a lightbulb.



Lightbulbs that last between 1500 and 1800 hours.

ˆ

The individual weights of automobiles crossing a

bridge measured in tons to nearest hundredth of a

ton.



Autos crossing that weigh more than 3,000 pounds.

ˆ

A message is transmitted repeatedly until

transmission is successful.

(34)

Operations on Events

Both and occur.

At least one of or occurs. does not occur.

occurs and does not occur. the empty set (a set that contains no elements).

and are "mutually exclus

A B A B A B A B A A S A S A S A A B A B ∩ ⇒ ∪ ⇒ ⇒ ∩ = − ⇒ ∅ ⇒ ∩ = ∅ ⇒ ive."

Every element of is an element of , or, if occurs, occurs. Review Venn diagrams (in text).

A⊂ ⇒B A B A B

Because the sample space is a set, , and any event is a subset , we

form new events from existing events by using the usual set theory operations.

A

(35)

Applied Statistics: Probability 1-35

Example

Four bits are transmitted over a digital communications channel. Each bit is

either distorted or received without distortion. Let denote the event that

the th bit is distorted,

1, 2, 3, 4.

(a) Desc

i

A

i

i

=

1 1 2 1 2 1

ribe the sample space.

(b) What is the event

?

(c) What is the event

?

(c) What is the event

?

(d) What is the event

?

A

A

A

A

A

A

(36)

Venn Diagrams

Identify the following events:

A B C

(

)

(

)

( )

( )

( ) (

)

( )

(e)

a

A

b A

B

c

A

B

C

d

B

C

A

B

C

(37)

Applied Statistics: Probability 1-37

Mutually Exclusive &

Collectively Exhaustive

ˆ

A collection of events is said to be

mutually exclusive if

ˆ

A collection of events is collectively exhaustive if

ˆ

A collection of events forms a

partition of

if

they are mutually exclusive and collectively

exhaustive. A collection of mutually exclusive

events forms a partition of an event if

1

,

2

,...

A A

{

if if . i j i j i j A A i j

A

∩ =

A

φ

==

.

i i

A

= Ω

Ω

E

.

i i

A

=

E

(38)

Partition of

Ω

1

A

A

2

A

n1

A

n

The sets are "events." No two of them intersect (mutually exclusive) and their union covers the entire sample space.

i

(39)

Applied Statistics: Probability 1-39

Probability measure

ˆ

We use a probability measure to represent

the relative likelihood that a random event

will occur.

ˆ

The probability of an event is denoted

ˆ

Axioms:

( ).

P A

A

1 2 1

A 1. F or every event , ( )

0.

A 2 .

(

)

1 .

A 3. If and are m u tu ally exclusive, then

P (A

B )= P (A )+ P (B ).

A 4. If the even ts

,

, ... are m utually ex clusive, then

n

(

n

)

n n

A P A

P

A

B

A A

P

A

P A

∞ = =

Ω =

=

1

.

(40)

Theorem:

( )

[ ]

[

]

[ ] [ ] [

]

Given a sample space, , a "well-defined" collection of events,

, and a probability measure, , defined on these events then

the following hold:

(a)

0.

(b)

1

,

.

(c)

,

,

P

P

P A

P A

A

P A

B

P A

P B

P A

B

A

Ω

∅ =

⎡ ⎤

= −

⎣ ⎦

∀ ∈

=

+

F

F

[ ]

[ ]

.

(d)

,

,

.

B

A

B

P A

P B

A B

⊂ ⇒

F

F

You must “know” these and be able to use them to solve problems. Don’t worry about proving them.

(41)

Applied Statistics: Probability 1-41

Applying the Theorem

We roll 1 die and obtain one of the numbers 1 through 6 with equal probability. (a) What is the probability that we obtain a 7?

The event we want is ; thus, the probability is 0. (b) What is t

{ }

{ }

{ }

{ }

{ } { }

{ }

{ }

he probability that we do NOT get a 1?

5 The event we want is 1 or 1 , and 1 1 1 .

6 (c) What is the probability that we get a 1 or a 3?

1 1 1 1 3 1 3 . 6 6 3 (d) I P P P P P ⎡ ⎤ ′ Ω= − ⎡ ⎤ = ⎣ ⎦ ⎢ ⎥ ⎣ ⎦ ∪ = + = + = ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ∼

{

}

{

}

{

}

{

}

[ ]

[ ]

f 1, 4, 5, 6 , and , what might the event be? 1, 2, 4, 5, 6 , 1, 3, 4, 5, 6 , 1, 2, 3, 4, 5, 6 , or .

Note that in all of these cases .

E E G G G G G G E P E P G = ⊂ = = = = ≤

(42)

Assigning Discrete Probabilities

( )

( )

( )

1 2 1

When there are exactly possible outcomes of an experiment, , ,..., then the assigned probabilities, , 1, 2,... , must satisfy the following:

(1) 0 1, 1, 2,..., . (2) 1. If all of t n i i n i i n x x x p x i n p x i n p x = = ≤ ≤ = =

( )

1

he outcomes have equal probability, then each ; thus, the 1

probability of any particular outcome on the roll of a fair die is . 6 Suppose, however, we have a biased die and the probability of a 4

i p x n =

( )

( )

( )

( )

( )

( )

( )

is 3 times more likely than the probability of any other outcome. This implies that

1 2 3 5 6 (for example) and 4 3 .

1 1 3

It follows that 8 1 . Thus, , 4, and (4) .

8 8 8

p p p p p a p a

a a p i i p

= = = = = =

(43)

Applied Statistics: Probability 1-43

Exercises:

Suppose Bigg Fakir claims that by clairvoyance he can tell the numbers of

four cards numbered 1 to 4 that are laid face down on a table. (He must choose all 4 cards before turning any over.) If he has no special powers and guesses at random, calculate the following:

(a) the probability that Bigg gets at least one right (b) the probability he gets two right

(c) the probability Bigg gets them all right.

Note: assume that Bigg must guess the value of each card before looking at any of the cards.

(44)

Bigg Fakir Solution

The sample space:

1234 2134 3124 4123 1243 2143 3142 4132 1324 2314 3214 4213 1342 2341 3241 4231 1423 2413 3412 4312 1432 2431 3421 4321

[

]

Let Number of cards Bigg gets right. (a) We seek 1 .

Suppose that Bigg chooses 1234 (it does not matter). There is at least one match in the entire first column. There are three matches in each of

R

P R

=

[ ]

the remaining columns. 15 5 Thus, there are 15 with at least one match and = .

24 8

P R =

(45)

Applied Statistics: Probability 1-45

Complex Combinations

How many ways are there to create a “full house”

(3-of-a-kind plus a pair) using a standard deck of 52 playing

cards?

13

4

12

4

13 4 12 6

3, 744.

1

3

1

2

⎛ ⎞⎛ ⎞⎛ ⎞⎛ ⎞

=

=

⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟

⎝ ⎠⎝ ⎠⎝ ⎠⎝ ⎠

i i i

(choose denomination)x(choose 3 of 4 of given

denomination)x(choose one of the remaining

denominations)x(choose 2 of 4 of this second

denomination).

(46)

What is the probability of a “full house”?

In discrete problems we interpret probability as a ratio:

number of successful outcomes

.

total number of outcomes.

In this case the number of successful outcomes is

successes

successes

failures

=

+

5

the number

of ways to get a full house (3,744). The total number of outcomes is:

52

52

52 51 50 49 48

2, 598, 960.

5

5!

5 4 3 2 1

3,744

Thus, the probability of getting a full house is

2, 59

⎛ ⎞

=

=

=

⎜ ⎟

⎝ ⎠

i i i i

i i i i

0.00144

8, 960

This is an example of a hypergeometric distribution; we'll study this soon.

=

A full house happens about once in every 694 hands! This is why people invented wild cards.

(47)

Applied Statistics: Probability 1-47

Conditional Probability

ˆ

The conditional probability of given

that has occurred is

ˆ

Q1: What is the probability of obtaining

a total of 8 when rolling two dice?

ˆ

Q2: Suppose you roll two dice that you

cannot see. Someone tells you that the

sum is greater than 6. What is the

probability that the sum is 8?

A

B

( )

(

)

( | )

, provided

0.

( )

P A

B

P A B

P B

P B

=

(48)

Dice Problem

( )( )( )( )

Let be the event of getting 8 on the roll of two dice. Let be the event

that the sum of the two dice is greater than 6. The first question is Find ( ).

Here is the sample space:

(1,1) 1,2 1, 3 1, 4 1, 5

A

B

P A

( )

( )( )( )( )( )

( )( )( )( )( )

( )( )( )( )( )

( )( )( )( )( )

( )( )( )( )( )

1, 6

(2,1) 2,2 2, 3 2, 4 2, 5 2, 6

(3,1) 3,2 3, 3 3, 4 3, 5 3, 6

(4,1) 4,2 4, 3 4, 4 4, 5 4, 6

(5,1) 5,2 5, 3 5, 4 5, 5 5, 6

(6,1) 6,2 6, 3 6, 4 6, 5 6, 6

5

( )

.

36

P A

=

Sum=8.

because we are assuming that each outcome pair has the same probability, 1/36.

(49)

Applied Statistics: Probability 1-49

Dice Problem (conditional)

Here we roll the dice and learn that the sum is greater than 6. Let represent the event that the sum is greater than 6. With this

knowledge the sample space becomes the following:

( )

( )( )

( )( )( )

( )( )( )( )

( )( )( )( )( )

( )( )( )( )( )

1, 6 2, 5 2, 6 3, 4 3, 5 3, 6 4, 3 4, 4 4, 5 4, 6 5,2 5, 3 5, 4 5, 5 5, 6 (6,1) 6,2 6, 3 6, 4 6, 5 6, 6 5 It follows that ( | ) . 21 P A B =

Alternatively, by definition of conditional probability, we have

( ) ( ) ( | ) because . ( ) ( ) 5 ( ) 36 5 Furthermore, . 21 ( ) 21 36 P A B P A P A B A B A P B P B P A P B ∩ = = ∩ = = =

So…the definition makes sense! Note well!

(50)

Try this.

A university has 600 freshmen, 500 sophomores, and 400 juniors. 80 of the freshmen, 60 of the sophomores, and 50 of the juniors are Computer Science majors. For this problem assume there are NO seniors.

What is the probability that a student, selected at random, is a freshman or a CS major (or both)?

If a student is a CS major, what is the probability he/she is a sophomore?

(51)

Applied Statistics: Probability 1-51

Use these steps to solve previous slide

1.

What is the sample space?

2.

What are the events (subsets) of

interest?

3.

What are the probabilities of the events

of interest?

(52)

Curtains…

Suppose you are shown three curtains and told that a treasure chest is behind one of the curtains. It is equally likely to be behind curtain 1, curtain 2, or curtain 3; thus, the initial

probabilties are 1/3, 1/3, 1/3 for the treasure being behind each curtain.

Now suppose that Monte Hall, who knows where the treasure is, shows you that the treasure is not behind curtain number 2. The probabilities become ½, 0, ½ right? If you were asked to choose a curtain at this point you would pick either curtain and hope for the best.

1

Initially we had (1) (2) (3) , where ( ) probability that the prize 3

is behind curtain .

(1 2) (1) After Monte shows us curtain 2, we have (1| 2)

(2) (2) P P P P i i P P P P P = = = = ∩ = = 1 1 3 (3 | 2). 2 2 3 The formula works again!

P

= = =

Note: using the conditional probabilities you do not have to enumerate the conditional sample space.

(53)

Applied Statistics: Probability 1-53

Curtains Revisited

We change the game as follows. Again the treasure is hidden behind one of

three curtains. At the beginning of the game you pick one of the curtains - say

2. Then Monte shows you that the treasure is NOT behind curtain 3. Now

he offers you a chance to switch your choice to curtain 1 or to stay with your

original choice of 2. Which should you do? Does the choice make a difference?

(54)

Here’s the deal…

1 1 1 3 3 3

1 3

After you make your choice (but have not seen what's behind your curtain), the probabilities remain , , . Right? This means that the probability that the treasure is behind your curtain is and

2 3

the probability that it is behind one of the other curtains is . Monte will NEVER show you the treasure; thus, even after he shows you one of the curtains, the probability that the

treasure is behi 2

3

nd the curtain you did not choose is . It is twice as likely to be behind the other curtain so... you should always switch!

Moral of the story: be REALLY careful about underlying assumptions about the sample space and how it changes to create the conditional sample space. You are generally assuming the changes are random. Maybe they are not.

(55)

Applied Statistics: Probability 1-55

Alternate Form

( )

( ) ( | ) , provided 0. ( ) P A B P A B P B P B ∩ = ≠

We have seen that the conditional probability of event given that event

has occurred is:

A

B

Clearly this implies that (

)

( | ) ( ). This is referred to as the

"multiplication rule," and holds even when ( )

0. Notice that we could also

write (

)

( | ) ( ). Both these equations alwa

P A

B

P A B P B

P B

P A

B

P B A P A

=

=

=

ys hold for any

two events. But there is a special case where the conditional probabilities above

are not needed.

Note: memorize these conditional probability equations TODAY. They are extremely important.

(56)

Independent Events

ˆ

Two events are independent iff

the probability

ˆ

Example (dice)



Q1: If one die is rolled twice, is the probability

of getting a 3 on the first roll independent of

the probability of getting a 3 on the second

roll?



Q2: If one die is rolled twice, is the

probability that their sum is greater than 5

independent of the probability that the first

roll produces a 1?

and

A

B

(

)

( ) ( ).

(57)

Applied Statistics: Probability 1-57

Dice sample spaces (Q1)

1

The sample space associated with one roll of a die: 1, 2, 3, 4, 5, 6.

Unless otherwise stated we assume the die is fair so that the probability of 1

any one of the simple events is . The sample space as 6

Ω =

( )( )( )( )( )

( )( )( )( )( )

( )( )( )

sociated with two rolls of one die (or with one roll of a pair of dice):

(1,1) 1,2 1, 3 1, 4 1, 5 1, 6 (2,1) 2,2 2, 3 2, 4 2, 5 2, 6 (3,1) 3,2 3, 3 3, 4 3,

( )( )

( )( )( )( )( )

( )( )( )( )( )

( )( )( )( )( )

5 3, 6 (4,1) 4,2 4, 3 4, 4 4, 5 4, 6 (5,1) 5,2 5, 3 5, 4 5, 5 5, 6 (6,1) 6,2 6, 3 6, 4 6, 5 6, 6 1 1

Clearly (3, 3) . P(3 on first roll) P(3 on second roll) .

36 6

1 1 1

Because , the two events are independent. 6 6 36

P = = =

(58)

Dice: Q2

1

The probability of getting a 1 on the first die is . Let 5 be the event that

6

the sum of the two dice is greater than 5 and 1 be the event that the first roll

produces a 1. The sample space is:

G

F

( ) ( )( )( )( )

( )( )( )( )( )

( )( )( )( )( )

( )( )( )( )( )

(1,1) 1,2 1, 3 1, 4 1, 5 1, 6 (2,1) 2,2 2, 3 2, 4 2, 5 2, 6 (3,1) 3,2 3, 3 3, 4 3, 5 3, 6 (4,1) 4,2 4, 3 4, 4 4, 5 4, 6

( )( )( )( )( )

( )( )( )( )( )

(5,1) 5,2 5, 3 5, 4 5, 5 5, 6 (6,1) 6,2 6, 3 6, 4 6, 5 6, 6

[ ]

[ ]

26

13

5

.

36

18

1

1

.

6

P G

P F

=

=

=

1

5

F

G

[

]

2

1

1

5

.

36

18

P F

G

=

=

[

]

1

[ ] [ ]

1 13 13 1 5 1 5 . 18 6 18 108 P FG = ≠ P F P G = × =

(59)

Applied Statistics: Probability 1-59

Practice Quiz 1 – Explain your work

as you have been taught in class.

1. A university has 600 freshmen, 500 sophomores, and 400 juniors. 80 of the freshmen, 60 of the sophomores, and 50 of the juniors are Computer Science majors. For this problem assume there are NO seniors. If a student is a CS major, what is the probability that he/she is a Junior?

2. Evaluate

3. What is the probability of drawing 2 pairs in a draw of 5 cards from a standard deck of 52 cards? (A pair is two cards of the same denomination – such as two aces, two sixes, or two kings.)

3 1 . 4 i i ∞ = ⎛ ⎞ ⎜ ⎟ ⎝ ⎠

(60)

Multiplication and Total Probability

Rules*

Multiplication Rule

*This slide from Applied Statistics and Probability

for Engineers,3rd Ed ,by Douglas C. Montgomery and George C. Runger, John Wiley & Sons, Inc. 2006

(61)

Applied Statistics: Probability 1-61

Multiplication and Total Probability

Rules*

*This slide from Applied Statistics and Probability

for Engineers,3rd Ed ,by Douglas C. Montgomery and George C. Runger, John

(62)

Multiplication and Total Probability

Rules*

Total Probability Rule

Partitioning an event into two

mutually exclusive subsets.

Partitioning an event into several

mutually exclusive subsets.

*This slide from Applied Statistics and Probability

for Engineers,3rd Ed ,by Douglas C. Montgomery and George C. Runger, John Wiley & Sons, Inc. 2006

(63)

Applied Statistics: Probability 1-63

Problem 2-97a

ˆ

A batch of 25 injection-molded parts

contains 5 that have suffered excessive

shrinkage. If two parts are selected at

random, and without replacement, what is

the probability that the second part

selected is one with excessive shrinkage?



S={pairs (f,s) of first-selected,

second-selected taken from 25 total with 5 defects}



SD={second selected (no replace) is a defect}



FD={first selected is a defect}

(64)

Problem Solution

ˆ

We seek P[SD]=P[SD FD]+P[SD FN]

ˆ

This becomes

[

|

] [

]

[

|

] [

]

P SD FN P FN

+

P SD FD P FD

5

4

4

5

1

1

1

*

*

0.2.

24 5

24 25

6

30

5

=

+

= +

= =

(65)

Applied Statistics: Probability 1-65

Multiplication and Total Probability

Rules*

Total Probability Rule (multiple events)

*This slide from Applied Statistics and Probability

for Engineers,3rd Ed ,by Douglas C. Montgomery and George C. Runger, John Wiley & Sons, Inc. 2006

(66)

Total Probability Example

A semiconductor manufacturer has the following data regarding the effect of contaminants on the probability that chips fail.

Probability of Failure

Level of Contamination

0.1

High

0.01

Medium

0.001

Low

In a particular production run 20% of the chips have high-level, 30% have medium-level, and 50% have low-level contamination. What is the probability that one of the resulting chips fails?

(67)

Applied Statistics: Probability 1-67

Bayes Rule

ˆ

Suppose the events form a

partition of the event , then it follows

that

provided

A

( |

) (

)

(

| )

,

( |

) (

)

j j j i i i

P A B P B

P B

A

P A B P B

=

( )

0.

P A

1

,

2

,...,

n

B B

B

(68)

Exercise:

Moon Systems, a manufacturer of scientific workstations,

Produces its Model 13 System at sites A,B, and C, with

20%, 35%, and 45% produced at A,B, and C, respectively.

The probability that a Model 13 System will be found

Defective upon receipt by a customer is 0.01 if shipped

From site A, 0.06 if from B, and 0.03 if from C.

(a)

What is the probability that a Model 13 System selected

at random at a customer location will be defective?

(b) If a customer finds a Model 13 to be defective, what

is the probability that it was manufactured at site B?

(69)

Applied Statistics: Probability 1-69

Solution (a)

[ ]

[

] [ ] [

] [ ] [

] [ ]

Let be the event that a Model 13 is found to be defective at a customer site.

We want

|

|

|

, where

is the event that the Model 13 was shipped from plant and the events

and a

D

P D

P D A P A

P D B P B

P D C P C

A

A

B

C

=

+

+

re defined analogously. This is a very important example of conditioning

an event on three events that partition

. An equation like this can always be

written when a number of events partition an e

D

D

[ ]

[

] [ ]

{ }

[ ]

(

)( ) (

)(

) (

)(

)

1

vent in which we're interested.

(The general form would be

|

where

form a

partition of the event .) Substituting the given numbers we have:

0.01 0.2

0.06 0.35

0.03 0.45

0.037, whic

n i i i i i

P D

P D A P A

A

D

P D

=

=

=

+

+

=

h answers (a).

(70)

Solution (b)

(

| ) ( )

Now we seek ( |

)

(

| ) ( )

(

| ) ( )

(

| ) ( )

by Bayes Law. Substituting we get

(0.06) (0.35)

( |

)

(0.01) (0.2) (0.06) (0.35) (0.03) (0.45)

P D B P B

P B D

P D A P A

P D B P B

P D C P C

P B D

=

+

+

×

=

×

+

×

+

×

=

0.575

(

b) If a customer finds a Model 13 to be defective,

what is the probability that it was manufactured at

site B?

(71)

Applied Statistics: Probability 1-71

Bernoulli Trials

ˆ

“Consider an experiment that has two possible outcomes,

success and failure. Let the probability of success be p and

the probability of failure be q where p+q=1. Now consider

the compound experiment consisting of a sequence of n

independent repetitions of this experiment. Such a

sequence is known as a sequence of

Bernoulli Trials

.”

ˆ

The probability of obtaining exactly k successes in a

sequence of n Bernoulli trials is the

binomial probability

ˆ

Note that the sum of the probabilities Thus they

are said to form a

probability distribution

.

( )

( )

nk k n k

.

p k

=

p q

( )

1.

k

p k

=

(72)

Probability Distribution

{

}

{ }

{ }

1 2

1 1 2 2

When we take a discrete or countable sample space

,

,... and assign

probabilities to each of the possible simple events: (

)

, (

)

,...,

we have created a probability distribution. (Think

s s

P s

p P s

p

Ω =

=

=

that you have "distributed"

all of the probability over all possible events.) As an example, if I toss a coin

1

1

one time then (

)

and ( )

represents a probability distribution.

2

2

The single coin

P H

=

P T

=

toss distribution also is an example of a Bernoulli trial because

it has only two possible outcomes (generally called "success" or "failure).

(73)

Applied Statistics: Probability 1-73

Binomial Probability Distribution

( )

The binomial probabilities are defined by ( )

, where

is the probability of success and is the probability of failure in Bernoulli

trials. Suppose we toss a coin 10 times and we want the

n k n k k

p k

p q

p

q

n

=

[ ]

[ ]

total number of heads.

Then

, q

,

10. Using the above formula we obtain the

probabilities:

p

=

P H

=

P T

n

=

Binomial n=10 p=0.5 0.00E+00 5.00E-02 1.00E-01 1.50E-01 2.00E-01 2.50E-01 3.00E-01 0 1 2 3 4 5 6 7 8 9 10 probabilities

(74)

Regarding Parameters

( )

Notice that the binomial distribution is completely defined by the formula for its probabilities, ( ) , and by it "parameters" and . The binomial probability equation never changes so we r

n k n k k

p k = p qp n

egard a binomial

distribution as being defined by its parameters. This is typical of all probability distributions (using their own parameters, of course).

One of the problems we often face in statistics is estimating the parameters after collecting data that we know (or believe) comes from a particular

probability distribution (such as the and for the binomial). Alternatively, we may choose

p n

to estimate "statistics" such as mean and variance that are functions of these parameters. We'll get to this, after we consider random variables and the the continuous sample space.

(75)

Applied Statistics: Probability 1-75

Example (from Trivedi*)

Consider a binary communication channel transmitting coded words of bits

each. Assume that the probability of successful transmission of a single bit is

and that the probability of an error is

1

n

p

q

=

. Assume also that the code

is capable of correcting up to errors, where

0. If we assume that the

transmission of successive bits is independent, then the probability of

success-ful word transm

p

e

e

[

]

0

ission is:

or fewer errors in trials

.

Notice that a "success for the Binomial distribution" me

w e i n i i

P

P e

n

n

q p

i

− =

=

⎛ ⎞

=

⎜ ⎟

⎝ ⎠

ans getting an error,

which has probability .

q

*Probability and Statistics with Reliability, Queuing and Computer Science Applications, 2nd Ed, Kishor S. Trivedi, J. Wiley & Sons, NY 2002

(76)

Example

A communications network is being shared by 100 workstations. Time is divided into intervals that are 100 ms long. One and only one workstation may transmit during one of these time intervals. When a workstation is ready to transmit, it will wait until the beginning of the next 100ms time interval before attempting to transmit. If more than one workstation is ready at that moment, a collision occurs; and each of the ready workstations waits a random amount of time before trying again. If 1, then transmission is successful. Suppose the probability of a workstation being ready to transmit

k k =

(77)

Applied Statistics: Probability 1-77

Practice Quiz 2

ˆ

A partial deck of playing cards (fewer than 52 cards)

contains some spades, hearts, diamonds, and clubs (NOT 13

of each “suit”). If a card is drawn at random, then the

probability that it is a spade is 0.2. We write this as

P[Spade]=0.2. Similarly, P[Heart]=0.3, P[Diamond]=0.25,

P[Club]=0.25. Each of the 4 suits has some number of

“face” cards (King, Queen, Jack). If the drawn card is a

spade, the probability is 0.25 that it is a face card. If it is

a heart, the probability is 0.25 that it is a face card. If it

is a diamond, the probability is 0.2 that it is a face card.

If it is a club, the probability is 0.1, that it is a face card.

1. What is the probability that the randomly drawn card is a

face card?

2. What is the probability that the card is a Heart and a face

card?

3. If the card is a face card, what is the probability that it is a

(78)

Discrete Random Variables

(79)

Applied Statistics: Probability 1-79

Review of “function”

( )

( )

(

)

{

}

Defn: A function is a set of ordered pairs such that no two pairs have the same first element (unless they also have the same second element).

Example: g = 1,2 , 3, 5 , 5,12 defines a function, , whose "dg

2

omain" consists of the real numbers 1,3,5 and whose "range" consists of the numbers 2, 5,12. All functions are said to "map" values in their domain to values in their range.

Example: ( )f x = x +5. Here

(

)

{

2

}

a function is defined using a formula.

This actually implies the the function is , 5 : is a real number . Notice the following:

(a) The function has a "name." Here that name is . (b) The implied

f x x x

f

= +

domain of the function includes all real numbers, , that can be plugged into the formula. In this case that includes all real no's. (c) Every number in the domain (all reals) is "mapped" to

x x

{

}

2 2 2 the number +5. Thus (1) 6, ( 5) 30, ( ) +5.

(d) Sometimes we write this as 1 6, -5 30, +5. (e) The range of is : 5 .

x f f f f x x

π

π

π

π

= − = = → → → ≥

(80)

Random Variable

ˆ

Definition: A random variable on a

sample space is a function that assigns a

real number to each sample point

ˆ

The inverse image of is the set of all

points in that the random variable

maps to the value .

ˆ

It is denoted

 

X

( )

X s

.

s

∈Ω

x

Ω

X

x

{

|

( )

}.

x

A

= ∈Ω

s

X s

=

x

Ω

discrete

X

discrete

Ω

continuous

X

continuous

Ω

(81)

Applied Statistics: Probability 1-81

{

s s s

1

,

2

, ,...

3

}

Ω =

= −∞ ∞

(

,

)

( )

We define

as the set of all points in that "map" into the value

.

Sometimes we write

and state that

is the "inverse image"

of the value under the random variable . For discrete ra

x x x

A

x

A

X x

A

x

X

Ω

=

[ ]

ndom variables,

we then define the probability of the value to equal

x

P A

x

.

X

Random Variable

[ ]

( )

.

X x

p

x

=

P A

We write ( )

X s

=

x

, where

s

∈Ω

, and

x

.

[

]

OR we may be given a discrete (continuous later) random variable, a description

of the values it can produce and the probability of each value. For example,

For

k

=

1, 2,..., ,

n P X

=

k

=

p

k

. In this case we ne

ed not know what the

underlying experiment really is.

(82)

The role of a random variable

Experiment 1: Roll 1 fair die and determine the outcome.

Experiment 2: Spin an arrow that lands with equal probability on one of the numbers 1 through 6.

Experiment 3: You have 6 cards numbered 1 through 6. Shuffle them and draw one at random. Replace the card and reshuffle to repeat.

Notice that we’d represent the sample space of each of these as {1,2,3,4,5,6} usually without drawing dice or arrows or cards, but the sample spaces really include dice, arrows, cards.

For each probability distribution 1

let for 1, 2,...6. 6

i

p = i =

The importance of the random variable is that it lets us deal with such an experimental setup without thinking dice, arrows, or cards. We say: “Let X be a random variable such that takes on the discrete values 1,2,3,4,5,6. Its probability mass function is given as:

the probability that X=i is 1/6. We write this as

1

( )

for i=1,2,...,6.

6

X

(83)

Applied Statistics: Probability 1-83

Probability Mass Function

If is a discrete random variable, then its probability mass function (pmf) is given by: ( ) ( ) ( ) ( ). x X x s A X p x P X x P A P s ∈ = = = =

{

1 2

}

The pmf satisfies the following properties:

(p1) 0

( )

1 for all values, , such that [

] is defined.

(p2) If X is a discrete random var iable then

( )

1, where the set

,

,... includes

X X i i

p

x

x

P X

x

p

x

x x

=

=

all real

numbers, , such that

x

p

X

( )

x

0.

Note: you cannot define a pmf without first defining a random

variable. You can, however, define a probability distribution directly on a sample space with no random variable defined.

(84)

MathCad definition

Note that MathCad refers to the probability

mass

function as the probability

density

function (pmf versus pdf). This is the reason

that the included pmf’s begin with the letter “d,”

like dbinom.

We

will reserve pdf for use with

continuous distributions. However, you must

interpret pdf as pmf when using MathCad.

The text uses “probability mass function,” but

represents a pmf with a function, f, instead of

our notation, p. (See page 70.)

Figure

Figure 3-5 A probability distribution can be viewed as a loading  with the mean equal to the balance point
Figure 3-6 The probability distribution illustrated in Parts (a)  and (b) differ even though they have equal means and equal  variances.
Figure 4-10 Normal probability density functions for  selected values of the parameters μ and σ 2 .
Figure 4-16 Determining the value of x to meet a  specified probability.
+3

References

Related documents

Note that the expected value of X is not necessarily a value that will occur in a single trial of the experiment (In this particular case, you can not get 1.5 heads if you flip

The area between the curve and the horizontal axis is 1 square unit (100% of a unity) The areas under a probability distribution curve correspond to probabilities for x from

Additional variables included: (1) schoolwide emphasis on inquiry or PjBL-related practices which was measured using the single item, “Is there a schoolwide emphasis on

The legs are similar in shape with a standard Ooze, but the texture should be bloated like its upper body..

We opted to bring the leads from the coils out directly through holes drilled in the rear end plate. You may decide to bring the leads out a different way. Position the wood blocks

Survey responses revealed the counties that had detailed project-level information such as maintenance activities carried out on county roads, cost of maintenance

The research identified that the Native Refugee Camps at Orange River Station, Kimberley and Taung were relocated and consolidated at Dry Harts, starting late September 1901

Kot smo predvidevali, predmet šport učencem s prekomerno telesno težo in debelostjo v večini ni všeč, saj je tako odgovorilo kar 60,00 % prekomerno težkih in debelih učencev..