Continuous Random Variables and Densities

⚡ Key Takeaways

A continuous random variable takes values in a continuum (an interval of R\mathbb{R}) and is described not by point probabilities — which are all zero — but by a probability density function (PDF) f(x)f(x) whose integral over a set gives the probability of landing in that set. Key result: P(a≤X≤b)=∫abf(x) dxP(a \le X \le b) = \int_a^b f(x)\,dx, with f(x)≥0f(x)\ge 0 and ∫−∞∞f(x) dx=1\int_{-\infty}^\infty f(x)\,dx = 1. Applies wherever measurements vary smoothly — physics, statistics, engineering, finance. Formalized by Laplace, Gauss, and rigorously by Kolmogorov (1933).

💡 The Core Insight

For continuous variables, probability is area, not height. The density f(x)f(x) answers "how concentrated is probability near xx?" — formally f(x) dx≈P(x≤X≤x+dx)f(x)\,dx \approx P(x \le X \le x+dx). You never read a probability off the curve directly; you always integrate. This single shift — from summing point masses (discrete case) to integrating a density (continuous case) — is the entire conceptual jump.

Formal Statement

DefinitionContinuous Random Variable and Density

A random variable XX on a probability space (Ω,F,P)(\Omega,\mathcal{F},P) is (absolutely) continuous if there exists a nonnegative integrable function f:R→[0,∞)f:\mathbb{R}\to[0,\infty), the probability density function (PDF), such that for every a≤ba\le b:

1
P(a≤X≤b)=∫abf(x) dx.\quad P(a \le X \le b) = \int_a^b f(x)\,dx.

Derivation hint: This is the defining property; it asserts that the measure PXP_X induced by XX is given by integrating ff against Lebesgue measure. The density must satisfy the two normalization axioms:

2
f(x)≥0  ∀x,∫−∞∞f(x) dx=1.\quad f(x)\ge 0 \ \ \forall x, \qquad \int_{-\infty}^{\infty} f(x)\,dx = 1.

Derivation hint: Nonnegativity follows since probabilities are nonnegative; the total integral equals P(−∞<X<∞)=P(Ω)=1P(-\infty<X<\infty)=P(\Omega)=1. The cumulative distribution function (CDF) is

3
F(x)=P(X≤x)=∫−∞xf(t) dt,\quad F(x) = P(X \le x) = \int_{-\infty}^{x} f(t)\,dt,

Derivation hint: Set a→−∞a\to-\infty, b=xb=x in [1]. and where FF is differentiable the density is recovered by the Fundamental Theorem of Calculus:

4
f(x)=ddxF(x)=F′(x).\quad f(x) = \frac{d}{dx}F(x) = F'(x).

Derivation hint: Differentiate [3]; FTC applies wherever ff is continuous at xx.

Symbols: XX = random variable; ω∈Ω\omega\in\Omega = sample point; ff = density (units: inverse of XX's units); FF = CDF (dimensionless, in [0,1][0,1]); x,tx,t = real values.

TheoremPoint Probabilities Vanish

If XX is continuous with density ff, then for every c∈Rc\in\mathbb{R},

5
P(X=c)=0,\quad P(X = c) = 0,

and consequently

6
P(a≤X≤b)=P(a<X<b)=P(a≤X<b)=P(a<X≤b).\quad P(a\le X\le b) = P(a < X < b) = P(a\le X < b) = P(a< X\le b).

Derivation hint: P(X=c)=∫ccf=0P(X=c)=\int_c^c f = 0 by [1]; since endpoints contribute zero area, open/closed intervals share the same probability.

TheoremExpectation and Variance

For a continuous XX with density ff, and a measurable gg for which the integral converges absolutely (Law of the Unconscious Statistician):

7
E[g(X)]=∫−∞∞g(x) f(x) dx.\quad \mathbb{E}[g(X)] = \int_{-\infty}^{\infty} g(x)\,f(x)\,dx.

Derivation hint: Push the abstract expectation ∫Ωg(X) dP\int_\Omega g(X)\,dP forward to the line via the distribution PX=f dxP_X=f\,dx; equivalently approximate gg by simple functions. In particular the mean μ\mu and variance σ2\sigma^2 are

8
μ=E[X]=∫−∞∞x f(x) dx,σ2=∫−∞∞(x−μ)2f(x) dx=E[X2]−μ2.\quad \mu = \mathbb{E}[X] = \int_{-\infty}^{\infty} x\,f(x)\,dx, \qquad \sigma^2 = \int_{-\infty}^{\infty} (x-\mu)^2 f(x)\,dx = \mathbb{E}[X^2]-\mu^2.

Derivation hint: Take g(x)=xg(x)=x and g(x)=(x−μ)2g(x)=(x-\mu)^2 in [7]; expand the square and use linearity for the shortcut form.

Why It Holds / Derivation

ProofFrom Axioms to the Density Picture

We show that [1]–[4] are mutually consistent and that the change-of-variable formula for transformations follows.

Step 1 — CDF is nondecreasing and bounded. Since f≥0f\ge 0, the integral F(x)=∫−∞xfF(x)=\int_{-\infty}^x f is nondecreasing. As x→−∞x\to-\infty, F→0F\to 0; as x→+∞x\to+\infty, F→∫−∞∞f=1F\to\int_{-\infty}^\infty f = 1 by [2]. Thus FF is a legitimate CDF.

Step 2 — Interval probabilities. By additivity of the integral,

P(a≤X≤b)=∫abf=∫−∞bf−∫−∞af=F(b)−F(a),P(a\le X\le b)=\int_a^b f = \int_{-\infty}^b f - \int_{-\infty}^a f = F(b)-F(a),

recovering [1] in terms of FF.

Step 3 — Recovering ff. Where ff is continuous, FTC gives F′(x)=f(x)F'(x)=f(x), which is [4]. Heuristically,

P(x≤X≤x+Δx)=F(x+Δx)−F(x)≈f(x) Δx,P(x\le X\le x+\Delta x)=F(x+\Delta x)-F(x)\approx f(x)\,\Delta x,

the "density times width" interpretation.

Step 4 — Transformation rule. Let Y=u(X)Y=u(X) with uu strictly monotonic and differentiable, inverse x=u−1(y)x=u^{-1}(y). For increasing uu, FY(y)=P(u(X)≤y)=P(X≤u−1(y))=FX(u−1(y))F_Y(y)=P(u(X)\le y)=P(X\le u^{-1}(y))=F_X(u^{-1}(y)). Differentiating with the chain rule, and handling decreasing uu with an absolute value, yields the change-of-variables density

9
fY(y)=fX ⁣(u−1(y)) ∣ddy u−1(y)∣.\quad f_Y(y) = f_X\!\big(u^{-1}(y)\big)\,\left|\frac{d}{dy}\,u^{-1}(y)\right|.

Derivation hint: Differentiate the CDF composition FY=FX∘u−1F_Y=F_X\circ u^{-1}; the absolute value compensates for orientation reversal when uu decreases. ■\qquad\blacksquare

∎
mathematician · Andrey Kolmogorov | 1903–1987

Kolmogorov's 1933 monograph Grundbegriffe der Wahrscheinlichkeitsrechnung placed probability on measure-theoretic foundations. In his framework a continuous random variable is a measurable function whose distribution is absolutely continuous with respect to Lebesgue measure; the density ff is precisely the Radon–Nikodym derivative dPX/dλdP_X/d\lambda. This dissolved century-old ambiguities about "infinitely small probabilities" and explained why some continuous-CDF distributions (the Cantor distribution) have no density at all.

Building Intuition

🧠 Intuition

Imagine spreading exactly one kilogram of fine sand along a number line. The density f(x)f(x) is the mass per unit length at position xx — measured in kg/meter, not kg. To find how much sand lies between aa and bb, you cannot read it at a point (a point has zero width, hence zero sand); you must integrate the density over [a,b][a,b]. The total sand is 11 kg, matching ∫f=1\int f = 1. A tall, narrow spike means sand piled densely (high probability nearby) but covering little width; the area of that spike is what counts. This is exactly why f(x)f(x) can exceed 11: a Uniform(0,12)(0,\tfrac12) distribution has f=2f=2 on its support — high density over a short interval still integrating to 11.

Figure
Density curve: probability is the shaded area, not the curve height
x f(x) a b area = P(a≤X≤b) f(x) = F'(x)

Worked Examples

ExampleExponential Lifetime — Mean and a Tail Probability

Given: A component's lifetime TT (hours) is Exponential with rate λ=0.01 hr−1\lambda = 0.01\,\text{hr}^{-1}, density

f(t)=λe−λt,t≥0,f(t)=0, t<0.f(t) = \lambda e^{-\lambda t},\quad t\ge 0,\quad f(t)=0,\ t<0.

Step 1 — Check normalization. ∫0∞λe−λt dt=[−e−λt]0∞=1.\int_0^\infty \lambda e^{-\lambda t}\,dt = [-e^{-\lambda t}]_0^\infty = 1. ✓

Step 2 — Mean lifetime via [8]:

μ=∫0∞t λe−λt dt=1λ=10.01.\mu=\int_0^\infty t\,\lambda e^{-\lambda t}\,dt = \frac{1}{\lambda} = \frac{1}{0.01}.

(Integration by parts: u=t, dv=λe−λtdtu=t,\ dv=\lambda e^{-\lambda t}dt.)

Step 3 — Probability it survives past 150 hr using the CDF F(t)=1−e−λtF(t)=1-e^{-\lambda t}:

P(T>150)=1−F(150)=e−0.01⋅150=e−1.5.P(T>150) = 1-F(150)=e^{-0.01\cdot 150}=e^{-1.5}.
μ=100 hr,P(T>150)=e−1.5≈0.223\boxed{\mu = 100\ \text{hr}, \qquad P(T>150)=e^{-1.5}\approx 0.223}
ExampleTransforming a Uniform Variable

Given: X∼X\sim Uniform(0,1)(0,1) with fX(x)=1f_X(x)=1 on [0,1][0,1]. Define Y=−ln⁡XY = -\ln X. Find fY(y)f_Y(y).

Step 1 — Invert. y=−ln⁡x⇒x=e−yy=-\ln x \Rightarrow x = e^{-y}, valid for y>0y>0 (since x∈(0,1)x\in(0,1)).

Step 2 — Jacobian. dxdy=−e−y\dfrac{dx}{dy} = -e^{-y}, so ∣dxdy∣=e−y\left|\dfrac{dx}{dy}\right| = e^{-y}.

Step 3 — Apply [9].

fY(y)=fX(e−y)⋅e−y=1⋅e−y=e−y,y>0.f_Y(y) = f_X(e^{-y})\cdot e^{-y} = 1\cdot e^{-y} = e^{-y},\quad y>0.

Step 4 — Identify. This is Exponential with rate λ=1\lambda=1.

fY(y)=e−y  (y>0) ⟹ Y∼Exponential(1)\boxed{f_Y(y)=e^{-y}\ \ (y>0)\ \Longrightarrow\ Y\sim \text{Exponential}(1)}

This is the basis of inverse-transform sampling: applying −ln⁡-\ln to uniform draws produces exponential samples.

Common Misconceptions

⚠️ Common mistake

The density is not a probability. f(x)f(x) has units of (probability per unit xx) and may be arbitrarily large. Writing "P(X=x)=f(x)P(X=x)=f(x)" is wrong; the correct statement is P(X=x)=0P(X=x)=0 and P(x≤X≤x+dx)≈f(x) dxP(x\le X\le x+dx)\approx f(x)\,dx. Likewise, never claim "f(x)≤1f(x)\le 1" — only ∫f=1\int f = 1 and f≥0f\ge 0 are required.

⚠️ Common mistake

Probability zero ≠ impossible. Every single outcome of a continuous variable has probability 00, yet exactly one outcome occurs on each trial. "Almost surely" (probability 11) is not the same as "always." This is why, when conditioning on a continuous variable taking a precise value, one must use densities and limits, not naive P(A∣B)=P(A∩B)/P(B)P(A|B)=P(A\cap B)/P(B) (which gives 0/00/0).

CounterexampleA Continuous CDF With No Density

The Cantor (devil's staircase) distribution has a CDF FF that is continuous everywhere and increases from 00 to 11, so P(X=c)=0P(X=c)=0 for all cc — yet F′(x)=0F'(x)=0 at almost every point and FF is not absolutely continuous. There is no density ff with F(x)=∫−∞xfF(x)=\int_{-\infty}^x f. Thus "continuous CDF" is strictly weaker than "has a density." A density exists only for absolutely continuous distributions. This shows the chain [3]–[4] can fail without absolute continuity.

Connections

connection

Continuous variables sit opposite Discrete Random Variables, where probability mass functions replace densities and sums replace integrals; both are special cases of distributions described by a Cumulative Distribution Function. The density is rigorously the Radon–Nikodym Derivative of the distribution with respect to Lebesgue measure, tying the subject to Measure Theory. Expectation [7] is an instance of Lebesgue Integration. Two or more continuous variables are handled with Joint Probability Densities and marginals, and independence is characterized by factorization of joint densities. The transformation rule [9] generalizes to the multivariate Jacobian Change of Variables. Specific densities — the Normal Distribution, Exponential Distribution, and Uniform Distribution — are the workhorse examples.

Real-World Applications

🔬 Where this appears

Historical Development

⏳ History
- 1733 — Abraham de Moivre derives the bell-curve approximation to the binomial, the first appearance of the normal density.
- 1774 — Pierre-Simon Laplace introduces continuous error distributions and integrates densities to assess astronomical errors.
- 1809 — Carl Friedrich Gauss formalizes the normal density in the context of least-squares estimation.
- 1812 — Laplace's Théorie analytique des probabilités systematizes integral-based probability and characteristic functions.
- 1837 — Siméon Poisson and contemporaries develop the analytic treatment of continuous limits.
- 1898 — Émile Borel develops measure theory on the line, the geometric backbone for "area = probability."
- 1902 — Henri Lebesgue's integral provides the rigorous tool for [7] and unbounded densities.
- 1913 — Radon (later Nikodym, 1930) prove the Radon–Nikodym theorem, defining the density as a derivative of measures.
- 1933 — Andrey Kolmogorov's axioms unify discrete and continuous probability under measure theory, the modern standard.

Subtleties & Limits

open-problem

The density is determined only up to a set of Lebesgue measure zero — two densities differing at countably many points describe the same distribution, so "the" density is really an equivalence class. Distributions can be purely continuous yet singular (Cantor type), having no density at all; the Lebesgue decomposition splits any distribution into absolutely continuous, discrete, and singular parts, and characterizing the singular component of empirical distributions remains subtle. In infinite dimensions (e.g. Gaussian measures on function spaces), there is no Lebesgue reference measure, so densities must be taken relative to another measure (Cameron–Martin theory) — a live area in stochastic analysis. Finally, density estimation from finite data (choosing bandwidths, avoiding the curse of dimensionality) is an active statistical and machine-learning research frontier.

See Also

Discrete Random Variables · Cumulative Distribution Function · Normal Distribution · Exponential Distribution · Uniform Distribution · Joint Probability Densities · Radon–Nikodym Derivative · Measure Theory · Jacobian Change of Variables · Central Limit Theorem