Course Content
Probability Theory Basics
Probability Theory Basics
The Multiplication Rule of Probability
We have already considered that if events A and B are independent, then:P(A and B) = P(A) *P(B)
.
This formula is a special case of the more general probabilities multiplication rule:
It states that the probability of the joint occurrence of two events, A and B, is equal to the probability of event A multiplied by event B's conditional probability, given that event A has occurred.
Example
Assume you draw two cards from a standard deck (52 cards) without replacement. What is the probability of drawing a heart on the first card and a diamond on the second?
Event A - drawing a heart first.
Event B - drawing a diamond second.
import numpy as np # Creating a deck of 52 cards suits = ['H', 'D', 'C', 'S'] # Hearts, Diamonds, Clubs, Spades ranks = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A'] deck = [rank + suit for suit in suits for rank in ranks] # Counting the number of cards in the deck total_cards = len(deck) # Counting the number of hearts and diamonds in the deck hearts = sum(card[-1] == 'H' for card in deck) diamonds = sum(card[-1] == 'D' for card in deck) # Calculating P(A) p_A = hearts / total_cards # Calculating P(B|A) # We have already removed one heart from the deck # Total number of cards has become 1 less # As a result conditional probability can be calculated p_B_cond_A = diamonds / (total_cards - 1) # Resulting probability due to multiplication rule p = p_A * p_B_cond_A print(f'Resulting probability is {p:.4f}')
Note
Pay attention that in the multiplication probabilities rule, the order in which events occur is unimportant - we can consider both the probability
P(B)*P(A|B)
andP(A)*P(B|A)
.
Thanks for your feedback!