Professional Documents
Culture Documents
Lec02 Probability
Lec02 Probability
İnci M. Baytaş
Fall 2023
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 1
Fundamental Definitions
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 2
Fundamental Definitions
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 3
Venn Diagrams
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 4
Exercise
(b) Describe the sample space S consisting of all points in the first
quadrant inside a circle of radius 3 with a center at the origin.
(c) An experiment involves tossing a pair of dice, one green and one red,
and recording the numbers that come up. If x equals the outcome on
the green die and y the outcome on the red die, describe the sample
space S,
I by listing the elements (x , y )
I by expressing the rule.
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 5
Multiplicative Rule
Multiplicative rule
If an operation can be performed in n1 ways, and if for each of these ways
a second operation can be performed in n2 ways, then the two operations
can be performed in n1 n2 ways.
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 6
Multiplicative Rule
Multiplicative rule
If an operation can be performed in n1 ways, and if for each of these ways
a second operation can be performed in n2 ways, then the two operations
can be performed in n1 n2 ways.
Examples:
I What is the size of the sample space of throwing a pair of dice once?
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 6
Multiplicative Rule
Multiplicative rule
If an operation can be performed in n1 ways, and if for each of these ways
a second operation can be performed in n2 ways, then the two operations
can be performed in n1 n2 ways.
Examples:
I What is the size of the sample space of throwing a pair of dice once?
I How many even 4-digit numbers can be formed from the digits
0, 1, 2, 5, 6, 9 if each digit can be used only once?
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 6
Probability of an Event
Probability
The likelihood of the occurrence of an event with a finite sample space
resulting from a statistical experiment is evaluated using a set of real
numbers, probabilities, ranging from 0 and 1.
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 7
Probability of an Event
Probability
The likelihood of the occurrence of an event with a finite sample space
resulting from a statistical experiment is evaluated using a set of real
numbers, probabilities, ranging from 0 and 1.
0 ≤ P (A) ≤ 1
P (∅) = 0
P (S) = 1
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 7
Probability of an Event
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 8
Probability of an Event
Example
I A die is loaded so that an even number is twice as likely to occur as
an odd number. If E is the event that a number less than 4 occurs on
a single toss of the die, find P (E ).
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 8
Probability of an Event
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 9
Probability of an Event
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 9
Additive Rule
Additive rule
If A and B are two events, then
P (A ∪ B) = P (A) + P (B) − P (A ∩ B)
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 10
Additive Rule
Additive rule
If A and B are two events, then
P (A ∪ B) = P (A) + P (B) − P (A ∩ B)
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 10
Additive Rule
Additive rule
If A and B are two events, then
P (A ∪ B) = P (A) + P (B) − P (A ∩ B)
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 10
Additive Rule
Additive rule
If A and B are two events, then
P (A ∪ B) = P (A) + P (B) − P (A ∩ B)
Examples
I What is the probability of getting a total of 7 or 11 when a pair of
fair dice is tossed?
I A fair coin is tossed 3 times. E1 corresponds to the event where we
see two heads and one tail. E2 corresponds to seeing the head at the
first two tosses and the tail at the third. Calculate P (E1 ) and P (E2 ).
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 11
Exercise
In a factory, there are day (7 am-3 pm), evening (3 pm-11 pm), and
graveyard shifts (11 pm-7 am). During last year, 300 accidents happened.
(b) what is the probability that the accident occurred due to human error?
(c) what is the probability that the accident occurred on either the
evening or the graveyard shifts?
(d) what is the probability that the accident occurred due to unsafe
conditions?
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 12
Conditional Probability
Conditional probability
It is the probability of an event B occurring when it is known that some
event A has occurred,
P (A ∩ B)
P (B|A) = , provided P (A) > 0
P (A)
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 13
Conditional Probability
Conditional probability
It is the probability of an event B occurring when it is known that some
event A has occurred,
P (A ∩ B)
P (B|A) = , provided P (A) > 0
P (A)
Independent events
The occurrence of A has no impact on the odds of occurrence of B.
P (B|A) = P (B)
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 13
Product Rule
I If, in an experiment, the events A and B can both occur, then
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 14
Exercise
1. One bag contains 4 white balls and 3 black balls, and a second bag
contains 3 white balls and 5 black balls. One ball is drawn from the
first bag and placed unseen in the second bag. What is the
probability that a ball now drawn from the second bag is black?
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 15
Exercise
1. One bag contains 4 white balls and 3 black balls, and a second bag
contains 3 white balls and 5 black balls. One ball is drawn from the
first bag and placed unseen in the second bag. What is the
probability that a ball now drawn from the second bag is black?
Gender
Department Male Female Total
CMPE 60 20 80
IE 30 10 40
Total 90 30 120
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 16
Bayes’ Rule
Theorem of total probability/rule of elimination
If the events B1 , B2 , · · · , Bk constitute a partition of the sample space S
such that P (Bi ) 6= 0 for I = 1, 2, · · · , k then for any event A of S,
k
X k
X
P (A) = P (Bi ∩ A) = P (Bi ) P (A|Bi )
i=1 i=1
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 17
Bayes’ Rule
Bayes’s rule
If the events B1 , B2 , · · · , Bk constitute a partition of the sample space S
such that P (Bi ) 6= 0 for I = 1, 2, · · · , k then for any event A in S such
that P (A) 6= 0,
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 18
Exercise
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 19
Exercise
There is a 50-50 chance that the queen carries the hemophilia gene. Each
prince has a 50-50 chance of having hemophilia independently if she is a
carrier. The prince won’t have the disease if the queen is not a carrier.
Suppose the queen has had three princes without the disease. What is the
probability the queen is a carrier? If there is the fourth prince, what is the
probability that he will have hemophilia?
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 20
Exercise
İnci M. Baytaş CMPE 343 Introduction to Probability and Statistics for Computer Engineers 21