Salick Academy

Continuous Random Variables

No calculator

A discrete random variable has a probability at each value. A continuous one does not: P(X=2)P(X = 2) is zero, because a single point has no width. Probability lives in areas instead, and every formula in this topic is an integral where the discrete version was a sum.

Probability density functions

A function f(x)f(x) is a probability density function for XX if

f(x)0for all xandf(x)dx=1f(x) \ge 0 \quad\text{for all } x \qquad\text{and}\qquad \int_{-\infty}^{\infty} f(x)\,dx = 1

Probability is then area under the curve:

P(a<X<b)=abf(x)dxP(a < X < b) = \int_a^b f(x)\,dx

Finding an unknown constant

Almost every question begins here: the total area must be 1.

Given f(x)=kx(4x)f(x) = kx(4-x) for 0x40 \le x \le 4 and zero elsewhere, find kk.

04(4xx2)dx=[2x2x33]04=32643=323\int_0^4 (4x - x^2)\,dx = \left[2x^2 - \frac{x^3}{3}\right]_0^4 = 32 - \frac{64}{3} = \frac{32}{3}

k×323=1k=332k \times \frac{32}{3} = 1 \quad\Longrightarrow\quad k = \frac{3}{32}

Then, for instance,

P(1<X<3)=33213(4xx2)dx=1116=0.6875P(1 < X < 3) = \frac{3}{32}\int_1^3 (4x - x^2)\,dx = \frac{11}{16} = 0.6875

Expectation and variance

E(X)=xf(x)dxE(X2)=x2f(x)dxE(X) = \int x\,f(x)\,dx \qquad E(X^2) = \int x^2 f(x)\,dx

Var(X)=E(X2)[E(X)]2\operatorname{Var}(X) = E(X^2) - \big[E(X)\big]^2

Continuing with f(x)=332x(4x)f(x) = \tfrac{3}{32}x(4-x):

E(X)=33204(4x2x3)dx=332(256364)=2E(X) = \frac{3}{32}\int_0^4 (4x^2 - x^3)\,dx = \frac{3}{32}\left(\frac{256}{3} - 64\right) = 2

E(X2)=33204(4x3x4)dx=332(25610245)=245=4.8E(X^2) = \frac{3}{32}\int_0^4 (4x^3 - x^4)\,dx = \frac{3}{32}\left(256 - \frac{1024}{5}\right) = \frac{24}{5} = 4.8

Var(X)=4.822=0.8\operatorname{Var}(X) = 4.8 - 2^2 = 0.8

The cumulative distribution function

F(x)=P(Xx)=xf(t)dtF(x) = P(X \le x) = \int_{-\infty}^{x} f(t)\,dt

For the same density,

F(x)=332(2x2x33)=3x216x332,0x4F(x) = \frac{3}{32}\left(2x^2 - \frac{x^3}{3}\right) = \frac{3x^2}{16} - \frac{x^3}{32}, \qquad 0 \le x \le 4

with F(x)=0F(x) = 0 below 0 and F(x)=1F(x) = 1 above 4. Check: F(4)=32=1F(4) = 3 - 2 = 1

Differentiating recovers the density, so f(x)=F(x)f(x) = F'(x) — the two are always one integration apart.

Median and quartiles

The median mm splits the area in half:

F(m)=0.5F(m) = 0.5

and the quartiles solve F(Q1)=0.25F(Q_1) = 0.25 and F(Q3)=0.75F(Q_3) = 0.75.

Here symmetry gives m=2m = 2 immediately, and the algebra agrees: F(2)=1216832=0.5F(2) = \tfrac{12}{16} - \tfrac{8}{32} = 0.5

For a density without symmetry the equation must be solved. With f(x)=19x2f(x) = \tfrac19 x^2 on 0x30 \le x \le 3:

F(x)=x327=0.5m=13.53=2.38F(x) = \frac{x^3}{27} = 0.5 \quad\Longrightarrow\quad m = \sqrt[3]{13.5} = 2.38

The continuous uniform distribution

If XX is equally likely to take any value between aa and bb, written XU(a,b)X \sim U(a,b):

f(x)=1ba(axb),E(X)=a+b2,Var(X)=(ba)212f(x) = \frac{1}{b-a} \quad (a \le x \le b), \qquad E(X) = \frac{a+b}{2}, \qquad \operatorname{Var}(X) = \frac{(b-a)^2}{12}

A bus arrives at a time uniformly distributed between 2 and 10 minutes past the hour.

f(x)=18E(X)=6Var(X)=6412=5.33f(x) = \tfrac18 \qquad E(X) = 6 \qquad \operatorname{Var}(X) = \frac{64}{12} = 5.33

P(X>7)=1078=38P(X > 7) = \frac{10 - 7}{8} = \frac38

The exponential distribution

Waiting times between random events follow

f(x)=λeλx(x0),F(x)=1eλx,E(X)=1λ,Var(X)=1λ2f(x) = \lambda e^{-\lambda x} \quad (x \ge 0), \qquad F(x) = 1 - e^{-\lambda x}, \qquad E(X) = \frac1\lambda, \qquad \operatorname{Var}(X) = \frac{1}{\lambda^2}

A component has a mean lifetime of 5 hours, so λ=0.2\lambda = 0.2.

P(X>8)=e0.2×8=e1.6=0.2019P(X > 8) = e^{-0.2 \times 8} = e^{-1.6} = 0.2019

P(X<3)=1e0.6=0.4512P(X < 3) = 1 - e^{-0.6} = 0.4512

The median solves 1eλm=0.51 - e^{-\lambda m} = 0.5, giving

m=ln2λ=0.69310.2=3.47 hoursm = \frac{\ln 2}{\lambda} = \frac{0.6931}{0.2} = 3.47 \text{ hours}