Unit IV
Unit IV
Probability
Outline
• Making decisions under uncertainty,
• Classical definition of Probability,
• Events and their Outcomes,
• Rules of Probability,
• Probability axioms,
• Joint and Conditional probability,
• independence, and Bayes theorem
Making decisions under uncertainty
• Uncertainty :
• buying a lottery ticket
• toss a coin to make a choice
• Uncertainty in Everyday life
• Stock market
• Launch of a space shuttle
• Chance of a rain
• Eruption of an active volcano
• Match results
• Traffic accidents
• Crimes
• Uncertainty in Computer Science and Software Engineering
• Installation of software
• Number of defects in newly released software
• Amount of required memory for computer program being executed
• Job is sent to a printer
• Failure of electronic components
• Virus attack
Classical definition of Probability
• Probability of an event is understood as a chance that this event will happen.
• If a trial results in n exhaustive cases which are mutually exclusive and equally likely and out of which m are favorable to the happening of event A , the probability p of the
happening of event A is given by,
𝑚
𝑝=𝑃 𝐴 =
𝑛
𝐹𝑎𝑣𝑜𝑟𝑎𝑏𝑒𝑙 𝑂𝑢𝑡𝑐𝑜𝑚𝑒𝑠
𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑃 =
𝐴𝑙𝑙 𝑃𝑜𝑠𝑠𝑖𝑏𝑙𝑒 𝑂𝑢𝑡𝑐𝑜𝑚𝑒𝑠
Example 1 : I roll a die. What is the probability that I will role a three?
How many threes are there?
1
How many total numbers are there?
6
1
𝑇ℎ𝑒𝑟𝑒𝑓𝑜𝑟𝑒, 𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑒𝑣𝑒𝑛𝑡 = 𝑃(3) =
6
𝑊ℎ𝑎𝑡 𝑎𝑟𝑒 𝑦𝑜𝑢 𝑙𝑜𝑜𝑘𝑖𝑛𝑔 𝑓𝑜𝑟
i.e 𝐴𝑙𝑙 𝑃𝑜𝑠𝑠𝑖𝑏𝑖𝑖𝑡𝑖𝑒𝑠
Example 2 :
If there are 3 red marbles, two blue marbles and one yellow marble in a bag, Solve the
following…
1. P(red) = ?
2. P(blue)=?
3. P(yellow)=?
Example 3 :
If you took the book title “Kingdom of Denall”, each letter was made into a card and put
into a basket, what is the probability that you will reach in and draw out a letter ‘n’?
Example 4:
What is the probability that you are born in a month that ends in ‘er’?
Example 5 :
In a pet shop that sells only dogs and cats, there are 24 animals for sale, 10 are cats. If I
choose an animal at random: Solve P(dog)?
Events and their Outcomes
• Trial and Event
• throw of Coin
(Experiment /Trial)
• Head or Tail
(Outcome / Event)
• Equally Likely
• Mutually Exclusive
• Exhaustive
• Sample Space
• Independent and Dependent Events
• Simple and Compound Events
Outcomes, events, and the sample space
1. A collection of all elementary results, or outcomes of an experiment, is called a
sample space.
2. Any set of outcomes is an event. Thus, events are subsets of the sample space.
Ex: A tossed die can produce one of 6 possible outcomes: 1 dot through 6 dots.
Each outcome is an event.
There are other events:
• observing an even number of dots,
• an odd number of dots,
• a number of dots less than 3, etc.
1. P(A) ≥ 0
2. P(Ω) = 1
3. If A and B are disjoint events then,
P(A U B)=P(A) + P(B)
If A and B are not disjoint events then,
P(A U B)=P(A) + P(B) – P (A ∩ B)
Ex: What is a probability of getting a king when card is
drawn from the well shuffled pack?
Joint and Conditional probability
Joint Probability:-
For dependent events A and B, the probability of their simultaneous occurrence is
P (A and B) = P (A ∩ B) = P (A) × P (B / A) or
= P (B) × P (A/B)
Where P (B/A):- conditional probability, implies the probability of occurence of event B given that the
event A has already occurred.
e.g. If one card is drawn from a pack and then the second is drawn without replacing the first, the
Probability of the second draw is dependent on the first draw.
If A and B are independent events, then P (B/A) =P(B) or P (A/B) =P (A)
so that P (A and B) = P (A∩B) = P(A)× P (B)
(for independent events ‘AND’ implies multiplication of the probabilities.)
Example 1: Find the probability of drawing a queen and a king in that order from a pack of cards in
two consecutive draws when the cards drawn are
1) not being replaced
2) being replaced
Solution: Let A – event that the first card drawn is a queen
Let B - event that the second card drawn is a king
1. To find the probability of drawing a queen and a king in that order from a pack of cards in two consecutive draws when the
cards drawn are not being replaced.
Now, if the card is not replaced, there will be 51 cards in the pack and hence, the second event B of drawing a king from this
pack is dependent on the first.
Hence, Probability of drawing a queen followed by a king is P (A ∩ B) = P (A) × P (B / A)
Therefore, P(A) = ?
4
52
Hence, probability of drawing a king from the remaining pack of 51 cards is P(B/A) =?
4
51
Hence, Probability of drawing a queen followed by a king is
4 4
P (A ∩ B) = P (A) × P (B / A) = ×
52 51
2. If the card is replaced back, the event B of drawing a king is independent of
the first event, as there would be 52 cards again.
Hence,
4
P(B)=
52
4 4
P (A ∩ B) = P (A) × P (B)= ×
52 52
Example 2: A pair of dice is thrown. Find the probability of getting the sum
1) more than 9
2) multiple of 3 (H.W.)
3) divisible by 3 or 4 (H.W.)
Solution:
The sample space (all possible outcomes) consists of S={(1,1),(1,2)...(1,6),(2,1),…(6,6)}
i.e. n = Total possible outcomes = 62=36
1. To find the probability of getting sum more than 9
A – Event that the sum is more than 9
The favorable outcomes (the sum is 10 or 11 or 12) are
{(4,6),(5,5), (6,4),(5,6),(6,5),(6,6)}
i.e. m = 6
Therefore, P(A) = ?
𝑚
=
𝑛
6 1
= =
36 6
A bag contains 30 balls numbered from 1 to 30. One ball is drawn at random. Find the probability that
the number of the ball drawn will be
1. a multiple of 5 or 7
2. a multiple of 4 or 6
3. even number or a multiple of 5
Ex: A bag contains 30 balls numbered from 1 to 30. One ball is drawn at random. Find the probability
that the number of the ball drawn will be
1. a multiple of 5 or 7
2. a multiple of 4 or 6
3. even no. or a multiple of 5
Example 4: A card is drawn at random from well shuffled pack. Find the probability
that (H.W.)
1) it is not heart
2) it is a face card
Independence and Bayes theorem
If A1, A2, …,Ak…An are mutually exclusive and collectively exhaustive events and B is
any other event that occurs in conjunction with events A1, A2, …. An.
𝑃(Ak)× P (B/Ak)
Then, P(Ak/B)=
σ𝑛
𝑘=1 𝑃(Ak)× P (B/Ak)
𝑃(A1)× P (B/A1)
=
𝑃 A1 × P (B/A1)+𝑃 A2 × P (B/A2)+𝑃(A3)× P (B/A3)
Example 3: A factory has two machines A and B. A producing 300 units and B producing 700 units,
forming the total output. 5% of the items produced on A are defective and only 1% produced by B are
defective. If a defective item is drawn at random, what is the probability that it is produced by
machine A? Also find the probability that an item drawn randomly from the output is defective.
Solution:
Let A1: The event that the item is produced on machine A
A2: The event that the item is produced on machine B
D : The item is defective
To find the probability that the item is produced by machine A given
that it is defective
i.e. P(A1/D)
Therefore, By Bayes’ Theorem,
𝑃(A1)× P (D/A1) 𝑃(A1)× P (D/A1)
P(A1/D) = =
σ2𝑘=1 𝑃(Ak)× P (D/Ak) 𝑃 A1 × P (D/A1)+𝑃 A2 × P (D/A2)
Now, Total output = 300 + 700 = 1000
P(A1) = ?
300
= = 0.3
1000
700
and P(A2) = = 0.7
1000
Also, Since A produces 5% defective items,
5
P(D/A1) =(5%) = = = 0.05
100
1
Similarly, P(D/A2) =(1%) = = = 0.01
100
0.3 (0.05)
P(A1/D)=
0.3 0.05 + 0.7 (0.01)
0.015 0.015
= =
0.015+0.007 0.022
= 0.682
Similarly, P(A2/D) =?
0.7 (0.01)
=
0.3 0.05 + 0.7 (0.01)
0.007
= = 0.318
0.022
Now, the probability that the item drawn randomly from the total output is
defective is
P(D) = P(item is produced on machine A and is defective)
OR
P(item is produced on machine B and is defective )
= P(A1 ∩ D) + P(A2 ∩ D)
= P(A1) P(D/A1) + P(A2) P(D/A2) …………[Events D & A1 , A2 are dependent]
= 0.3 0.05 + 0.7 (0.01)
= 0.015 + 0.007
= 0.22
Example: It is observed that 15% of the males and 10% of the females in a city
having equal number of them, are singers. A person is selected at random from the
city. What is the probability that he is male known that he is singer.
Home Work
End of Unit IV