Course contentsShow
← Machine Learning and Deep Learning
Lesson 58 of 3,5381. Mathematical Foundations for Machine LearningFree lesson

Random Variables: Discrete and Continuous

Distinguish between discrete and continuous random variables and their representations.

Random Variables: Discrete and Continuous

What you'll learn: How to distinguish between discrete and continuous random variables and understand their different representations.

The Core Idea

A random variable is simply a numerical outcome of a random process. Think of it as a function that assigns numbers to possible events in a sample space (remember sample spaces from earlier lessons?).

There are two fundamental types:

Discrete Random Variables

These can only take specific, countable values — like counting items. Imagine rolling a die: the outcome can only be 1, 2, 3, 4, 5, or 6. Nothing in between.

Examples:

  • Number of emails you receive (0, 1, 2, 3, ...)
  • Coin flips mapped to numbers (Heads = 1, Tails = 0)
  • Number of customers entering a store

We represent discrete random variables using a probability mass function (PMF), which tells us P(X = x) — the probability that X equals exactly some value x.

Continuous Random Variables

These can take any value within a range — like measuring something. Think of someone's exact height: it could be 170.5 cm, 170.53827 cm, or any value on a continuous scale.

Examples:

  • Temperature readings
  • Time until an event occurs
  • A person's weight

We represent continuous random variables using a probability density function (PDF). Important: for continuous variables, the probability of any exact value is zero! Instead, we calculate probabilities over intervals using integration.

The Key Distinction

The analogy: discrete is like stairs (step from one value to the next), while continuous is like a ramp (smooth transition through infinite possibilities).

Key Takeaway: Discrete random variables take countable values and use probability mass functions; continuous random variables take values in ranges and use probability density functions.