Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 27

Discrete vs. Continuous Random Variables

Recommended resources

Hello! Welcome to the next lesson in your journey through probability and statistics.

In our last session, we explored the fundamental rules of probability, including the axioms, conditional probability, and the powerful Bayes' theorem. We were concerned with the likelihood of abstract "events." Now, we'll make these concepts more concrete and computationally useful by introducing the idea of a random variable. This is a crucial step that allows us to connect the outcomes of real-world experiments to the world of numbers, functions, and graphs.

Today's learning outcome is to differentiate between discrete and continuous random variables and their distributions (the Probability Mass Function and Probability Density Function). By the end of this lesson, you will be able to:

  • Define a random variable and explain its purpose.
  • Distinguish between discrete and continuous random variables using clear examples.
  • Understand and interpret a Probability Mass Function (PMF) for discrete variables.
  • Understand and interpret a Probability Density Function (PDF) for continuous variables.

1. From Events to Random Variables

So far, we've talked about events like "getting heads on a coin toss" or "drawing a King from a deck." A random variable formalizes this by assigning a numerical value to every possible outcome of a random experiment. We typically denote random variables with a capital letter, like .

For example, if our experiment is "flip a coin three times," our sample space contains outcomes like {HHH, HHT, HTH, THH, HTT, THT, TTH, TTT}. This is descriptive, but not very mathematical. We can define a random variable to be "the number of heads in three flips." Now, each outcome maps to a number:

  • TTT →
  • HTT, THT, TTH →
  • HHT, HTH, THH →
  • HHH →

Suddenly, we've transformed our abstract outcomes into a set of numbers {0, 1, 2, 3}. This allows us to ask questions like "What is the probability that ?" and use mathematical functions to describe the probabilities of all possible values of .

Random variables come in two main flavors: discrete and continuous. Let's explore each.


2. Discrete Random Variables and the PMF

A discrete random variable is one that can take on a finite or countably infinite number of distinct values. Think of values you can list or count, even if the list goes on forever. There are "gaps" between the possible values.

To understand this concept better, please read the following introductory sections.

Probability Distributions for GATE Exam 2024

The article 'Probability Distributions for GATE Exam 2024' provides clear, exam-oriented definitions. We'll start by focusing on its explanation of random variables and the distinction between discrete and continuous types.

Read the sections under 'II. Discrete Probability Distributions', specifically 'A. Discrete Random Variables'. This includes '1. Definition of Random Variables', '3. Discrete vs. Continuous Random Variables', and '4. Examples of Discrete Random Variables'.

As the article explained, common examples of discrete random variables include:

  • The number you get when you roll a six-sided die: {1, 2, 3, 4, 5, 6}
  • The number of defective items in a sample of 20 products: {0, 1, 2, ..., 20}
  • The number of emails you receive in an hour: {0, 1, 2, 3, ...} (countably infinite)

The Probability Mass Function (PMF)

For a discrete random variable, we want a function that tells us the probability of each possible value. This function is called the Probability Mass Function (PMF), denoted as or . It gives the probability that the random variable is exactly equal to the value .

Let's watch a video that provides an excellent visual introduction to the PMF.

Probability Distributions Clearly Explained Visually (PMF, PDF and CDF)

The video 'Probability Distributions Clearly Explained Visually' by RiskByNumbers uses simple graphics to make the concept of a PMF intuitive.

Watch from the beginning to 02:04. Pay attention to how the dice roll experiment is mapped to a bar chart representing the PMF.

As the video showed for a fair die, the PMF would be:

Graphically, this is a bar chart where each of the six outcomes has a bar of height 1/6.

A valid PMF must satisfy two key properties:

  1. Non-negativity: for all possible values . (Probabilities can't be negative).
  2. Normalization: The sum of the probabilities for all possible values must equal 1. . (Something must happen).

To solidify these properties, please review the following text.

Probability Mass Function: Definition, Formula, and Examples

The article 'Probability Mass Function: Definition, Formula, and Examples' from DataCamp gives a concise summary of the PMF's definition and properties.

Read the section 'Understanding the Probability Mass Function', focusing on 'The probability mass function formula' and 'Definition and key properties'. This will reinforce the two conditions a PMF must meet.


3. Continuous Random Variables and the PDF

Now, what about quantities that aren't countable?

A continuous random variable is one that can take on any value within a given range. There are no gaps between the values; between any two possible values, there is always another possible value.

Let's start with a clear definition and some examples.

Probability Distributions for GATE Exam 2024

Let's return to the GATE-focused article to get a definition for continuous random variables.

Read the sections under 'III. Continuous Probability Distributions', specifically 'A. Continuous Random Variables'. This covers the definition, characteristics, and examples like height and temperature.

Examples of continuous random variables include:

  • The exact height of a student.
  • The temperature in a room.
  • The time it takes to run a 100-meter race.

Here's a critical difference: for a continuous random variable, the probability of it being exactly equal to any specific value is zero. For example, what's the probability that a person's height is exactly 175.000000... cm? It's zero, because there are infinitely many possible heights around 175 cm (175.1, 175.01, 175.001, etc.).

So, we can't use a PMF. Instead of asking about the probability of an exact point, we ask about the probability of the variable falling within an interval.

The Probability Density Function (PDF)

For continuous variables, we use a Probability Density Function (PDF), denoted as . A PDF is a curve where:

  • The total area under the curve is 1.
  • The probability that falls between two values, and , is the area under the curve between and .

This means . Don't worry if the integration symbol is unfamiliar; for now, just think of it as a tool to find the "area under the curve." The key idea is that with a PDF, probability is area.

The value of the PDF at a point , , is not a probability. It's a "probability density." A higher value means that the random variable is more likely to be found in an interval around .

Let's watch a visual explanation of the PDF to make this clear.

Probability Distributions Clearly Explained Visually (PMF, PDF and CDF)

We'll continue with the 'Probability Distributions Clearly Explained Visually' video. It does a great job of contrasting the PDF with the PMF we just learned about.

Watch from 04:26 to 07:20. This part first defines continuous variables and then explains the PDF, emphasizing that probability is the area under the curve, not the height of the curve itself.

A valid PDF must satisfy two properties, analogous to the PMF:

  1. Non-negativity: for all . (The density curve cannot dip below the x-axis).
  2. Normalization: The total area under the curve must be 1. . (The total probability over all possible values is 1).

4. Summary and Comparison

Let's bring everything together. The fundamental difference lies in whether the variable's possible values are countable (discrete) or fill a continuous range. This determines the type of function we use to describe its probabilities.

Here's a table that summarizes the key distinctions.

Characteristic Discrete Random Variable Continuous Random Variable
Possible Values Countable (e.g., 0, 1, 2, ...) Uncountable, in a range (e.g., all numbers from 0 to 1)
Probability Function Probability Mass Function (PMF), Probability Density Function (PDF),
Interpretation is the probability of an exact outcome. is the probability density.
Calculating Probability Summation: Integration (Area):
Point Probability can be greater than 0. for any exact value .
Visualization Bar chart Smooth curve

This image provides another excellent visual comparison of the two concepts:

Discrete vs. Continuous Random Variables Comparison Table
This table visually contrasts the properties of discrete and continuous random variables, covering their domain, probability distributions (PMF vs. PDF), visualization methods (bar chart vs. curve), and how key statistical measures are calculated.
Test your understanding!

For each of the following scenarios, identify whether the random variable is discrete or continuous.

  1. = The number of students in your class who score above 90% on the GATE exam.
  2. = The exact time (in seconds) it takes for a web page to load.
  3. = The number of coin flips required to get the first "Heads".
  4. = The exact voltage of a battery labeled "1.5V".
  5. = The number of cars passing a specific point on a highway in one hour.
Show answer
  1. Discrete. You can count the number of students (0, 1, 2, ...).
  2. Continuous. The time can be any value in a range (e.g., 1.235 seconds, 1.2351 seconds, etc.).
  3. Discrete. The number of flips will be an integer (1, 2, 3, ...). It's countably infinite.
  4. Continuous. The actual voltage could be 1.51V, 1.498V, or any value within a range around 1.5V.
  5. Discrete. You can count the number of cars (0, 1, 2, ...).

Conclusion

Congratulations! You've taken a significant step in your understanding of probability. Moving from abstract events to numerical random variables is the foundation for modeling and analyzing data.

Key Takeaways:

  • A random variable assigns a number to each outcome of a random experiment.
  • Discrete random variables have countable outcomes. Their probability distribution is described by a Probability Mass Function (PMF), where the value of the function at a point is the probability of that point.
  • Continuous random variables have outcomes that fall within a continuous range. Their probability distribution is described by a Probability Density Function (PDF), where the area under the curve over an interval gives the probability of the variable falling in that interval.
  • For a discrete variable, can be positive. For a continuous variable, for any exact value .

Preview of the Next Lesson:

Now that we know how to describe the probabilities of random variables, our next step is to summarize their distributions. In the next lesson, we will learn how to calculate and interpret the expected value and variance of random variables. These two numbers will give us a powerful way to describe the "center" and "spread" of a probability distribution.