Continuous Random Variables and Uniform Laws
Continuous random variables replace probability masses at individual points with probability densities spread across intervals. The conceptual shift is important: for a continuous variable, a single exact value usually has probability zero, even though intervals have positive probability. This is not a paradox; density is not probability, but probability per unit length.
Figure: Exponential distributions model waiting times in memoryless processes. Image: Wikimedia Commons, Skbkekas, CC BY 3.0.
The MIT lectures first introduce general continuous random variables and then use the uniform distribution as the simplest example. Uniform random variables also explain percentiles, random arrival times modulo a schedule, and the idea that a probability law can be invariant under translations on an interval. They provide the cleanest bridge from finite equally likely outcomes to densities.
Definitions
A random variable is continuous with density if
for suitable sets . The density must satisfy
The cumulative distribution function is
If is differentiable at , then
The expectation of a continuous random variable is
when the integral is well-defined. More generally,
The variance is
A random variable is uniform on if
Key results
For ,
The mean is
The second moment is
Therefore
If and
then . Hence
and
For continuous random variables,
for every fixed point . This does not imply that impossible events are the only events with probability zero; singletons have zero length, so density gives them zero probability.
The density-to-probability rule should always be read as an area rule. If is large near a point, values near that point are comparatively likely, but the probability of the exact point remains zero. For a small interval , one has the approximation
when is continuous and is small. This is the continuous analogue of a probability mass, but it only becomes a probability after multiplying by an interval length.
The CDF remains meaningful for every random variable, discrete or continuous. For continuous variables with a density, the CDF is usually smoother; for discrete variables, it jumps at atoms. This distinction matters when reading graphs. A jump of size at means . A continuous CDF has no such jump at a point.
Uniform distributions are invariant under translations within the interval in the sense that equal-length subintervals have equal probability. If and , are both inside with the same length, then the two intervals have the same probability. This property is what people usually mean informally by "all locations are equally likely".
Percentiles are a major reason uniform random variables appear everywhere. If is a continuous strictly increasing CDF and has that CDF, then is uniform on . Conversely, if is uniform on , then has CDF . The lectures use this intuition when discussing percentiles of a randomly selected person: the height itself is not uniform, but the percentile rank is approximately uniform.
For expectations, the continuum formulas mirror the discrete ones. Replace sums by integrals and mass functions by densities. The same algebraic properties hold when integrals exist: linearity of expectation, the formula , and the transformation rule .
Visual
Uniform density on [alpha, beta]
height = 1/(beta-alpha)
+--------------------+
| |
| |
--------+--------------------+--------
alpha beta
area of rectangle = base * height = (beta-alpha)/(beta-alpha) = 1
| Uniform law | Density | Mean | Variance | CDF inside interval |
|---|---|---|---|---|
| on | ||||
| on |
The rectangle picture is more than a mnemonic. It explains normalization, interval probabilities, and scaling at the same time. If the base interval becomes twice as long, the height must become half as large so the total area stays . This is why stretching a uniform random variable spreads probability out rather than creating more probability. It also explains why the CDF inside the interval is linear: as the endpoint moves to the right, the accumulated area grows at a constant rate.
Uniform models should still be justified from the story. Arriving at a train platform at a "random time" gives a uniform wait modulo a fixed schedule only if arrivals are not synchronized with the schedule and the train spacing is deterministic. If trains themselves arrive randomly according to a Poisson process, the waiting-time distribution is exponential, not uniform. The same word "random" can therefore lead to different continuous laws depending on the mechanism.
One last check is dimensional: density has units inverse to the variable. If is measured in hours, is per hour; multiplying by an interval length in hours gives a unitless probability. This helps explain why density values themselves are not probabilities.
Worked example 1: interval probabilities under a density
Problem: Let be uniform on . Compute , , and .
Method:
- The density is
- For , integrate:
- For a single point,
- For the interval:
- The interval length is , so
Checked answer: all probabilities are interval length divided by total length , except the single point, which has length .
Worked example 2: transforming a standard uniform variable
Problem: Let and define . Find the distribution, mean, variance, and .
Method:
- Since , the minimum value is and the maximum is .
- Therefore
- The mean is
- The variance is
- The probability of is interval length over total length:
Checked answer: using , the event is
whose probability is .
Code
def uniform_cdf(a, left=0.0, right=1.0):
if a <= left:
return 0.0
if a >= right:
return 1.0
return (a - left) / (right - left)
def uniform_interval_prob(a, b, left=0.0, right=1.0):
return max(0.0, uniform_cdf(b, left, right) - uniform_cdf(a, left, right))
print("P(X < 1.5) for U(0,2):", uniform_cdf(1.5, 0, 2))
print("P(0.5 < X < 1.5) for U(0,2):", uniform_interval_prob(0.5, 1.5, 0, 2))
left, right = 10, 16
mean = (left + right) / 2
variance = (right - left) ** 2 / 12
print("U(10,16) mean and variance:", mean, variance)
Common pitfalls
- Treating a density value as a probability. A density can exceed ; probabilities are areas under the density.
- Forgetting that for a continuous density, even when is a very typical value.
- Using strict versus non-strict inequalities as if they matter for continuous variables. They do not change probabilities when endpoints are single points.
- Failing to rescale variance by the square of the stretch factor. If , then variance is multiplied by .
- Assuming every subset of behaves nicely under uniform probability. The lectures mention measurable-set subtleties; ordinary probability computations stay with measurable events.