2 - Calculating Prob

Download as pdf or txt
Download as pdf or txt
You are on page 1of 107

Computing Probability

1 / 87
Objectives
1 Evaluate probability of joint events such as unions
and intersections from the probabilities of
individual events with additive rule
2 Interpret and calculate conditional probabilities of
events.
3 Use conditional probability to
• understand the independent concept
• derive multiple law, total law and Bayes’ rule
to compute probability or conditional
probability of complicated events
2 / 87
Inclusion - Exclusion principle

Table of contents
1 Inclusion - Exclusion principle
2 Conditional probability
3 Multiplication formula and Tree diagram
4 Total probability law
5 Bayes’ Theorem
6 Independence

3 / 87
Inclusion - Exclusion principle

From Axioms of Probability

A ∪ B = I ∪ II ∪ III, A = I ∪ II, B = II ∪ III


where I, II, III are disjoint. So
P (A ∪ B) = P (I) + P (II) + P (III),
P (A) = P (I) + P (II), P (B) = P (II) + P (III)
4 / 87
Inclusion - Exclusion principle

Inclusion - Exclusion Formula

P (A ∪ B) = P (A) + P (B) − P (A ∩ B)

5 / 87
Inclusion - Exclusion principle

Inclusion - Exclusion Formula

P (A ∪ B) = P (A) + P (B) − P (A ∩ B)

If A and B are mutually exclusive (AB = ∅)


then
P (A ∪ B) = P (A) + P (B)
As a consequence
Complement Rule
P (Ac) = 1 − P (A)
5 / 87
Inclusion - Exclusion principle

General Inclusion - Exclusion Formula


1 P (A ∪ B ∪ C) = P (A) + P (B) + P (C) −
P (AB) − P (BC) − P (CA) + P (ABC)
2

P (A1 ∪ A2 ∪ ... ∪ An)


=P (A1) + P (A2) + · · · + P (An)
X X
− P (AiA)j + P (AiAj Ak )
i1 <ij i<j<k

+ · · · + (−1)n−1P (A1A2 . . . An)


6 / 87
Inclusion - Exclusion principle

Example
After being interviewed at two companies he likes,
John assesses that his probability of getting an
offer from company A is 0.8, and his probabil-
ity of getting an offer from company B is 0.6.
If he believes that the probability that he will
get offers from both companies is 0.5, what is
the probability that he will get at least one of-
fer from these two companies?

7 / 87
Inclusion - Exclusion principle

Solution
Denote
• A: he gets offer from company A
• B: he gets offer from company B
then the event
• A: get offers from both companies is A ∩ B
• B: get at least one offer is A ∪ B
We have
P (A) = 0.8, P (B) = 0.6, P (A ∩ B) = 0.5
We need to compute
P (A ∪ B)
8 / 87
Inclusion - Exclusion principle

Applying inclusion - exclusion formula, we ob-


tain
P (A ∪ B) = P (A) + P (B) − P (A ∩ B)
so
P (A ∪ B) = 0.8 + 0.6 − 0.5 = 0.9

9 / 87
Inclusion - Exclusion principle

Exercise
A customer will invest in tax-free bonds with a
probability of 0.6, will invest in mutual funds
with a probability of 0.3, and will invest in both
tax-free bonds and mutual funds with a probabil-
ity of 0.15. Find the probability that a customer
will invest
1 in either tax-free bonds or mutual funds;
2 in neither tax-free bonds nor mutual funds.

10 / 87
Conditional probability

Table of contents
1 Inclusion - Exclusion principle
2 Conditional probability
3 Multiplication formula and Tree diagram
4 Total probability law
5 Bayes’ Theorem
6 Independence

11 / 87
Conditional probability

We assigned probabilities to events, i.e. to pos-


sible outcomes of a future experiment, we as-
sumed that we have no knowledge whatsoever
about the outcome that will occur.

There are many instances, however, when we


have some knowledge about what will happen
or what has already happened. .

12 / 87
Conditional probability

We assigned probabilities to events, i.e. to pos-


sible outcomes of a future experiment, we as-
sumed that we have no knowledge whatsoever
about the outcome that will occur.

There are many instances, however, when we


have some knowledge about what will happen
or what has already happened. .
Example
In an experiment involving two successive rolls
of a fair die, you are told that the sum of the
two rolls is 9. How likely is it that the first
roll was a 6? 12 / 87
Conditional probability

• Restrict possible outcomes on new sample


space {(3, 6), (4, 5), (5, 4), (6, 3)}
• First roll was 6 = {(6, 3)}
• the probabililty is equal to 14 = 0.25
13 / 87
Conditional probability

Example
Select randomly one out of the 10 balls and then, without
returning this to the box, we take another one.

What is the prob that the second ball is blue if the first ball
is white?
14 / 87
Conditional probability

Example
Select randomly one out of the 10 balls and then, without
returning this to the box, we take another one.

What is the prob that the second ball is blue if the first ball
is white? 49
14 / 87
Conditional probability

Example
A class contains 26 students. Of these, 14 are
economics majors, 15 are first-year students, and
7 are neither. A person is selected at random
from the class.
1 What is the probability that the person is
both an economics major and a first- year
student?
2 Given that (i.e. it is known that ) the per-
son selected is a first-year student. What is
the probability that he or she is also an eco-
nomics major?
15 / 87
Conditional probability

Solution

5
1
13
2
2
3

16 / 87
Conditional probability

• 2 events A and B

17 / 87
Conditional probability

• 2 events A and B
• If we know for sure that A happens, how
does the likelihood of B change?
seek to construct a new probability law, which
takes into account this knowledge and which, for
any event A, gives us the conditional probability
of B given A, denoted by P (B|A)

17 / 87
Conditional probability

Definition (Conditional Probability)


The conditional probability of B given A,
denoted by P (B|A), is defined by
P (AB)
P (B|A) =
P (A)
if P (A) > 0

18 / 87
Conditional probability

Definition (Conditional Probability)


The conditional probability of B given A,
denoted by P (B|A), is defined by
P (AB)
P (B|A) =
P (A)
if P (A) > 0
Measure the likelihood of B in the new sample
space A

18 / 87
Conditional probability

Meaning

Conditional probability provides the capability


of reevaluating the idea of probability of an event
in light of additional information, that is, when
it is known that another event has occurred. The
probability P (A|B) is an updating of P (A)
based on the knowledge that event B has oc-
curred.

19 / 87
Conditional probability

Properties

1 Complement rule
P (B c|A) = 1 − P (B|A)
2 Additive rule
P (B ∪ C|A) = P (B|A) + P (C|A) − P (BC|A)

20 / 87
Conditional probability

Example

Twenty percent of the employees of Acme Steel


Company are college graduates. Of all of its em-
ployees, 20% are college graduate and 15% are
college graduates earning more than $50,000. What
is the probability that an employee selected
at random earns more than $50,000 per year,
given that he or she is a college graduate?

21 / 87
Conditional probability

Solution
• H = “earns more than $50,000 per year”
• C = “college graduate.”
• We need to compute P (H|C)
• Given data P (C) = 0.2, P (H ∩ C) = 0.15

P (H ∩ C) 0.15
P (H|C) = = = 0.75
P (C) 0.2

22 / 87
Conditional probability

Practice
The probability that a regularly scheduled flight
departs on time is P (D) = 0.83; the probability
that it arrives on time is P (A) = 0.82; and the
probability that it departs and arrives on time is
P (A ∩ D) = 0.78. Find the probability that a
plane
1 arrives on time, given that it departed on
time
2 departed on time, given that it has arrived
on time.

23 / 87
Conditional probability

Interpretation

In the group of employees which are college grad-


uate, there are 75% earn more than $50,000 per
year

24 / 87
Conditional probability

Example
Education Male Female
Elementary 38 45
Secondary 28 50
College 22 17
If a person is picked at random from this group,
find the probability that the person is a male,
given that the person has a secondary education.

25 / 87
Conditional probability

Question: find the probability that


the person is a male,
| {z }
A: interested event
given that
the person has a secondary education
| {z }
B: addition information - condition or new sample space

26 / 87
Conditional probability

Question: find the probability that


the person is a male,
| {z }
A: interested event
given that
the person has a secondary education
| {z }
B: addition information - condition or new sample space
Find
P (AB)
P (A|B) =
P (B)

26 / 87
Conditional probability

Solution - 1st
approach
• Sample size: number of ways to pick a person
randomly is
|Ω| = 38 + 45 + 28 + 50 + 22 + 17 = 200
• Convert data into probability
Education Male Female Sum
38
Elementary 200 = .19 .225
Secondary .14 .25 .39
College .11 .085 .195
Sum .44 .56 1
27 / 87
Conditional probability

Education Male Female Sum


Elementary .19 .225
Secondary .14 .25 .39
= P (AB) = P (B)
College .11 .085 .195
Sum .44 .56 1

P (AB) .14
P (A|B) = =
P (B) .39

28 / 87
Conditional probability

Solution - 2nd
approach
• New sample space is B with 78 elements
• In new sample space, the number of ways
to pick a male is 28
• The probability that the person is a male,
given that the person has a secondary
education is
28
≈ 0.36
78
29 / 87
Conditional probability

Intepretation

Among all the person with secondary education,


the fraction of male is 36%

30 / 87
Multiplication formula and Tree diagram

Table of contents
1 Inclusion - Exclusion principle
2 Conditional probability
3 Multiplication formula and Tree diagram
4 Total probability law
5 Bayes’ Theorem
6 Independence

31 / 87
Multiplication formula and Tree diagram

Multiplication Formula

P (AB) = P (B|A)P (A).


Think of AB as event with 2 steps, then prob-
ability equals probability of first step multiply
with the conditional probability of second step
given first step

32 / 87
Multiplication formula and Tree diagram

Example
Draw 2 balls without replacement from the box.

What is the probability that both balls are white?


33 / 87
Multiplication formula and Tree diagram

Solution

• Ai: the ith draw is white


• 6
P (A1) = 10
• P (A2|A1) = 59
6 5
 
• P (A1A2) = P (A1)P (A2|A1) = 10 9 =
1
3

34 / 87
Multiplication formula and Tree diagram

Multistep
Sequence of events A1, A2, . . . , Ak
P (A1A2 . . . Ak ) =P (A1) × P (A2|A1) × P (A3|A1A
× P (Ak |A1 . . . Ak−1)

35 / 87
Multiplication formula and Tree diagram

Example - Qualify
control
A box contains five good lightbulbs and two de-
fective ones.
Bulbs are selected one at a time (without replace-
ment) until a good bulb is found. Find the prob-
ability that the number of bulbs selected is

(i) one, (ii) two, (iii) three.

36 / 87
Multiplication formula and Tree diagram

Solution
Initial situation A bulb selected at random
will be
• good (G) with
probability 57
• defective (D) with
probability 27

If a good bulb is selected then the activity stops


37 / 87
Multiplication formula and Tree diagram

Situation if the first selected bulb is defective

The second bulb selected at


random will be
• good (G) with
probability 56
• defective (D) with
probability 16

38 / 87
Multiplication formula and Tree diagram

Situation if the first and second selected bulbs


are defective

The third bulb selected at


random will be
• good (G) with
probability 1
• defective (D) with
probability 0

The activity stops 39 / 87


Multiplication formula and Tree diagram

Each of the three paths leading to a G has a dif-


ferent length.
5
(i) P (1) =
7
2 5 5
(ii) P (2) = . =
7 6 21
2 1 1
(iii) P (3) = . .1 =
7 6 21
40 / 87
Multiplication formula and Tree diagram

Practice

A lot of 100 semiconductor chips contains 20


that are defective.

Three are selected, at random, without replace-


ment, from the lot. Determine the probability
that all are defective.

41 / 87
Multiplication formula and Tree diagram

Practice

Suppose that P (A|B) = 0.4, P (B) = 0.5. De-


termine
1 P (A ∩ B)

2 P (A ∩ B)

42 / 87
Multiplication formula and Tree diagram

Practice

The probability that the head of a household is


home when a telemarketing representative calls
is 0.4. Given that the head of the house is home,
the probability that goods will be bought from
the company is 0.3. Find the probability that the
head of the house is home and goods are bought
from the company.

43 / 87
Total probability law

Table of contents
1 Inclusion - Exclusion principle
2 Conditional probability
3 Multiplication formula and Tree diagram
4 Total probability law
5 Bayes’ Theorem
6 Independence

44 / 87
Total probability law

Partition
A1 , . . . , An is a partition of Ω if
• mutually exclusive: Ai Aj = ∅ for i ̸= j
• A 1 ∪ A 2 ∪ . . . An = Ω

45 / 87
Total probability law

Partition
A1 , . . . , An is a partition of Ω if
• mutually exclusive: Ai Aj = ∅ for i ̸= j
• A 1 ∪ A 2 ∪ . . . An = Ω

BA1 , . . . , BAn is a partition of B


B = BA1 ∪ BA2 ∪ ... ∪ BAn
45 / 87
Total probability law

Total probability
formula - divide - and -
conquer
• Partition sample space into A1, A2, . . . , An
• Know P (B|Ai) for every i
• Compute P (B)
Xn
P (B) = P (BAi)
i=1
Xn
= P (B|Ai)P (Ai)
46 / 87
Total probability law

Example

Select randomly one out of the a box of 6 blue


balls and 4 green balls. Then without returning
this to the box, we take another one.

What is the probability that the second ball is


blue?

47 / 87
Total probability law

Solution

Denote
• B2: the second ball is blue
• G1: the first ball is green
• B1: the first ball is blue
We need to compute P (B2).

48 / 87
Total probability law

There are two possible cases that the 2nd ball is


blue
B2 = (B1G1) ∪ (B2G2)
By total law,

P (B2) = P (B2 ∩ G1) + P (B2 ∩ B1)


= P (G1)P (B2|G1) + P (B1)P (B2|B1)
4 6 6 5 54
= × + × = = 0.6
10 9 10 9 90

49 / 87
Total probability law

Example

You enter a chess tournament where your probability of


winning a game is 0.3 against half the players (call them
type 1), 0.4 against a quarter of the players (call them type
2), and 0.5 against the remaining quarter of the players
(call them type 3). You play a game against a randomly
chosen opponent. What is the probability of winning?

50 / 87
Total probability law

Solution
• Ai: your opponent is of type i
• W : you win
• The event that you win can be divided into
three cases according to the type of your
opponent
W = (A1W ) ∪ (A2W ) ∪ (A2W )

51 / 87
Total probability law

P (Ai) P (W |Ai) P (AiW )


1 1
2 0.3 2 (0.3) = 0.15
1 1
4 0.4 4 (0.4) = 0.1
1 1
4 0.5 4 (0.5) = 0.125
P (W ) = 0.15 + 0.16 + 0.2 = 0.375

52 / 87
Total probability law

Example

In a certain assembly plant, three machines, B1 , B2 , and


B3 , make 30%, 45%, and 25%, respectively, of the prod-
ucts. It is known from past experience that 2%, 3%, and
2% of the products made by each machine, respectively,
are defective. Now, suppose that a finished product is ran-
domly selected. What is the probability that it is defec-
tive?

53 / 87
Total probability law

Solution
Denote
• A: the selected product is defective
• Bi: the selected product is made by
machine Bi
The event that the selected product is defective
can be divided into three cases according to which
machine made it
A = (AB1) ∪ (AB2) ∪ (AB3)

54 / 87
Total probability law

• P (AB1) = P (B1)P (A|B1) = (.3)(.02) =


.006
• P (AB2) = P (B2)P (A|B2) = (.45)(.03) =
.0135
• P (AB3) = P (B1)P (A|B1) = (.25)(.02) =
.005
So P (A) = P (AB1) + P (AB2) + P (AB3) =
0.0245

55 / 87
Total probability law

Re-evaluate

if a product was chosen randomly and found to


be defective, what is the probability that it was
made by machine B3?

56 / 87
Total probability law

Solution

P (B3A)
P (B3|A) =
P (A)
0.005 10
= =
0.0245 49

57 / 87
Bayes’ Theorem

Table of contents
1 Inclusion - Exclusion principle
2 Conditional probability
3 Multiplication formula and Tree diagram
4 Total probability law
5 Bayes’ Theorem
6 Independence

58 / 87
Bayes’ Theorem

Bayes’ Theorem

• B1, B2, . . . , Bn are


mutually exclusive
• B1 ∪ B2 ∪ · · · ∪ Bn = S

P (Bk )P (A|Bk )
P (Bk |A) =
P (B1 )P (A|B1 ) + · · · + P (Bn )P (A|Bn )
for k = 1, 2, . . . , n
59 / 87
Bayes’ Theorem

Meaning
• Prior probability P (Bi) - initial belief
• Know P (A|Bi) for each i
• Given A occurs, wish to revise (update)
”belief” P (Bk |A)
P (A|Bk )P (Bk )
P (Bk |A) = Pn
i=1 P (A|Bi )P (Bi )

60 / 87
Bayes’ Theorem

Bayes’ rule is often used for inference. There


are a number of “causes” that may result in a
certain “effect.” We observe the effect, and we
wish to infer the cause

61 / 87
Bayes’ Theorem

Exercise
There is 0.25% of the general population suffer
from Covid. To diagnose whether someone suf-
fers from Covid, there is a medical examination
which has a probability 1% of giving a false re-
sult if someone has Covid and 2% if someone
does not have Covid. If we select at random a
person from the general population and he/she
tests positive for Covid, what is the probability
that this person actually suffers from Covid?

62 / 87
Bayes’ Theorem

Exericse
A contestant on a television show has to answer
multiple choice questions with four possible an-
swers. The probability that the contestant knows
the answer to a question is 75%. If the contestant
does not know the answer to a particular ques-
tion, she gives an answer at random. If she has
answered the first question correctly, what is the
probability that she knew the answer?

63 / 87
Bayes’ Theorem

Example

A plane is missing and it was equally likely to have gone


down in any of three possible regions. Let 1 − αi denote
the probability the plane will be found upon a search of
the i-th region when the plane is, in fact, in that region,
i = 1, 2, 3. What is the conditional probability that the
plane is in the i-th region, given that a search of region 1
is unsuccessful, i = 1, 2, 3?

64 / 87
Bayes’ Theorem

Solution

• Ai={the plane is in region i}

65 / 87
Bayes’ Theorem

Solution

• Ai={the plane is in region i}


• B={search of region 1 was unsuccessful}

65 / 87
Bayes’ Theorem

Solution

• Ai={the plane is in region i}


• B={search of region 1 was unsuccessful}
• Need P (Ai|B) =?

65 / 87
Bayes’ Theorem

Solution
Need to find
P (AiB) and P (B)
with information
• P (Ai) = 31
• P ( plane is found in region i|Ai) = 1 − α

66 / 87
Bayes’ Theorem

Solution
P (A1B) =?

67 / 87
Bayes’ Theorem

Solution
P (A1B) =?
A1B means that
• Plane is in region 1
• Search in region 1 was unsuccessful =
plane was not found in region 1

67 / 87
Bayes’ Theorem

Solution
P (A1B) =?
A1B means that
• Plane is in region 1
• Search in region 1 was unsuccessful =
plane was not found in region 1
1 α1
P (A1B) = P (A1)P (B|A1) = ∗ α1 =
3 3

67 / 87
Bayes’ Theorem

Solution

A2B means that


• Plane is in region 2
• Search in region 1 was unsuccessful =
plane was not found in region 1

68 / 87
Bayes’ Theorem

Solution

A2B means that


• Plane is in region 2
• Search in region 1 was unsuccessful =
plane was not found in region 1
1 1
P (A2B) = P (A2)P (B|A2) = ∗ 1 =
3 3

68 / 87
Bayes’ Theorem

Solution

A3B means that


• Plane is in region 3
• Search in region 1 was unsuccessful =
plane was not found in region 1

69 / 87
Bayes’ Theorem

Solution

A3B means that


• Plane is in region 3
• Search in region 1 was unsuccessful =
plane was not found in region 1
1 1
P (A3B) = P (A3)P (B|A3) = ∗ 1 =
3 3

69 / 87
Bayes’ Theorem

Solution

P (B) =P (A1B) + P (A2B) + P (A3B)


1 1 1
=α1 × + 1 × + 1 ×
3 3 3
α1 + 2
=
3

70 / 87
Bayes’ Theorem

Solution

P (B) =P (A1B) + P (A2B) + P (A3B)


1 1 1
=α1 × + 1 × + 1 ×
3 3 3
α1 + 2
=
3

70 / 87
Bayes’ Theorem

Solution
P (A1B) α1
P (A1|B) = =
P (B) α1 + 2

71 / 87
Bayes’ Theorem

Solution
P (A1B) α1
P (A1|B) = =
P (B) α1 + 2
P (A2B) 1
P (A2|B) = =
P (B) α1 + 2

71 / 87
Bayes’ Theorem

Solution
P (A1B) α1
P (A1|B) = =
P (B) α1 + 2
P (A2B) 1
P (A2|B) = =
P (B) α1 + 2
P (A3B) 1
P (A3|B) = =
P (B) α1 + 2

71 / 87
Independence

Table of contents
1 Inclusion - Exclusion principle
2 Conditional probability
3 Multiplication formula and Tree diagram
4 Total probability law
5 Bayes’ Theorem
6 Independence

72 / 87
Independence

Idea

• Usually P (A|B) ̸= P (A).

73 / 87
Independence

Idea

• Usually P (A|B) ̸= P (A).


• If P (A|B) = P (A), B has no effect on A
or knowing B does not change the
probability that A happens then

73 / 87
Independence

Idea

• Usually P (A|B) ̸= P (A).


• If P (A|B) = P (A), B has no effect on A
or knowing B does not change the
probability that A happens then
• A and B have no relation

73 / 87
Independence

Independent events

A and B are independent if


P (A|B) = P (A)
or
P (AB) = P (A)P (B).

74 / 87
Independence

Complement

If A is independent of B then it is independent


of B c.

75 / 87
Independence

Example
Two successive rolls of a fair 6-sided die

A: the 1st roll results in 2

B: the 2nd roll results in 4

Are A and B independent?

76 / 87
Independence

Solution

• P (A) = 16
• P (B) = 16
• 1
P (AB) = 36 = P (A)P (B)
• A and B are independent

77 / 87
Independence

Practice

Suppose that P (A|B) = 0.4, P (B) = 0.8 and


P (A) = 0.5. Are A and B are independent?

78 / 87
Independence

Practice
400 parts classified by surface flaws and as (func-
tionally) defective

Select randomly a part. Let


D = ”the part is defective”
F = ”the part has surface flaw”
Are D and F independent? 79 / 87
Independence

Independence of a set
of events
A set of events is said to be independent if, for
each collection of events chosen from them, say,
E1, E2, ..., En, we have
P (E1 ∩ · · · ∩ En) = P (E1) . . . P (En)

80 / 87
Independence

Example

Three events A, B, and C are independent: P (A) =


.5, P (B) = .3, and P (C) = .2.
1 Calculate P (A ∩ B ∩ C).

2 Calculate P (A ∩ C).

81 / 87
Independence

Example
A company manufactures stereo components. Ex-
perience shows that defects in manufacture are
independent of one another. Quality-control stud-
ies reveal that
2% of CD players are defective,
3% of amplifiers are defective,
7% of speakers are defective.
A system consists of a CD player, an amplifier,
and two speakers. What is the probability that
the system is not defective?

82 / 87
Independence

Example

• A series system is up if all of its


component is up
• Components operate independently
• pi: prob that component i is up
• Prob that series system is up: p1p2...pn

83 / 87
Independence

Example
A parallel system is up if any one of its compo-
nent is up

Assume that all component operates independently


84 / 87
Independence

• pi: probability that component i is up


• Probability that the parallel system is
down:

85 / 87
Independence

• pi: probability that component i is up


• Probability that the parallel system is
down:
(1 − p1)(1 − p2)...(1 − pn)
• Probability that the parallel system is up:

85 / 87
Independence

• pi: probability that component i is up


• Probability that the parallel system is
down:
(1 − p1)(1 − p2)...(1 − pn)
• Probability that the parallel system is up:
1 − (1 − p1)(1 − p2)...(1 − pn)

85 / 87
Independence

Example
An electronic system consists of 4 independent
components. Find the probability that entire sys-
tem works.

86 / 87
Independence

Solution
• Probability that the subsystem CD in
parallel is up

pCD = 1 − (1 − pC )(1 − pD )
= 1 − (1 − .8)(1 − .8) = .96
• Probability that the whole system is up
pApB pCD = (.9)(.9)(.96) =

87 / 87

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy