Online Mathematics Book

Continuous Probability Distributions

(Continuous Random Variables)


Continuous random variables are used to model continuous phenomena or quantities, such as time, length, mass, ... that depend on chance.

We refer to continuous random variables with capital letters, typically \(X\), \(Y\), \(Z\), ... .

For instance the heights of people selected at ranom would correspond to possible values of the continuous random variable \(X\) defined as:

\(X\) : height, in cm, of a person selected at random

Probability Distributions

When working with continuous random variables, such as \(X\), we only calculate the probability that \(X\) lie within a certain interval; like \(P\begin{pmatrix}X \leq k\end{pmatrix}\) or \(P\begin{pmatrix}a\leq X \leq b \end{pmatrix}\).

We don't calculate the probability of \(X\) being equal to a specific value \(k\). In fact that following result will always be true: \[P\begin{pmatrix}X = k \end{pmatrix} = 0\] This can be explained by the fact that the total number of possible values of a continuous random variable \(X\) is infinite, so the likelihood of any one single outcome tends towards \(0\).

Calculating Probabilities

To calculate probabilities we'll need two functions:

  • The probability density function (PDF)
  • The cumulative density function (CDF) a.k.a the cumulative distribution function
Each of these is defined, further down, but the idea is to integrate the probability density function \(f(x)\) to define a new function \(F(x)\), known as the cumulative density function.

To calculate the probability that \(X\) be within a certain range, say \(a \leq X \leq b\), we calculate \(F(b) - F(a)\), using the cumulative density function.

Put "simply" we calculate probabilities as: \[P\begin{pmatrix}a\leq X \leq b \end{pmatrix} = \int_a^b f(x) dx\] where \(f(x)\) is the variable's probability density function.

Tutorial

In the following tutorial we learn about continuous random variables and how to calculate probabilities using probability density functions.

Probability Density Functions (PDF)


Given a continuous random variable \(X\), its probability density function \(f(x)\) is the function whose integral allows us to calculate the probability that \(X\) lie within a certain range, \(P\begin{pmatrix}a\leq X \leq b\end{pmatrix}\).

The curve \(y=f(x)\) serves as the "envelope", or contour, of the probability distribution.

Exam Hint


We'll often be given a pdf with an unknown parameter that we'll need to find using the second property (see question 2.a below).

Properties of the PDF


Probability density functions are always greater than or equal to \(0\): \[f(x) \geq 0, \quad x \in \mathbb{R}\] The area enclosed by a probability density function and the horizontal axis equals to \(1\): \[\int_{-\infty}^{+\infty}f(x)dx = 1\] If the area isn't equal to \(1\) then \(X\) is not a continuous random variable.

Note: these properties are often used in exam questions.

Examples

Example 1

The piecewise function defined as: \[f(x) = \begin{cases} 3x^2,\quad 0\leq x \leq 1 \\ 0, \quad \text{elsewhere} \end{cases}\] could be the probability density function for some continuous random variable \(X\).

Indeed, we can see from its graph that \(f(x)\geq 0\). Furthermore we can check that the area enclosed by the curve and the \(x\)-axis equals to \(1\): \[\begin{aligned} \int_{-\infty}^{+\infty}f(x)dx & = \int_0^13x^2dx \\ & = \begin{bmatrix}x^3 \end{bmatrix}_0^1 \\ & = 1^3 - 0^3 \\ \int_{-\infty}^{+\infty}f(x)dx & = 1 \end{aligned}\]

Example 2

Another example, that we'll learn about with normal distributions, could be the function defined as: \[f(x) = \frac{1}{\sqrt{2\pi}}e^{-\frac{x^2}{2}}, \quad x \in \mathbb{R}\]

We can see from its graph that \(f(x)\geq 0\). And although we cannot integrate this by hand, use numerical methods and our calculator we find: \[\int_{-\infty}^{+\infty}\frac{1}{\sqrt{2\pi}}e^{-\frac{x^2}{2}}dx = 1\]

Terminology


Keep in mind that the Cumulative density function is frequently called the cumulative distribution function or simply the distribution function.
It's important to know that all \(3\) names refer to the same thing: the CDF.

Cumulative Density Function (CDF)

(Calculating Probabilities)

Given a continuous random variable \(X\) and its probability density function \(f(x)\), the cumulative density function, written \(F(x)\), allows us to calculate the probability that \(X\) be less than, or equal to, any value of \(x\), in other words: \(P\begin{pmatrix}X \leq x \end{pmatrix} = F(x)\).
Where: \[F(x) =\int_{-\infty}^x f(t)dt \] There are three "types" of probability calculations that we'll need to be comfortable with. Each is shown here:

Calculating \(P\begin{pmatrix}X \leq k \end{pmatrix}\)


Since \(F(x) = P\begin{pmatrix}X \leq x \end{pmatrix}\) we write: \[P\begin{pmatrix}X\leq k \end{pmatrix} = \int_{-\infty}^k f(x)dx\] This "tells us" that the probability that the continuous random variable \(X\) be less than or equal to some value \(k\) equals to the area enclosed by the probability density function and the horizontal axis, between \(-\infty \) and \(k\).

Calculating \(P\begin{pmatrix}a \leq X \leq b \end{pmatrix}\)


To calculate the probability that a continuous random variable \(X\), lie between two values say \(a\) and \(b\) we use the following result: \[P\begin{pmatrix}a \leq X \leq b \end{pmatrix} = \int_a^b f(x)dx\]

Calculating \(P\begin{pmatrix} X \geq k \end{pmatrix}\)

To calculate the probability that a continuous random variable \(X\) be greater than some value \(k\) we use the following result: \[P\begin{pmatrix} X \geq k \end{pmatrix} = \int_k^{+\infty} f(x)dx\]

Example

A continuous random variable \(X\) has probability density function defined as: \[f(x) = \begin{cases} -\frac{3}{4}x(x-2), \quad 0\leq x \leq 2 \\ 0, \quad \text{elsewhere} \end{cases}\]

  1. Find \(P\begin{pmatrix}X \leq 1.5\end{pmatrix}\).
  2. Find \(P\begin{pmatrix}0.5 \leq X \leq 1 \end{pmatrix}\).
  3. Find \(P\begin{pmatrix}X \geq 1 \end{pmatrix}\).

Solution

  1. To find \(P\begin{pmatrix}X \leq 1.5\end{pmatrix}\), we use write: \[\begin{aligned} P\begin{pmatrix} X \leq 1.5 \end{pmatrix} & = \int_{-\infty}^{1.5} f(x)dx \\ & = \int_{-\infty}^{\frac{3}{2}}f(x)dx \\ & = \int_{-\infty}^{\frac{3}{2}}-\frac{3}{4}x(x-2)dx \\ & = -\frac{3}{4} \int_{-\infty}^{\frac{3}{2}}x(x-2)dx \\ & = -\frac{3}{4} \int_{-\infty}^{\frac{3}{2}}\begin{pmatrix} x^2 - 2x \end{pmatrix}dx \\ & = -\frac{3}{4} \begin{bmatrix}\frac{x^3}{3} - x^2 \end{bmatrix}_0^{\frac{3}{2}} \\ & = - \frac{1}{4}\begin{bmatrix}x^3 - 3x^2 \end{bmatrix}_0^{\frac{3}{2}} \\ & = - \frac{1}{4}\begin{bmatrix}\begin{pmatrix} \frac{3}{2}\end{pmatrix}^3 - 3 \times \begin{pmatrix} \frac{3}{2} \end{pmatrix}^2 - 0 \end{bmatrix} \\ & = -\frac{1}{4}\begin{bmatrix} \frac{27}{8} - \frac{27}{4} \end{bmatrix} \\ & = - \frac{1}{4} \begin{bmatrix} -\frac{27}{8} \end{bmatrix} \\ & = \frac{27}{32} \\ P\begin{pmatrix} X \leq 1.5 \end{pmatrix} & = 0.844 \end{aligned}\]

    Graphically, this result can be interpreted as follows:

    The area enclosed by the probability density function's curve and the horizontal axis, from \(-\infty\) upto \(x=1.5\) is equal to \(0.844\) (rounded to 3 significant figures).
    The probability is equal to the area so: \(P\begin{pmatrix} X \leq 1.5\end{pmatrix} = 0.844\)


  2. To find \(P\begin{pmatrix}0.5 \leq X \leq 1\end{pmatrix}\) we write: \[\begin{aligned} P\begin{pmatrix}0.5 \leq X \leq 1\end{pmatrix} & = \int_{0.5}^1f(x)dx \\ & = \int_{0.5}^1 -\frac{3}{4}x(x-2)dx \\ & = -\frac{3}{4} \int_{0.5}^1 x(x-2)dx \\ & = -\frac{3}{4} \int_{\frac{1}{2}}^1 \begin{pmatrix} x^2-2x \end{pmatrix} dx \\ & = -\frac{3}{4}\begin{bmatrix} \frac{x^3}{3} - x^2 \end{bmatrix}_{\frac{1}{2}}^1 \\ & = -\frac{3}{4}\times \frac{1}{3}\begin{bmatrix} x^3 - 3x^2 \end{bmatrix}_{\frac{1}{2}}^1 \\ & = -\frac{1}{4}\begin{bmatrix} x^3 - 3x^2 \end{bmatrix}_{\frac{1}{2}}^1 \\ & = -\frac{1}{4}\begin{bmatrix} \begin{pmatrix} 1^3 - 3\times 1^2\end{pmatrix} - \begin{pmatrix} \begin{pmatrix}\frac{1}{2} \end{pmatrix}^3 - 3\begin{pmatrix}\frac{1}{2} \end{pmatrix}^2\end{pmatrix} \end{bmatrix} \\ & = -\frac{1}{4}\begin{bmatrix} \begin{pmatrix} 1 - 3\end{pmatrix} - \begin{pmatrix} \frac{1}{8} - 3\times \frac{1}{4}\end{pmatrix} \end{bmatrix} \\ & = -\frac{1}{4}\begin{bmatrix} \begin{pmatrix} -2\end{pmatrix} - \begin{pmatrix} \frac{1}{8} - \frac{3}{4}\end{pmatrix} \end{bmatrix} \\ & = -\frac{1}{4}\begin{bmatrix} -2 - \begin{pmatrix} \frac{1}{8} - \frac{6}{8}\end{pmatrix} \end{bmatrix} \\ & = -\frac{1}{4}\begin{bmatrix} -2 - \begin{pmatrix} - \frac{5}{8}\end{pmatrix} \end{bmatrix} \\ & = -\frac{1}{4}\begin{bmatrix} -2 + \frac{5}{8} \end{bmatrix} \\ & = -\frac{1}{4}\begin{bmatrix} - \frac{11}{8} \end{bmatrix} \\ & = \frac{11}{32} \\ P\begin{pmatrix}0.5 \leq X \leq 1\end{pmatrix} & = 0.344 \end{aligned}\]

    Graphically, this result can be interpreted as follows:

    The area enclosed by the probability density function's curve and the horizontal axis, between \(x=0.5\) and \(x=1\) is equal to \(0.344\) (rounded to 3 significant figures).
    The probability is equal to the area so: \(P\begin{pmatrix}0.5 \leq X \leq 1\end{pmatrix} = 0.344\)


  3. To find \(P\begin{pmatrix}X \geq 1\end{pmatrix}\) we write: \[\begin{aligned} P\begin{pmatrix}X \geq 1\end{pmatrix} & = \int_1^{+\infty}f(x)dx \\ & = \int_1^2 -\frac{3}{4}x(x-2)dx \\ & = -\frac{3}{4}\int_1^2 x(x-2)dx \\ & = -\frac{3}{4}\int_1^2 \begin{pmatrix} x^2 - 2x \end{pmatrix} dx \\ & = -\frac{3}{4}\begin{bmatrix}\frac{x^3}{3}-x^2 \end{bmatrix}_1^2 \\ & = -\frac{3}{4}\times \frac{1}{3}\begin{bmatrix}x^3-3x^2 \end{bmatrix}_1^2 \\ & = -\frac{1}{4}\begin{bmatrix} \begin{pmatrix}2^3-3\times 2^2\end{pmatrix} - \begin{pmatrix}1^3-3\times 1^2\end{pmatrix} \end{bmatrix} \\ & = -\frac{1}{4}\begin{bmatrix} \begin{pmatrix}8-12\end{pmatrix} - \begin{pmatrix}1-3\end{pmatrix} \end{bmatrix} \\ & = -\frac{1}{4}\begin{bmatrix} \begin{pmatrix}-4\end{pmatrix} - \begin{pmatrix}-2\end{pmatrix} \end{bmatrix} \\ & = -\frac{1}{4}\begin{bmatrix} \begin{pmatrix}-4\end{pmatrix} +2 \end{bmatrix} \\ & = -\frac{1}{4}\begin{bmatrix} -2 \end{bmatrix} \\ & = \frac{1}{2} \\ P\begin{pmatrix}X \geq 1\end{pmatrix} & = 0.5 \end{aligned}\]

    Graphically, this result can be interpreted as follows:

    The area enclosed by the probability density function's curve and the horizontal axis, between \(x=1\) and beyond is equal to \(0.5\).
    The probability is equal to the area so: \(P\begin{pmatrix}X \geq 1\end{pmatrix} = 0.5\).
    Note: we could have stated this result directly, without integrating, as \(x=1\) is the axis of symmetry of the parabola \(y=-\frac{3}{4}x(x-2)\).

Important Result


When working with continuous random variables the following results will always be true: \[P\begin{pmatrix}X\leq k \end{pmatrix} = P\begin{pmatrix}X < k \end{pmatrix}\]

and
\[P\begin{pmatrix}X\geq k \end{pmatrix} = P\begin{pmatrix}X > k \end{pmatrix}\] Consequently, the following four probabilities are equal and calculated in exactly the same way: \[\begin{aligned} P\begin{pmatrix}a \leq X \leq b \end{pmatrix} & = P\begin{pmatrix}a \leq X < b \end{pmatrix} \\ & = P\begin{pmatrix}a < X \leq b \end{pmatrix} \\ & = P\begin{pmatrix}a < X < b \end{pmatrix} \\ & = \int_a^b f(x)dx \end{aligned}\]

Exercise

  1. A continuous random variable \(X\) has pdf: \[f(x) = \begin{cases} \frac{sin(x)}{2}, \quad 0 \leq x \leq \pi \\ 0, \quad \text{elsewhere} \end{cases} \]
    1. Calculate \(P\begin{pmatrix}X \leq \frac{\pi}{3}\end{pmatrix}\)
    2. Calculate \(P\begin{pmatrix} \frac{\pi}{3} \leq X \leq \frac{2\pi}{3}\end{pmatrix}\)
    3. Show that \(X\) is indeed a continuous random variable.
  2. A continuous random variable has probability density function defined as: \[f(x) = \begin{cases} kx^2, \quad 0 \leq x \leq 2\\ 0, \quad \text{elsewhere} \end{cases} \]
    1. Find the value of \(k\).
    2. Find \(P \begin{pmatrix}X \leq 1 \end{pmatrix}\).
    3. Find \(P \begin{pmatrix}1 < X < 1.5 \end{pmatrix}\).

Answers Without Working

    1. \(P\begin{pmatrix}X \leq \frac{\pi}{3}\end{pmatrix} = \frac{1}{4} = 0.25\)
    2. \(P\begin{pmatrix} \frac{\pi}{3} \leq X \leq \frac{2\pi}{3}\end{pmatrix} = \frac{1}{2} = 0.5\)
    3. We show that \(X\) is a coontinuous random variable by showing that \(\int_{-\infty}^{+\infty}f(x)dx = 1\): \[\begin{aligned} \int_{-\infty}^{+\infty}f(x)dx & = \int_0^{\pi}\frac{sin(x)}{2}dx \\ & = \begin{bmatrix}- \frac{cos(x)}{2} \end{bmatrix}_0^{\pi} \\ & = -\frac{1}{2}\begin{bmatrix}cos(x) \end{bmatrix}_0^{\pi} \\ & = -\frac{1}{2}\begin{bmatrix}cos\begin{pmatrix}\pi \end{pmatrix} - cos\begin{pmatrix}0 \end{pmatrix} \end{bmatrix} \\ & = -\frac{1}{2}\begin{bmatrix}-1 - 1 \end{bmatrix} \\ & = -\frac{1}{2}\begin{bmatrix}-2 \end{bmatrix} \\ \int_{-\infty}^{+\infty}f(x)dx & = 1 \end{aligned}\] Since \(\int_{-\infty}^{+\infty}f(x)dx = 1\) we can confirm that \(X\) is a continuous random variable.
    1. \(k = \frac{3}{8}\)
    2. \(P\begin{pmatrix}X \leq 1 \end{pmatrix} = 0.125\)
    3. \(P\begin{pmatrix}1 \leq X \leq 1.5 \end{pmatrix} = \frac{19}{64}=0.297\)