Skip to main content

Someone wanted to learn this too, so Grasp built them a personal learning path.

You can keep exploring this one or create your own

Probability Density Functions for Continuous Random Variables

Hello! Welcome back to our course on the mathematical foundations of AI.

In our last lesson, we explored Probability Mass Functions (PMFs), which perfectly describe discrete random variables by assigning a specific probability to each possible value. We saw that for a discrete variable , the probability is often positive and meaningful.

Today, we shift our focus to continuous random variables. As we've touched upon, for any continuous variable , the probability of it taking on any single exact value is zero, i.e., . This renders the PMF useless, as it would simply be a function that is zero everywhere. To handle this, we need a new concept.

This lesson addresses the learning outcome: Define and compute probability density functions (PDFs) for continuous random variables. We will develop the idea of "probability density" and see how it allows us to characterize the distribution of a continuous random variable using the tools of calculus.

1. From Probability Mass to Probability Density

For a discrete random variable, we can think of the PMF as distributing a total probability mass of 1 among a set of distinct points. For a continuous random variable, this mass is spread smoothly over an interval, like a fine layer of dust. Instead of asking about the mass at a single point (which is zero), we ask about the density of the mass at that point.

The following video provides an excellent analogy to build this intuition, contrasting the "point masses" of a PMF with the "spread-out mass" of a PDF.

L08.2 Probability Density Functions

This video from MIT OpenCourseWare introduces the concept of a PDF using a 'snowfall' analogy, which helps visualize how probability is distributed over a continuous range.

Watch the first 1 minute and 50 seconds. Focus on the distinction between how probability is assigned for discrete versus continuous random variables.

This idea of "density" can be formalized by thinking about the probability of the variable falling into a very small interval around a point . Let's consider the probability that our random variable falls in the interval for a very small . While this probability, , approaches zero as approaches zero, the ratio of the probability to the interval's length can approach a finite, non-zero value. This ratio is the probability density.

The Probability Density Function (PDF), denoted , is defined as this limit:

This gives us an interpretation of the PDF as probability per unit length. For a small , we can approximate the probability of a small interval as:

2. The Formal Definition of a PDF

Your background in calculus will be useful here. We can connect the PDF directly to another fundamental concept: the Cumulative Distribution Function (CDF).

The CDF, which we will explore in depth in the next lesson, is defined as . It represents the total accumulated probability up to the value . Using this, we can write the probability of our small interval as:

Substituting this into our limit definition for the PDF gives:

You will immediately recognize this as the definition of the derivative.

Definition: For a continuous random variable with a differentiable CDF , the Probability Density Function (PDF) is the derivative of the CDF.

The following video walks through this derivation and introduces the key properties of the PDF that stem from this definition.

26-Probability Density Function (PDF) for Continuous Random Variables

This video from Probability Course formalizes the definition of the PDF as the derivative of the CDF and introduces its essential properties.

Watch from the beginning to 01:02, then from 02:21 to 05:38, and finally from 07:51 to 12:31. Pay close attention to: Why the PMF fails for continuous variables. The derivation of the PDF from the limit definition, leading to the derivative of the CDF. The summary of the key properties of a PDF.

3. Properties of the Probability Density Function

As you just saw in the video, and as a direct consequence of its definition, any valid PDF must satisfy a few fundamental properties. These are the continuous analogues of the PMF properties.

For a continuous random variable with PDF :

  1. Non-negativity: The density can't be negative.

    Important: Unlike a PMF, it is possible for . This is because the PDF represents a density, not a probability. For example, if probability is concentrated in an interval of length 0.1, the density in that region could be around 10 to ensure the total probability integrates to 1.

  2. Normalization: The total area under the PDF curve must equal 1. This is because the probability of the random variable taking some value on the real line is 1.

  3. Probability Calculation: By the Fundamental Theorem of Calculus, the probability that falls within an interval is the integral of the PDF over that interval.

    Since , it makes no difference whether the interval is open or closed.

You can also read through a concise summary of these concepts in the text that accompanies the video you just watched.

4.1.1 Probability Density Function (PDF)

For a textual summary, this resource provides the same formal definitions and properties we have just discussed.

Read the sections 'Probability Density Function (PDF)' and the summary of properties that begins 'Since the PDF is the derivative of the CDF...'. This will reinforce the mathematical formalism.

4. A Worked Example: Computing with PDFs

Let's put these concepts into practice. A common task is to be given the functional form of a PDF with an unknown constant and then use it to find probabilities. The following example, involving the exponential distribution, is a classic.

We'll follow three steps:

  1. Find the unknown constant using the normalization property.
  2. Find the CDF by integrating the PDF.
  3. Calculate the probability of an interval using both the PDF (integration) and the CDF (subtraction).

The final segment of the video from Probability Course provides a perfect, step-by-step walkthrough.

26-Probability Density Function (PDF) for Continuous Random Variables

This video segment provides a complete example of working with a PDF. It demonstrates how to find a normalizing constant, derive the CDF, and calculate probabilities.

Watch from 12:31 to the end. Follow the solution to the example where the PDF is given by f(x) = c * e^(-x). You are encouraged to pause the video and try to solve it yourself before watching the solution.

Test your understanding!

Let be a continuous random variable representing a value chosen uniformly at random from the interval .

  1. Given that the distribution is "uniform," what should the shape of its PDF, , be over the interval ? What is its value outside this interval?
  2. Let for and otherwise. Use the normalization property to find the value of the constant .
  3. Calculate the probability .
  4. Derive the CDF, . (Remember to define it for all ).
Show answer
  1. PDF Shape: Since the value is chosen uniformly, the probability density should be constant across the interval and zero elsewhere.

  2. Find c: We use the normalization property: .



    So, the PDF is for and 0 otherwise.

  3. Calculate Probability:

  4. Derive CDF: We find .

    • For , , so .
    • For , .
    • For , the probability has fully accumulated, so . We can also see this by integrating: .

    Combining these pieces, the CDF is:

Conclusion

In this lesson, we transitioned from the discrete world of PMFs to the continuous world of PDFs. We established that for continuous random variables, probability is not found at points but is measured over intervals as an area under a curve.

Key Takeaways:

  • A Probability Density Function (PDF), , describes the distribution of a continuous random variable. It represents probability density, not probability itself.
  • The PDF is formally defined as the derivative of the CDF: .
  • A valid PDF must be non-negative () and normalize to one ().
  • Probabilities for intervals are calculated by integrating the PDF: .

Preview of the Next Lesson:
We briefly introduced the Cumulative Distribution Function (CDF) today as a means to define the PDF. In the next lesson, we will give the CDF its full attention. We will formally define it for both discrete and continuous variables, explore its universal properties, and see why it is, in many ways, an even more fundamental description of a random variable's distribution than either the PMF or the PDF.

Can't find a good explanation? Sign up and we'll make it for you

Sign up