Course contentsShow
← Computer Science
Lesson 127 of 2,8723. Probability for Computer ScienceFree lesson

Continuous Random Variables and PDF

Define continuous random variables with uncountable outcomes; introduce probability density functions.

Continuous Random Variables and PDF

What you'll learn: How to work with random variables that can take any value in a continuous range, and how probability density functions describe them.

What Makes a Random Variable Continuous?

So far, you've worked with discrete random variables — they take distinct, separate values you can count (like number of coin flips or packet arrivals). But what if you need to model something like "time until a server responds" or "exact proportion of CPU usage"? These measurements can be any value within a range — not just whole numbers, but 2.5 seconds, 3.14159 seconds, or any decimal in between. That's a continuous random variable: one with uncountably infinite possible outcomes.

Why PMFs Don't Work Here

With discrete variables, you used probability mass functions (PMFs) to ask "What's P(X = 5)?" But for continuous variables, the probability of hitting any exact value is essentially zero! Think about it: what's the chance a server responds in exactly 2.000000... seconds (infinite decimals)? Zero.

Enter the Probability Density Function (PDF)

Instead of asking about exact values, we ask about ranges: "What's P(2 ≤ X ≤ 3)?"

The probability density function f(x) describes how probability is "distributed" along the number line. The PDF itself isn't a probability — it's a density. To find actual probabilities, you integrate (sum up infinitely small pieces) over an interval:

P(a ≤ X ≤ b) = ∫[a to b] f(x) dx

The total area under the PDF curve must equal 1 (certainty that some outcome occurs).

Analogy

Think of PDF like population density on a map. You can't say "3 people live at GPS coordinate (40.7128°, -74.0060°)" — that's a point! But you can say "10,000 people live in this neighborhood" (an area).

Key Takeaway: Continuous random variables have uncountably many possible values; their probabilities are described by probability density functions (PDFs), where areas under the curve represent probabilities over intervals.