4.12 Continuous DistributionsHL ONLY

1. Description of the Problem

Let $X$ be a random variable taking values in the interval $[0, 4]$. Suppose the probability of $X$ is not uniformly distributed throughout this interval, but $X$ is more likely to take values near 4.

A continuous function describes this probability. Assume the function is:

$f(x) = \dfrac{x}{8}, \quad 0 \le x \le 4$
x y 1 2 3 4 0.5
The probability increases as $x$ approaches 4. Notice that:
  • (i) $f(x) \ge 0$
  • (ii) the area of the triangle under the graph is 1
The probability that $X$ is between 0 and 2 is the area under the curve in that interval, which is 0.25 (25% of the total area). We write:
$P(0 \le X \le 2) = 0.25$
Similarly, $P(2 \le X \le 4) = 0.75$.

2. General Properties of Continuous Random Variables

For a continuous random variable, we measure the probability of an interval, not a single value. The probability that $X$ takes a specific value $a$ is 0, so $P(X=a) = 0$.

For a continuous random variable $X$ with probability density function (pdf) $f(x)$:

  • (i) $f(x) \ge 0$, i.e., the function is non-negative
  • (ii) $\displaystyle\int_{-\infty}^{+\infty} f(x) dx = 1$, i.e., the total area under the curve is 1

The probability that $X$ is between $a$ and $b$ is found by integration:

$P(a \le X \le b) = \displaystyle\int_{a}^{b} f(x) dx$
Notice: $P(a \le X \le b)$ and $P(a < X < b)$ are the same because the probability of $X$ taking a specific value is zero.

In our example, $f(x) = \dfrac{x}{8}$ for $0 \le x \le 4$, and:

$\displaystyle\int_{-\infty}^{+\infty} f(x) dx = \int_{0}^{4} \dfrac{x}{8} dx = \left[ \dfrac{x^2}{16} \right]_0^4 = 1$
$P(0 \le X \le 2) = \displaystyle\int_{0}^{2} \dfrac{x}{8} dx = \left[ \dfrac{x^2}{16} \right]_0^2 = \dfrac{4}{16} = \mathbf{0.25}$
$P(2 \le X \le 4) = 1 - 0.25 = \mathbf{0.75}$
For any single value of $X$, the probability is 0. For example: $P(X=2) = 0$, $P(X=3.7) = 0$.

3. Expected Value, Variance, Mode, Median, and Quartiles

Comparison of Definitions

Concept $X$ DISCRETE $X$ CONTINUOUS
Mean $\mu = E(X)$ $\displaystyle\sum x_i p_i$ $\displaystyle\int_{-\infty}^{+\infty} x f(x) dx$
$E(X^2)$ $\displaystyle\sum x_i^2 p_i$ $\displaystyle\int_{-\infty}^{+\infty} x^2 f(x) dx$
Variance $Var(X)$ $E(X^2) - \mu^2$ $E(X^2) - \mu^2$

Applying these definitions to our example $f(x) = \dfrac{x}{8}$ ($0 \le x \le 4$):

  • EXPECTED VALUE $\mu = E(X)$ $$ \begin{aligned} \mu &= E(X) = \displaystyle\int_{-\infty}^{+\infty} x f(x) dx = \int_{0}^{4} x \left(\dfrac{x}{8}\right) dx = \int_{0}^{4} \dfrac{x^2}{8} dx \\ &= \left[ \dfrac{x^3}{24} \right]_0^4 = \mathbf{\dfrac{8}{3}} \approx 2.67 \end{aligned} $$
  • VARIANCE $Var(X)$
    First compute $$ E(X^2) = \displaystyle\int_{-\infty}^{+\infty} x^2 f(x) dx = \int_{0}^{4} x^2 \left(\dfrac{x}{8}\right) dx = \int_{0}^{4} \dfrac{x^3}{8} dx = \left[ \dfrac{x^4}{32} \right]_0^4 = \mathbf{8} $$ Then calculate $Var(X) = E(X^2) - \mu^2 = 8 - \left(\dfrac{8}{3}\right)^2 = 8 - \dfrac{64}{9} = \mathbf{\dfrac{8}{9}}$.
    Note: The definition $$ Var(X) = \int_{-\infty}^{+\infty} (x-\mu)^2 f(x) dx = \int_{0}^{4} \left(x-\dfrac{8}{3}\right)^2 \dfrac{x}{8} dx $$ gives the same result but is harder to calculate directly.
  • MODE
    The mode is the value of $x$ where $f(x)$ is at its maximum. On the graph, this occurs at the right bound, so MODE = 4
  • MEDIAN
    The median $m$ divides the area in half: $P(X \le m) = 0.5$. We find $m$ by solving $\int_{-\infty}^{m} f(x) dx = 0.5$.
    $$ \begin{aligned} \int_{0}^{m} \dfrac{x}{8} dx = 0.5 &\iff \left[ \dfrac{x^2}{16} \right]_0^m = 0.5 \iff \dfrac{m^2}{16} = 0.5 \\ &\iff m^2 = 8 \iff \mathbf{m = \sqrt{8}} \end{aligned} $$
  • QUARTILES
    The lower quartile $Q_1$ and upper quartile $Q_3$ bound 25% and 75% of the total area, respectively.
    $P(X \le Q_1) = 0.25 \implies \displaystyle\int_{-\infty}^{Q_1} f(x) dx = 0.25 \implies \left[ \dfrac{x^2}{16} \right]_0^{Q_1} = 0.25 \implies \dfrac{Q_1^2}{16} = \dfrac{1}{4} \implies Q_1^2 = 4 \implies \mathbf{Q_1 = 2}$
    $P(X \le Q_3) = 0.75 \implies \displaystyle\int_{-\infty}^{Q_3} f(x) dx = 0.75 \implies \left[ \dfrac{x^2}{16} \right]_0^{Q_3} = 0.75 \implies \dfrac{Q_3^2}{16} = \dfrac{3}{4} \implies Q_3^2 = 12 \implies \mathbf{Q_3 = 2\sqrt{3}}$

EXAMPLE 1: Evaluating a Piecewise Function

Let $X$ be a continuous random variable in $[0, 4]$ with pdf defined as:

$f(x) = \begin{cases} \dfrac{x}{4}, & 0 \le x \le 2 \\ 1 - \dfrac{x}{4}, & 2 \le x \le 4 \end{cases}$
x y 1 2 3 4 0.5
  • Confirm that $f(x)$ is a valid pdf $$ \int_{-\infty}^{+\infty} f(x) dx = \int_{0}^{2} \dfrac{x}{4} dx + \int_{2}^{4} \left(1 - \dfrac{x}{4}\right) dx = \dfrac{1}{2} + \dfrac{1}{2} = \mathbf{1} $$ [It is easier to find the area using the geometry of the triangle: Area = $\dfrac{1}{2} \times 4 \times 0.5 = 1$.]
  • Expected Value:
    $$ \mu = E(X) = \displaystyle\int_{-\infty}^{+\infty} x f(x) dx = \int_{0}^{2} \dfrac{x^2}{4} dx + \int_{2}^{4} \left(x - \dfrac{x^2}{4}\right) dx = \mathbf{2} $$
  • Variance:
    Find $E(X^2)$ first: $$ \begin{aligned} E(X^2) &= \int_{-\infty}^{+\infty} x^2 f(x) dx = \int_{0}^{2} \dfrac{x^3}{4} dx + \int_{2}^{4} \left(x^2 - \dfrac{x^3}{4}\right) dx \\ &= 1 + \dfrac{11}{3} = \mathbf{\dfrac{14}{3}} \end{aligned} $$ Then calculate the variance: $$ Var(X) = E(X^2) - E(X)^2 = \dfrac{14}{3} - 2^2 = \dfrac{14}{3} - \dfrac{12}{3} = \mathbf{\dfrac{2}{3}} $$
  • Median:
    Since $\displaystyle\int_{0}^{2} \dfrac{x}{4} dx = 0.5$, the median is 2.
Notice: Finding the median of a piecewise function
Suppose that $$ f(x) = \begin{cases} f_1(x), & a \le x \le b \\ f_2(x), & b \le x \le c \end{cases} $$ First, evaluate $\displaystyle\int_{a}^{b} f_1(x) dx = A$.
If $\mathbf{A > 0.5}$, the median is between $a$ and $b$. Find $m$ by solving $\displaystyle\int_{a}^{m} f_1(x) dx = 0.5$.
If $\mathbf{A < 0.5}$, the median is between $b$ and $c$. Find $m$ by solving $\displaystyle\int_{m}^{c} f_2(x) dx = 0.5$.