Home page for accesible maths 6.3 Probability Density Function

Style control - access keys in brackets

Font (2 3) - + Letter spacing (4 5) - + Word spacing (6 7) - + Line spacing (8 9) - +

The probability density function

Recall (page 4.3) that the CDF, FR(r), of a discrete random variable, R, is the sum of all of the relevant probabilities, i=-rpR(i).

Analogously the (probability) density function, pdf, fX(x), of a continuous random variable, X, is defined as

fX(x)=ddxFX(x),

so that it satisfies

FX(x)=-xfX(s)𝑑s. (6.1)

For example

P(X10)=FX(10)=-10fX(s)ds.

Note that s is a dummy variable; one could use any letter for the integrand except x.

Figure 6.3: The probability density function corresponding to the cdf shown in Figure 6.2.

Figure 6.3 shows the pdf for the continuous random variable for which the cdf is shown in Figure 6.2. Notice that the pdf is zero in regions where there are no outcomes, in this example for x0. Note also that it exceeds 1 in some places, so it cannot be interpreted as a probability despite some of the mathematical properties of fX(x) that we shall see below being very similar to those of the probability mass function.

Properties of fX(x):

  1. 1.

    Positivity: fX(x)0 for all x, Why?

  2. 2.

    Unit-integrability: -fX(x)𝑑x=1. Why?

Consider the probability that an observation on a continuous random variable X lies in the interval (a,b]:

P(a<Xb) = P(Xb)-P(Xa)
= FX(b)-FX(a)
= -bfX(x)𝑑x--afX(x)𝑑x
= abfX(x)𝑑x.

We see that P(a<Xb) may be calculated as the area under the curve of fX(x) between x=a and x=b.

An illuminating idea


For some very small interval width δ,

P(x<Xx+δ) = xx+δfX(s)𝑑s
fX(x)δ.

Thus fX(x)δ can be thought of as (approximately) the probability that X is between x and x+δ.
Compare this with the interpretation (definition!) of the pmf pR(r).

Exercise 6.2.

A random variable X has cumulative distribution function

FX(x)={1-exp(-3x) for x0,0 for x<0.

Find the pdf of X.

Solution.
fX(x)=ddxFX(x)={3exp(-3x)for x0,0for x<0.
Example 6.3.

A triangular pdf: a random variable X has pdf

fX(x)={2(1-x)0x1,0otherwise.

Obtain the cdf FX(x).
Important: We split the range of x, (-,) into sensible intervals.

  • For x(-,0],

    FX(x)=-xfX(s)ds=-x0ds=0.
  • For x(0,1],

    FX(x) = -xfX(s)ds
    = FX(0)+0x2(1-s)ds
    = 0+[2s-s2]0x
    = 2x-x2

  • For x(1,),

    FX(x)=-xfX(s)ds=FX(1)+1x0ds=1.

Hence

FX(x)={0 for x02x-x2 for 0<x11 for x>1.

Now find P(X<0.5), P(0.5<X<0.8) and P(0.5<X<1.75).

F(0.5) = 2(0.5)-(0.5)2=0.75
F(0.8)-F(0.5) = 2(0.8)-(0.8)2-0.75=1.6-0.64-0.75=0.21
F(1.75)-F(0.5) = 1-0.75=0.25.

Obtain P(0.5<X<0.8) directly from the pdf.

P(0.5<X<0.8) = 0.50.8fX(s)𝑑s=0.50.82(1-s)𝑑s=[2s-s2]0.50.8
= 2(0.8)-(0.8)2-2(0.5)+(0.5)2=0.21

Example 6.4.

The lifetime in years, that a computer functions before breaking down is a continuous random variable X with pdf, given by

fX(x)={λexp(-λx)x0,0x<0.

The parameter λ depends on the type of computer. To set a time for a guarantee the company wants to know the time t for which with probability 0.9 the lifetime of the computer will exceed t.

Solution.
P(X>t) = tfX(x)𝑑x
= tλexp(-λx)𝑑x
= [-exp(-λx)]t=exp(-λt),

so that P(X>t)=0.9 implies t=-λ-1log(0.9).

Note that you have just found a quantile of the distribution; see Section 6.4.1.