Introduction
Welcome to the sixth module of your journey, "Probability and Statistics for AI." In the previous module on calculus, you mastered the concept of gradient descent, an algorithm that operates in a deterministic world to find the minimum of a function. You learned how to calculate its steps on paper and, crucially, how to implement it in Python.
Today, we pivot from the world of certainty to the world of uncertainty. Most real-world problems that AI tackles don't have perfectly predictable outcomes. Instead, they involve chance and incomplete information. Probability is the mathematical language we use to reason about this uncertainty. For your goal of building intelligent systems, understanding probability is not just a prerequisite; it is the very foundation upon which models learn from data and make predictions.
In this lesson, you will learn to apply the fundamental rules of probability: the addition, multiplication, and complement rules. These rules are the basic grammar of probability, allowing you to combine the likelihoods of simple events to calculate the chances of more complex and interesting outcomes.
1. The Building Blocks: Sample Spaces and Events
Before we can apply any rules, we need to be precise about what we're calculating the probability of. The most common mistake is to think of probability in terms of single outcomes. The key insight is that probability operates on events, which are sets of outcomes.
Let's build this crucial intuition from the ground up.
Give Me 1 Hour, I'll Make Probability Click Forever
This first video segment from Zachary Huang, titled 'Give Me 1 Hour, I'll Make Probability Click Forever,' does an excellent job of re-wiring your brain to think in terms of events and sample spaces. Pay close attention to the distinction between an outcome and an event.
Watch the video from 01:25 to 05:11. The examples using marbles and coins clearly illustrate the concepts of a sample space (all possible outcomes) and an event (a specific subset of those outcomes).
To formalize this, all of probability is built on three simple, common-sense rules known as Kolmogorov's Axioms. Given your preference for a theory-first approach, understanding these axioms provides a solid, logical foundation for everything that follows.
Probability Concepts — Applied Machine Learning in Python
The article 'Probability Concepts' from the 'Applied Machine Learning in Python' book formalizes the ideas from the video. It presents the three axioms that all probability calculations must follow.
Read the short section titled 'What is Probability?'. Note the three axioms: non-negativity, normalization, and additivity. Then, review the section 'Venn Diagrams' to see how these abstract ideas can be visualized. The Venn diagram is a powerful tool for thinking about events and their relationships.
In summary:
- Sample Space (): The set of all possible outcomes of an experiment.
- Event (A, B, ...): A subset of the sample space. It can be one outcome or many.
- Probability P(A): A number between 0 and 1 that measures the likelihood of event A occurring. It's calculated as the number of outcomes in event A divided by the total number of outcomes in the sample space (for equally likely outcomes).
2. The Complement and Addition Rules: "NOT" and "OR"
Now that we have our building blocks, we can start combining events.
The Complement Rule (NOT)
The complement rule is the simplest. If you know the probability of an event happening, this rule gives you the probability of it not happening. The complement of event A is written as or A'.
The rule is:
This works because an event either happens or it doesn't; the two possibilities must sum to 1 (100%).
Give Me 1 Hour, I'll Make Probability Click Forever
Let's return to the Zachary Huang video for a clear explanation of the complement rule.
Watch the segment from 08:24 to 09:41. The card example demonstrates how calculating the 'not' case is sometimes much easier than calculating the 'is' case directly.
This "shortcut" of calculating the opposite and subtracting from 1 is a common problem-solving strategy in probability.
The Addition Rule (OR)
What if we want to know the probability of event A or event B occurring? This is the probability of their union, written as . A naive approach would be to just add their probabilities: . However, this can lead to an error.
Give Me 1 Hour, I'll Make Probability Click Forever
This next segment of the video masterfully explains why simply adding probabilities is often wrong and how the addition rule corrects for it.
Watch from 09:57 to 12:28. The card example ('King or Heart') and the accompanying Venn diagram clearly show the problem of double-counting the overlap (the intersection). This is a critical concept to grasp.
As the video explains, the general addition rule is:
Here, is the probability of the intersection of A and B—that is, the probability of both events happening together. We subtract it to correct for having counted it twice.
A special case arises when two events are mutually exclusive, meaning they cannot happen at the same time (their intersection is empty, so ). In this case, the rule simplifies to:
3. The Multiplication Rule: "AND" and Independence
Now, let's focus on the intersection itself: the probability of event A and event B occurring, written . To calculate this, we need to introduce one of the most important concepts in probability: independence.
Two events are independent if the outcome of one has no effect on the outcome of the other. For example, flipping a coin and rolling a die are independent events.
When two events A and B are independent, the multiplication rule is straightforward:
Give Me 1 Hour, I'll Make Probability Click Forever
Understanding independence is key. The following video segment explains how to think about and test for independence, and then introduces the multiplication rule.
Watch from 29:04 to 33:22. Focus on the core idea: if P(A and B) is equal to P(A) * P(B), the events are independent. If not, they are dependent. The video gives excellent examples to build your intuition about this.
When events are not independent (i.e., they are dependent), this simple multiplication rule doesn't work. We will need a more powerful tool called conditional probability to handle those cases, which is the focus of our next lesson.
4. Applying the Rules: A Worked Example
Theory is essential, but application is the goal. Let's see how these rules are used in practice to solve a problem step-by-step.
Multiplication & Addition Rule - Probability - Mutually Exclusive & Independent Events
The channel 'The Organic Chemistry Tutor' provides very clear, step-by-step mathematical examples. This video solves a problem that requires you to use both the multiplication and addition rules, and also checks for independence.
Watch the example from 04:49 to 10:01. Follow the logic for calculating P(A and B), then P(A or B), and finally, how the results are used to determine if the events are independent or mutually exclusive.
This example solidifies the process:
- Identify what you know from the problem statement (, , etc.).
- Determine which probability you need to find ("and" intersection, "or" union).
- Select the correct formula (Addition Rule, Multiplication Rule).
- Plug in the numbers and calculate the result.
Now, try one yourself.
Practice Problem:
You roll a fair six-sided die. Let event A be "rolling a number divisible by 2" and event B be "rolling a number divisible by 3". What is the probability of rolling a number divisible by 2 or 3?
Solution Walkthrough:
- Identify Probabilities:
- Sample Space .
- Event A (divisible by 2) = . So, .
- Event B (divisible by 3) = . So, .
- Determine the Goal: We need , which is .
- Select the Formula: The events are not mutually exclusive because the outcome '6' is in both. So we must use the general addition rule: .
- Find the Intersection: The intersection is "a number divisible by both 2 and 3," which is . So, .
- Calculate:
You can find more examples and practice problems in the "Sample Questions" section of the GeeksforGeeks article on Probability Rules.
Conclusion
In this lesson, you have learned the fundamental grammar of probability. You moved from the abstract idea of "chance" to a formal system for calculating it.
Key Takeaways:
- Probability operates on events, which are sets of outcomes from a sample space.
- The Complement Rule provides a shortcut for finding the probability of an event not happening: .
- The Addition Rule calculates the probability of event A or B happening, correcting for any overlap: .
- The Multiplication Rule calculates the probability of event A and B happening, which for independent events simplifies to: .
This cheat sheet provides a great visual summary of all the rules we've discussed.

Preview of the Next Lesson:
We've focused on independent events, but in many real-world AI scenarios, events are dependent. For example, the probability of it raining tomorrow is dependent on whether it is cloudy today. In the next lesson, we will explore conditional probability to handle these dependencies. This will lead us directly to Bayes' Theorem, a cornerstone of machine learning that allows a system to update its beliefs as it receives new evidence.