Continuous random variable and density function
A continuous random variable measures things such as time, mass or height: it can take any value in an interval. For it, probability is not spread value by value but by regions: the probability that falls between two values is the area under a curve, the density function. This idea is the basis of the normal distribution, which takes up the rest of the topic.
Discrete versus continuous
A discrete random variable takes isolated values that can be counted: the number of heads in 10 tosses, the number of breakdowns in a month. Each value can be given a probability: , for example.
Between two different heights, however close, there is always another one. That is why you cannot list the possible values and assign them probabilities that add up to 1, as you do with a discrete variable. Another tool is needed.
From histograms to the density function
Measure the height of many people and group them into intervals. In a histogram, the height of each bar is adjusted so that the area of the bar is the relative frequency of its interval; thus the total area of all the bars is 1. If the number of people grows and the intervals become narrower, the top edge of the histogram smooths out until it looks like a curve.
The higher the curve is in a region, the more likely is to fall there. But be careful: the height of is not a probability. What is a probability is the area. (A height can even exceed 1 if the region is very narrow.)
If the curve is a simple figure, the area is calculated with geometry: a rectangle, a triangle, a trapezium. If the curve is the bell of the normal distribution, there is no elementary formula and you ask the calculator for the area; this will be covered in the section on normal calculations.
Probability at a point and inequalities
A single value is a segment with no width: the area under the curve over it is zero.
The intuition: nobody measures a height "exactly" cm to infinitely many decimal places; what makes sense to ask is the probability of being between and . This is different from what happens with a discrete variable, where can be non-zero, and and are indeed different.
Worked examples
Waiting for a bus
The time , in minutes, that a passenger waits at a stop until the bus arrives can be any value between 0 and 20. All instants are equally likely, so the density function is a constant for and outside that interval.
a) Find the value of .
b) Calculate the probability of waiting between 5 and 12 minutes.
c) Calculate the probability of waiting exactly 8 minutes.
Solution
a) The graph is a rectangle with base 20 and height . The total area must be 1:
b) The region between 5 and 12 is a rectangle with base and height :
c) is continuous and the value 8 is a single point: the area over it is zero.
A triangular density
The duration , in hours, of a sensor part is a continuous variable with density function
where is a positive constant.
a) Sketch the graph of and find .
b) Calculate .
c) Calculate .
d) Calculate .
Solution
a) The graph is a line that starts at the origin and reaches the point : the area under it is a triangle with base 4 and height . Its area must be 1: The height at is .
For the following parts, the area under from 0 to a value (with ) is a triangle with base and height :
b) .
c) It is easier using the complement:
d) The area between 1 and 3 is that from 0 to 3 minus that from 0 to 1:
From a histogram to a density
The time , in minutes, that 100 customers take to be served at an office has been measured. The data are grouped as follows:
| Time (min) | |||||
|---|---|---|---|---|---|
| Customers | 12 | 30 | 36 | 18 | 4 |
A histogram is drawn in which the area of each bar is the relative frequency of its interval (height of the bar = relative frequency divided by the width of the interval). This histogram is used as the density function of , and the customers are assumed to be spread uniformly within each interval.
a) Find the height of the bar for the interval .
b) Estimate .
c) Estimate the median service time, that is, the value such that .
Solution
The relative frequencies are , , , and (they add up to 1, as they must for the total area).
a) The bar for has area and width . Its height is The heights of the other bars are , , and .
b) We add the areas of the part of each bar that falls between 15 and 50:
- from 15 to 20 (in the bar ):
- from 20 to 40 (the whole bar):
- from 40 to 50 (half of the bar ):
c) The cumulative areas are up to 10, up to 20 and up to 40. The median therefore lies in . The area still missing is , and each minute of that bar contributes : (You must check that lies within the interval : it does.)
In the exam: when you are given a histogram, always calculate the area of the bars (base times height) and do not use the height directly as a probability. Write down each partial area, add them up and give the answer to 3 significant figures with units. If you are asked for a probability at a single point, the answer is 0.
Common mistakes
Summary
- A continuous random variable takes any value in an interval (it is measured); a discrete one takes isolated values (it is counted).
- Its probability is given by the density function : is the area under the curve between and , and the total area is 1.
- The height of is not a probability; the area is.
- For a continuous variable, ; hence and .
- If the curve is a simple figure, the area is calculated with geometry; if it is a normal bell curve, with the GDC.
Want to work on it together?
Free first consultation: we look at your level and your exam, and build a plan. Álvaro replies on WhatsApp.
Message us on WhatsApp