Probability Density Function
Why do we need density?
Imagine you're waiting for a bus that comes "roughly every 10 minutes." How long will you wait? 3 minutes? 7.5 minutes? 9.234 minutes? Your waiting time could be any number from 0 to 10.
This is different from rolling a die, where the result is only 1, 2, 3, 4, 5, or 6. No 3.7 or 5.123 possible.
| Discrete variables | Continuous variables |
|---|---|
| Only specific values | Any value in an interval |
| Die: 1, 2, 3, 4, 5, 6 | Waiting time: 0...10 min |
| Coin: heads or tails | Height: 150...200 cm |
For continuous variables, we can't ask "what's the probability of waiting exactly 3 minutes?" The answer is always zero. Why? Because between 2.999 and 3.001 there are infinitely many numbers, so the chance of hitting one exact point is zero.
Instead, we ask: "what's the probability of waiting between 2 and 5 minutes?" That's where density comes in.
The main idea: probability = area
The density function is a curve showing where values are "concentrated." The higher the curve at some point, the more often values fall in that region.
Probability of landing in an interval = area under the curve on that interval.
Move a and b so that P(a ≤ X ≤ b) = 0.5.
The integral is just the area. That's why gives us the probability.
Why does the total area equal 1?
The probability that something happens is 100%, or 1. So the total area under the entire density curve must equal 1:
This is called the normalization condition. If the function is only defined on interval , then:
This condition is our main tool for finding unknown constants in problems.
How to find the constant
Problem: Given on , and outside this interval. Find .
Logic: Since this is a density, the area under it must equal 1.
Solution:
Calculate the area (integral) and set it equal to 1:
The integral of is . Substitute the limits:
Therefore:
Check: The area of a triangle with base 2 and height is . It works!
How to calculate probabilities
Once the constant is found, we calculate probability as the area over the required interval.
Example: Density on . Find .
We need the shaded area (a trapezoid). We can calculate it geometrically or via integral:
So in 75% of cases, the value will be between 1 and 2.
Uniform distribution: the simplest case
When all values are equally likely, the density is a horizontal line.
Example: A bus arrives every 15 minutes. You arrive at the stop at a random time. Waiting time is uniformly distributed from 0 to 15.
Density: on interval .
Why ? Because the rectangle area is , so .
What's the probability of waiting at most 5 minutes?
For uniform distribution, probability is just the ratio of interval lengths!
Formula for uniform distribution on :
Expected value: the "average" result
Expected value is the "center of mass" of the distribution: if you repeated the experiment many times and averaged the results, you'd get approximately .
Why this formula? We take each value , multiply by its "weight" (how likely it is), and sum everything up (integrate).
Example: on .
Where's the "center" of this distribution? The density is higher on the right (at density is maximum), so the center is shifted right from the interval's midpoint.
The midpoint of is 1, but our is further right, because values are "concentrated" closer to 2.
For uniform distribution:
Just the midpoint, which makes sense since all values are equally likely.
Cumulative distribution function F(x)
Sometimes instead of density you're given the distribution function .
is the probability that the value is less than :
Connection:
- is the integral of
- is the derivative of
Properties of :
- (probability that is less than minus infinity is zero)
- (probability that is less than plus infinity is 100%)
- always increases (or stays flat)
Useful formula:
Complete worked example
Problem: A random variable has a density whose graph is a triangle on with its peak at .
a) Find the height .
b) Write as a piecewise function.
c) Find .
Solution:
a) Find from normalization:
Area of the triangle = 1:
b) Write piecewise:
Left side of the triangle: a line from to :
Right side: a line from to :
Outside : .
c) Find :
The interval crosses both pieces, so we split at :
First integral:
Second integral:
Total:
This makes sense: a symmetric interval around the peak contains 75% of the probability.
Common mistakes
Mistake 1: Forgetting normalization
If you're given and not told it's a density, check for yourself: the integral should equal 1.
Mistake 2: Integrating where
If outside , then when calculating , integrate only up to 2, not to 5.
Mistake 3: Confusing and
- : density (can be greater than 1!)
- : probability (always between 0 and 1)
Mistake 4: Thinking
For a continuous variable, the probability of hitting a point is always zero. It's not an error in the problem, it's a mathematical fact.
Normal distribution: the most important example
The normal distribution (bell curve) is the most famous continuous distribution in statistics. Heights, measurement errors, exam scores: all of them follow it approximately.
Its density function:
Here (mean) and (standard deviation) stay fixed. Drag the red and green points to compute .
Move a and b until P(a ≤ X ≤ b) ≈ 90 %.
Key properties:
- Symmetric around
- ~68% of probability falls within
- ~95% falls within
Check Your Understanding
Your turn1 of 2
The function for and otherwise is a density. What is ?
Your turn2 of 2
is uniformly distributed on the interval . What are the values of and ?
Formulas to remember
Probability = area:
Normalization condition:
Expected value:
Uniform distribution on :
- Density:
- Mean:
Connection between and :
Was this article helpful?