Random variables · Definition

Probability density function

probabilityrandom variables

Before you start you need to know

It is the tool that spreads probability over the infinitely many possible values of a continuous variable, where assigning mass to each point no longer works.

Definition

The density function \(f\) of a continuous random variable \(X\) is a nonnegative function such that the area under its graph over an interval is the probability \(P\) that \(X\) falls in it.

\[P(a\le X\le b)=\int_a^b f(x)\,dx\]

A continuous variable takes values in an interval, and each isolated value has probability zero: \(P(X=a)=0\). So probability is assigned to intervals, and the density \(f\) is the function whose area makes that possible. It is read as a concentration: where \(f\) is large, the variable falls more often in short intervals around that point.

Every density satisfies two conditions: \(f(x)\ge 0\) and \(\int_{-\infty}^{\infty}f(x)\,dx=1\). When a density comes with an unknown constant, as in \(f(x)=kx\) on \([0,2]\), the second condition determines it: \(2k=1\). Since single points do not count, \(P(a\le X\le b)\) and \(P(a<X<b)\) are equal, unlike the discrete case.

A density is not a probability and can exceed 1: \(f(x)=2\) on \([0,\tfrac12]\) has area 1. What is a probability is the area. If \(f(x)=2x\) on \([0,1]\), then \(P(X\le\tfrac12)=\int_0^{1/2}2x\,dx=\tfrac14\). A typical mistake is reading \(f(a)\) as \(P(X=a)\).

For continuous variables the density plays the role the mass function plays for discrete ones, with integrals in place of sums. Later the cumulative distribution function unifies both cases, and the integral of \(x\,f(x)\) defines the continuous expectation.

Think about it

Why is \(P(X=a)=0\) for a continuous variable, and yet \(X\) takes some value?

Because the area over a single point is zero; the total probability 1 is spread over infinitely many values and only intervals receive positive area.

A density is \(f(x)=5\) on \([0,0.2]\). Is it valid?

Yes: it is nonnegative and its area is \(5\cdot 0.2=1\). Exceeding 1 is not a problem.

Exercises 10

References

  • Joseph K. Blitzstein, Jessica Hwang, Introduction to Probability, 2nd edition, CRC Press, 2019. §5.1
  • Sheldon Ross, A First Course in Probability, 10th edition, Pearson, 2019. §5.1
  • Ronald E. Walpole, Raymond H. Myers, Sharon L. Myers, Keying Ye, Probabilidad y estadística para ingeniería y ciencias, 9.ª edición, Pearson, 2012. §3.3