Introduction to Logic Programming with Prolog (Section 11.3)
Section 11.3
description
Transcript of Section 11.3
Section 11.3Basic Concepts of Probability
Math in Our World
Learning Objectives
Compute classical probabilities. Compute empirical probabilities.
Probability Experiments
A probability experiment is a process that leads to well-defined results called outcomes.An outcome is the result of a single trial of a probability experiment.
Example: flipping a coin and getting heads
Probability Experiments
A sample space is the set of all possible outcomes of a probability experiment.Experiment Sample SpaceToss one coin {head, tail}Roll a die {1, 2, 3, 4, 5, 6}Toss two coins {head/head, tail/tail,
head/tail, tail/head}
Probability Experiments
An event is any subset of the sample space of a probability experiment.
Experiment: draw a card.Sample space: 52 cards.Event: drawing an ace.
Classical ProbabilityLet E be an event that is a subset of the sample space S. We will write n(E) to represent the number of outcomes in E, and n(S) to represent the number of outcomes in S. The probability of the event E is defined to be
There is one key assumption we make in classical probability: that every outcome in a sample space is equally likely.
( ) Number of outcomes in ( )( ) Number of outcomes in
n E EP En S S
EXAMPLE 1 Computing Classical Probabilities
A single die is rolled. Find the probability of getting(a) A 2.(b) A number less than 5.(c) An odd number.
In this case, since the sample space is 1, 2, 3, 4, 5, and 6, there are six outcomes: n(S) = 6.(a) There is one possible outcome that gives a 2, so
SOLUTION
1(2)6
P
EXAMPLE 1 Computing Classical Probabilities
(b) There are four possible outcomes for the event of getting a number less than 5—1, 2, 3, or 4; so n(E) = 4, and
SOLUTION
(c) There are three possible outcomes for the event of getting an odd number: 1, 3, or 5; so n(E) = 3, and
( )(a number less than 5)( )
n EPn S
4 26 3
( )(odd number)( )
n EPn S
3 16 2
EXAMPLE 2 Computing Classical Probabilities
Two coins are tossed. Find the probability of getting(a) Two heads.(b) At least one head.(c) At most one head.
SOLUTIONThe sample space is {HH, HT, TH, TT}; therefore, n(S) = 4.(a) There is only one way to get two heads: HH. So
( )(two heads)( )
n EPn S
14
EXAMPLE 2 Computing Classical Probabilities
(b) “At least one head” means one or more heads; i.e., one head or two heads. There are three ways to get at least one head: HT, TH, and HH. So n(E) = 3, and
SOLUTION
(c) “At most one head” means no heads or one head: TT, TH, HT. So n(E) = 3, and
( )(at least one head)( )
n EPn S
34
( )(at most one head)( )
n EPn S
34
Facts About Probability• Both n(E) and n(S) have to be zero or positive, so
probability is never negative.• Since S represents all possible outcomes, and E
is a subset of S, n(E) is always less than or equal to n(S). This means that probability is never greater than 1.
• When an event cannot possibly occur, the probability is zero, and when an event is certain to occur, the probability is one.
Facts About Probability• The sum of the probabilities of all the outcomes in
the sample space will always be one.• For any event, E, P(E') = 1 − P(E), where E' is the
event “E does not occur.”For example, if a die is rolled, the probability that a 4 will not occur, symbolized by P(4'), is 5/6 since there are five ways that a 4 will not occur; i.e., 1, 2, 3, 5, 6. OR
Empirical ProbabilityEmpirical probability is based on observed frequencies—that is, the number of times a particular event has occurred out of a certain number of trials.
Observed frequency of the specific even ( )( )Total number of trials ( )
f fP En n
EXAMPLE 3 Computing an Empirical Probability
In a sample of 50 people, 21 had type O blood, 22 had type A blood, 5 had type B blood, and 2 had type AB blood. Set up a frequency distribution and find these probabilities for a person selected at random from the sample.(a) The person has type O blood.(b) The person has type A or type B blood.(c) The person has neither type A nor type O
blood.(d) The person does not have type AB blood.Source: Based on American Red Cross figures
EXAMPLE 3 Computing an Empirical Probability
SOLUTION(a)
(b) The frequency of A or B is 22 + 5 = 27.
Type (class)
Observed Frequency
A 22B 5AB 2O 21Total 50
21(O)50
fPn
27(A or B)50
P
(c) Neither A nor O means either B or AB; the frequency of either B or AB is 5 + 2 = 7. 7(neither A nor O)
50P
(d) The probability of not AB is found by subtracting the probability of AB from 1.
(not AB) 1 (AB)P P 2 48 241
50 50 25