Recommended resources
The freely available resources this lesson will direct you to.
Hello! Welcome to the next lesson in our course on the mathematical foundations of AI.
In the previous lesson, you learned to define a random variable as a measurable function mapping outcomes from a sample space to real numbers. We distinguished between discrete random variables, which take on a countable set of values, and continuous ones, which take values from an uncountable set like an interval.
This lesson focuses on the first of these two types. We will address the learning outcome: Define and compute probability mass functions (PMFs) for discrete random variables. A PMF is the primary tool for describing the probabilistic behavior of a discrete random variable, assigning a specific probability to each possible value it can take. This concept is the discrete counterpart to the Probability Density Function (PDF) we will encounter later for continuous variables.
1. Defining the Probability Mass Function (PMF)
Let's start by formalizing what a PMF is. For a discrete random variable , we are interested in the probability that it takes on each of its possible numerical values. The function that provides these probabilities is the PMF.
Definition: Let be a discrete random variable with support (range) . The Probability Mass Function (PMF) of , denoted , is a function that assigns a probability to each possible value of .
It's crucial to remember the notation from our last lesson: the event is shorthand for the set of all outcomes in the sample space such that the random variable function maps that outcome to the value . That is, . The PMF, therefore, tells us the total probability of this set of outcomes.
To see this definition in action, let's watch a short video that introduces the PMF, illustrates its construction, and outlines its fundamental properties.
L05.3 Probability Mass Functions
This video from MIT OpenCourseWare provides a clear definition of the PMF, illustrates the concept with a simple experiment, and lays out the fundamental properties that every PMF must satisfy.
Watch from the beginning to 06:39. Focus on how the PMF is constructed by grouping outcomes from the sample space that map to the same numerical value and then summing their probabilities. Also, pay close attention to the two key properties discussed: non-negativity and summing to one.
Properties of a PMF
As you saw in the video, any function must satisfy two essential properties to be a valid PMF. For a discrete random variable with support , its PMF must exhibit:
- Non-negativity: The probability of any event must be non-negative.
- Normalization: The sum of the probabilities of all possible outcomes must be 1. Since the values in the support correspond to disjoint events that cover the entire sample space, their probabilities must sum to 1.
For any value not in the support , the event is impossible, so we define .
To see these properties stated formally, please review the following short text.
3.1.3 Probability Mass Function (PMF)
To solidify the formal definition and properties, please read the following sections from the ProbabilityCourse.com text.
Read the initial definition section (ending just before the first example) and the section titled 'Properties of PMF'. This will reinforce the connection between the PMF and the underlying sample space and formally state the rules a PMF must obey.
2. Computing a PMF
Now let's establish a systematic procedure for finding the PMF of a discrete random variable based on an experiment:
- Define the Sample Space (): List all possible outcomes of the experiment and determine their probabilities.
- Define the Random Variable (): Specify the function that maps each outcome in to a real number.
- Determine the Support (): Identify the set of all possible numerical values that can take.
- Calculate Probabilities: For each value in the support :
a. Find the subset of outcomes in that map to .
b. Sum the probabilities of these outcomes to find . - Verify: Check that all are non-negative and that they sum to 1.
The following video segment demonstrates this exact process for a random variable defined as the sum of two dice rolls.
L05.3 Probability Mass Functions
Now, let's apply this procedure. The following segment demonstrates how to systematically calculate the PMF for a random variable defined as the sum of two tetrahedral dice rolls.
Watch from 06:39 to 10:11. Follow the step-by-step process of identifying the possible values of the random variable (the sum) and then finding the probability for each value by counting the corresponding outcomes.
Test your understanding!
Consider an experiment where you toss a fair coin three times. Let the random variable be the number of heads observed. Following the procedure outlined above, derive the PMF of .
- What is the sample space ? What is the probability of each outcome?
- What is the support ?
- What are the values of , , , and ?
- Does your derived PMF satisfy the normalization property?
Show answer
-
Sample Space: . Since the coin is fair and tosses are independent, each of the 8 outcomes has a probability of .
-
Support: The number of heads can be 0, 1, 2, or 3. So, .
-
PMF Calculation:
- : This corresponds to the outcome . So, .
- : This corresponds to the outcomes . So, .
- : This corresponds to the outcomes . So, .
- : This corresponds to the outcome . So, .
-
Verification: The sum of the probabilities is . The normalization property holds.
The PMF can be summarized as:
3. Common Discrete Distributions
While we can derive a PMF for any discrete random variable from first principles, many common experimental setups give rise to PMFs that have a standard, parameterized form. Recognizing these "named distributions" is a cornerstone of statistical modeling. Your background in computer science will make the "stories" behind these distributions quite intuitive.
The reading below introduces three of the most fundamental discrete distributions.
Discrete Random Variables Class 4, 18.05
Many real-world phenomena can be modeled by a few common discrete distributions. Understanding their PMFs is a crucial step in statistical modeling. This reading from MIT lecture notes introduces three of the most important ones: Bernoulli, Binomial, and Geometric.
Read sections 3.1 (Bernoulli), 3.2 (Binomial), and 3.4 (Geometric). For each one, focus on: The underlying 'story' or experiment it models. The parameters of the distribution (e.g., 'p' for Bernoulli, 'n' and 'p' for Binomial). The formula for its PMF.
Let's summarize the PMFs for these three key distributions.
a) The Bernoulli Distribution: Bernoulli(p)
- Story: A single trial with two possible outcomes: "success" (value 1) or "failure" (value 0).
- Parameter: , the probability of success.
- Support: .
- PMF: and . This can be written elegantly as a single formula:
b) The Binomial Distribution: Bin(n, p)
- Story: The number of successes in independent Bernoulli trials.
- Parameters: (number of trials) and (probability of success in each trial).
- Support: .
- PMF: The probability of getting exactly successes is:
The term is the binomial coefficient, "n choose k", which counts the number of ways to arrange the successes among the trials. Given your background, this should be familiar from combinatorics.
c) The Geometric Distribution: Geo(p)
- Story: The number of trials until the first success is observed in a sequence of independent Bernoulli trials.
- Parameter: , the probability of success on any given trial.
- Support: (a countably infinite set).
- PMF: The probability that the first success occurs on the -th trial is:
This corresponds to having failures, each with probability , followed by one success with probability .
Note: Some definitions, including the one in the resource LINK, define the Geometric distribution as the number of failures before the first success. This shifts the support to and the PMF to . Both are valid; it's a matter of convention. We will stick to the "number of trials until success" definition, which has support starting at 1.
Conclusion
In this lesson, we have formally defined the Probability Mass Function (PMF) as the definitive tool for characterizing discrete random variables. You have learned how to derive a PMF from the basic principles of an experiment and have been introduced to the PMFs of three foundational discrete distributions that appear frequently in machine learning and data science.
Key Takeaways:
- The PMF, , gives the probability that a discrete random variable takes on a specific value .
- A valid PMF must be non-negative for all inputs and its values must sum to 1 over the support of the random variable.
- You can compute a PMF by identifying all outcomes that map to a given value and summing their probabilities.
- The Bernoulli, Binomial, and Geometric distributions are fundamental building blocks with well-defined PMFs that model common probabilistic scenarios.
Preview of the Next Lesson:
With discrete random variables and their PMFs now understood, our next step is to address their continuous counterparts. In the next lesson, we will define and compute Probability Density Functions (PDFs), which describe the probability distributions of continuous random variables. We will see how probabilities for continuous variables are defined over intervals rather than single points, a crucial shift that requires the tools of calculus.