Skip to content
VidiMaster it, module by module
Module 7/Random Variables & Distributions

Continuous Random Variables & Probability Density Functions

A continuous random variable XX (Definition 12.5) draws its probabilities not from a list of point masses but from the area under a curve: there is a probability density function (pdf) f:R→Rf:\mathbb{R}\to\mathbb{R} with P(X≤b)=∫−∞bf(x) dxfor all b∈R,\mathbb{P}(X\le b)=\int_{-\infty}^{b}f(x)\,dx\qquad\text{for all }b\in\mathbb{R}, and more generally P(X∈B)=∫Bf(x) dx\mathbb{P}(X\in B)=\int_B f(x)\,dx. This lesson pins down what makes a function a legitimate density (Remark 12.1: f≥0f\ge 0 everywhere and total area ∫−∞∞f(x) dx=1\int_{-\infty}^{\infty}f(x)\,dx=1), reads probabilities off as areas P(a≤X≤b)=∫abf(x) dx\mathbb{P}(a\le X\le b)=\int_a^b f(x)\,dx, and draws the defining contrast with the discrete world — for a continuous variable every single point is negligible, P(X=c)=0\mathbb{P}(X=c)=0 (Proposition 12.1), so endpoints never matter: P(a≤X≤b)=P(a<X<b)\mathbb{P}(a\le X\le b)=\mathbb{P}(a<X<b). We anchor everything in the uniform distribution on [0,1][0,1] (Example 12.5), where f(x)=1f(x)=1 on [0,1][0,1] and a probability is just a length, and in a worked exponential density (Example 12.6).

Before you start — give these a try

Attempting first primes your brain for the lesson — even if you miss. Nothing is graded or saved; it's just a warm-up.

A random variable is uniform on [2,6][2,6], so its density is a constant cc on [2,6][2,6] and 00 elsewhere. Find the value of cc that makes ff a valid density. Give your answer as a decimal to 33 places.

Which of the following functions (taken to be 00 outside the stated interval) is a valid probability density function?

What you’ll be able to do

  • State Definition 12.5: XX is a continuous random variable if there is a probability density function f:R→Rf:\mathbb{R}\to\mathbb{R} with P(X≤b)=∫−∞bf(x) dx\mathbb{P}(X\le b)=\int_{-\infty}^{b}f(x)\,dx for all b∈Rb\in\mathbb{R}, and read off the general rule P(X∈B)=∫Bf(x) dx\mathbb{P}(X\in B)=\int_B f(x)\,dx.
  • Use Remark 12.1 to decide whether a function is a valid density — f(x)≥0f(x)\ge 0 for all x∈Rx\in\mathbb{R} and ∫−∞∞f(x) dx=1\int_{-\infty}^{\infty}f(x)\,dx=1 — and find the normalising constant cc that forces the total area to equal 11.
  • Compute probabilities as areas under ff: P(a≤X≤b)=∫abf(x) dx\mathbb{P}(a\le X\le b)=\int_a^b f(x)\,dx and P(X>a)=∫a∞f(x) dx\mathbb{P}(X>a)=\int_a^{\infty}f(x)\,dx, for constant, piecewise-constant and linear densities.
  • Apply Proposition 12.1: P(X=c)=∫ccf(x) dx=0\mathbb{P}(X=c)=\int_c^c f(x)\,dx=0, so a continuous variable is never discrete and endpoints are irrelevant — P(a≤X≤b)=P(a<X<b)\mathbb{P}(a\le X\le b)=\mathbb{P}(a<X<b).
  • Work fluently with the uniform distribution on [0,1][0,1] (Example 12.5), where f(x)=1f(x)=1 on [0,1][0,1] and P(a≤X≤b)=b−a\mathbb{P}(a\le X\le b)=b-a, and verify a given density such as the exponential of Example 12.6.

In your course

· MATH2015 · Linear Algebra & Probability
§12.1 Random Variables
  • Definition 12.5Continuous random variable
    XX is continuous if there is a density f:R→Rf:\mathbb{R}\to\mathbb{R} with P(X≤b)=∫−∞bf(x) dx\mathbb{P}(X\le b)=\int_{-\infty}^{b}f(x)\,dx for all b∈Rb\in\mathbb{R}; then P(X∈B)=∫Bf(x) dx\mathbb{P}(X\in B)=\int_B f(x)\,dx.
  • Remark 12.1Valid probability density function
    ff is a density if and only if f(x)≥0f(x)\ge 0 for all xx and ∫−∞∞f(x) dx=1\int_{-\infty}^{\infty}f(x)\,dx=1; any such ff defines a continuous random variable.
  • Proposition 12.1Point probabilities and probabilities as areas
    P(X=c)=∫ccf(x) dx=0\mathbb{P}(X=c)=\int_c^c f(x)\,dx=0 for every cc; hence XX is never discrete and P(a≤X≤b)=P(a<X<b)=∫abf(x) dx\mathbb{P}(a\le X\le b)=\mathbb{P}(a<X<b)=\int_a^b f(x)\,dx.
  • Example 12.5Uniform distribution on [0,1][0,1]
    Density f(x)=1f(x)=1 on [0,1][0,1] and 00 elsewhere; P(a≤X≤b)=b−a\mathbb{P}(a\le X\le b)=b-a for 0≤a≤b≤10\le a\le b\le 1.
  • Example 12.6An exponential density
    f(x)=3e−3xf(x)=3e^{-3x} for x>0x>0 (and 00 otherwise) is a valid density: ∫0∞3e−3x dx=1\int_0^{\infty}3e^{-3x}\,dx=1, and P(0<X<1)=1−e−3≈0.950\mathbb{P}(0<X<1)=1-e^{-3}\approx 0.950.
The exponential of Example 12.6 appears as a worked example to show a non-constant density; the exercises and quiz use only constant, piecewise-constant and linear densities, whose probabilities are elementary areas.
1

From mass functions to density functions (Definition 12.5)

A discrete random variable piles its probability onto isolated values through a mass function p(k)=P(X=k)p(k)=\mathbb{P}(X=k). A continuous random variable spreads probability smoothly instead: Definition 12.5 says XX is continuous if there is a function f:R→Rf:\mathbb{R}\to\mathbb{R}, the probability density function (pdf), with P(X≤b)=∫−∞bf(x) dxfor every b∈R.\mathbb{P}(X\le b)=\int_{-\infty}^{b}f(x)\,dx\qquad\text{for every }b\in\mathbb{R}. Geometrically, P(X≤b)\mathbb{P}(X\le b) is the area under the graph of ff from −∞-\infty up to bb. The same picture delivers every probability: for any subset B⊆RB\subseteq\mathbb{R} for which the integral makes sense, P(X∈B)=∫Bf(x) dx,\mathbb{P}(X\in B)=\int_B f(x)\,dx, so P(a≤X≤b)=∫abf(x) dx\mathbb{P}(a\le X\le b)=\int_a^b f(x)\,dx and P(X>a)=∫a∞f(x) dx\mathbb{P}(X>a)=\int_a^{\infty}f(x)\,dx. The crucial mental shift is that f(x)f(x) is not a probability — it is a density, a rate of probability per unit length, and may even exceed 11 — and only its integral over a region returns an actual probability.

2

What makes a legitimate density (Remark 12.1)

Not every function can serve as a density. Remark 12.1 gives the two conditions, and they are exactly the ones that make areas-under-ff behave like probabilities: f(x)≥0 for all x∈R,∫−∞∞f(x) dx=1.f(x)\ge 0\ \text{for all }x\in\mathbb{R},\qquad \int_{-\infty}^{\infty}f(x)\,dx=1. Non-negativity keeps every area ∫Bf≥0\int_B f\ge 0, so no event gets a negative probability; and total area 11 encodes P(X∈R)=1\mathbb{P}(X\in\mathbb{R})=1, the certainty that XX lands somewhere. Conversely, any function meeting these two conditions defines a valid continuous random variable. In practice a density often arrives with an unknown normalising constant: given a shape like f(x)=cf(x)=c on [a,b][a,b] or f(x)=cxf(x)=cx on [0,L][0,L] (and 00 elsewhere), you find cc by forcing the total area to 11. For the constant, ∫abc dx=c(b−a)=1\int_a^b c\,dx=c(b-a)=1 gives c=1b−ac=\tfrac{1}{b-a}; for the ramp, ∫0Lcx dx=c L22=1\int_0^{L}cx\,dx=c\,\tfrac{L^2}{2}=1 gives c=2L2c=\tfrac{2}{L^2}.

3

Probabilities are areas, and single points vanish (Proposition 12.1)

Because probability is area under ff, the chance of landing on any one exact value is the area over a single point — a region of zero width. Proposition 12.1 makes this precise: for any real number cc, P(X=c)=∫ccf(x) dx=0.\mathbb{P}(X=c)=\int_c^c f(x)\,dx=0. Two consequences follow. First, a continuous random variable is never discrete: no value carries positive probability, so the discrete mass-function picture cannot apply. Second, because each endpoint contributes nothing, including or excluding endpoints changes no probability: P(a≤X≤b)=P(a<X<b)=∫abf(x) dx.\mathbb{P}(a\le X\le b)=\mathbb{P}(a<X<b)=\int_a^b f(x)\,dx. This is a sharp break from the discrete case, where P(X=k)\mathbb{P}(X=k) is typically positive and the difference between ≤\le and << matters. For continuous XX you may move endpoints freely — only the interval, i.e. the region of integration, counts.

4

The uniform distribution on $[0,1]$ and beyond (Examples 12.5-12.6)

The simplest continuous model is the uniform distribution on [0,1][0,1] (Example 12.5): pick a real number at random from [0,1][0,1] with every location equally likely. Its density is the flat function f(x)=1f(x)=1 for 0≤x≤10\le x\le 1 and f(x)=0f(x)=0 otherwise, whose total area is that of a 1×11\times 1 square, namely 11. Probabilities are then simply lengths: for 0≤a≤b≤10\le a\le b\le 1, P(a≤X≤b)=∫ab1 dx=b−a.\mathbb{P}(a\le X\le b)=\int_a^b 1\,dx=b-a. So P(0.25≤X≤0.6)=0.35\mathbb{P}(0.25\le X\le 0.6)=0.35, while P(X=0.5)=0\mathbb{P}(X=0.5)=0 as the proposition demands. The uniform on a general interval [α,β][\alpha,\beta] has the constant density 1β−α\tfrac{1}{\beta-\alpha}. Densities need not be flat, though: Example 12.6 takes f(x)=3e−3xf(x)=3e^{-3x} for x>0x>0 (and 00 otherwise), a decaying exponential density. It is non-negative and ∫0∞3e−3x dx=1\int_0^{\infty}3e^{-3x}\,dx=1, so it too is a legitimate density — one whose areas are read off by calculus rather than by a rectangle.

Definition 12.5 — Continuous random variable

A random variable XX is continuous if there exists a function f:R→Rf:\mathbb{R}\to\mathbb{R}, called a probability density function (pdf) of XX, such that P(X≤b)=∫−∞bf(x) dxfor all b∈R.\mathbb{P}(X\le b)=\int_{-\infty}^{b}f(x)\,dx\quad\text{for all }b\in\mathbb{R}. More generally, for any subset B⊆RB\subseteq\mathbb{R} for which integration is defined, P(X∈B)=∫Bf(x) dx\mathbb{P}(X\in B)=\int_B f(x)\,dx; in particular P(a≤X≤b)=∫abf(x) dx\mathbb{P}(a\le X\le b)=\int_a^b f(x)\,dx and P(X>a)=∫a∞f(x) dx\mathbb{P}(X>a)=\int_a^{\infty}f(x)\,dx.

Intuition. The density ff replaces the discrete mass function: instead of summing point masses you integrate ff over a region to obtain its probability. Picture ff as describing how thickly probability is smeared along the line — the probability of any set is the area sitting above it, and P(X≤b)\mathbb{P}(X\le b) is the running area accumulated up to bb.
Remark 12.1 — Valid probability density function

A function ff qualifies as a probability density function exactly when it satisfies both f(x)≥0 for all x∈Rand∫−∞∞f(x) dx=1.f(x)\ge 0\ \text{for all }x\in\mathbb{R}\qquad\text{and}\qquad\int_{-\infty}^{\infty}f(x)\,dx=1. Any such ff defines a valid continuous random variable.

Intuition. These are the two properties that make areas-under-ff behave like probabilities: non-negativity rules out negative probabilities, and total area 11 says XX is certain to take some real value, P(X∈R)=1\mathbb{P}(X\in\mathbb{R})=1. When a density is specified only up to a constant, this normalisation condition is precisely what pins that constant down.
Proposition 12.1 — Point probabilities zero; probabilities as areas

If XX has density ff, then for every real number cc, P(X=c)=∫ccf(x) dx=0.\mathbb{P}(X=c)=\int_c^c f(x)\,dx=0. Consequently a continuous random variable is never discrete, and including or excluding endpoints does not change probabilities: P(a≤X≤b)=P(a<X<b)=∫abf(x) dx.\mathbb{P}(a\le X\le b)=\mathbb{P}(a<X<b)=\int_a^b f(x)\,dx.

Intuition. The 'area' over a single point has zero width, hence zero area, so no individual value carries positive probability. This is the hallmark separating continuous variables from discrete ones, and it frees you to treat ≤\le and << interchangeably: only the interval of integration matters, never whether its endpoints are attached.

Worked examples

Example 1

Example 12.5 — Uniform on [0,1][0,1]. Let XX be uniform on [0,1][0,1], with density f(x)=1f(x)=1 for 0≤x≤10\le x\le 1 and f(x)=0f(x)=0 otherwise. (a) Confirm ff is a valid density. (b) Find P(0.25≤X≤0.6)\mathbb{P}(0.25\le X\le 0.6). (c) Find P(X=0.5)\mathbb{P}(X=0.5).

  1. 1

    (a) Check Remark 12.1. On [0,1][0,1] we have f(x)=1≥0f(x)=1\ge 0, and elsewhere f(x)=0≥0f(x)=0\ge 0, so f≥0f\ge 0 everywhere. The total area is ∫−∞∞f(x) dx=∫011 dx=1\int_{-\infty}^{\infty}f(x)\,dx=\int_0^1 1\,dx=1 (a 1×11\times 1 square). Both conditions hold, so ff is a valid density.

  2. 2

    (b) Probability as area. By Definition 12.5 the probability is the area under ff between the limits: P(0.25≤X≤0.6)=∫0.250.61 dx=0.6−0.25=0.35.\mathbb{P}(0.25\le X\le 0.6)=\int_{0.25}^{0.6}1\,dx=0.6-0.25=0.35. For the uniform on [0,1][0,1] a probability is simply the length of the interval.

  3. 3

    (c) A single point (Proposition 12.1). P(X=0.5)=∫0.50.51 dx=0.\mathbb{P}(X=0.5)=\int_{0.5}^{0.5}1\,dx=0. The value 0.50.5 is certainly possible, yet it carries zero probability — so P(0.25≤X≤0.6)=P(0.25<X<0.6)=0.35\mathbb{P}(0.25\le X\le 0.6)=\mathbb{P}(0.25<X<0.6)=0.35 as well.

Answer. ff is a valid density; P(0.25≤X≤0.6)=0.35\mathbb{P}(0.25\le X\le 0.6)=0.35; and P(X=0.5)=0\mathbb{P}(X=0.5)=0.
Example 2

Example 12.6 — An exponential density. Let f(x)=3e−3xf(x)=3e^{-3x} for x>0x>0 and f(x)=0f(x)=0 otherwise. (i) Verify that ff is a valid probability density function. (ii) For XX with this density, compute P(−1<X<1)\mathbb{P}(-1<X<1).

Example 3

A linear (ramp) density. A random variable XX has density f(x)=cxf(x)=cx for 0≤x≤20\le x\le 2 and f(x)=0f(x)=0 otherwise. (a) Find the constant cc. (b) Compute P(X≤1)\mathbb{P}(X\le 1).