xaktly | Probability & Statistics

Discrete random
variables



Discrete random variables & expectations


Discrete random variables (DRVs) are used to describe many kinds of situations. Discrete is the opposite of continuous. A discrete variable can take on only one of some known list of values – discrete values, while a continuous variable can have any value within some range (which could be an infinite range). Let's start with a simple and familiar example.


Sum of two six-sided dice


The outcomes and probabilities of this probability experiment are

Sum Prob. Sum Prob
2 $\frac{1}{36}$ 8 $\frac{5}{36}$
3 $\frac{2}{36} = \frac{1}{18}$ 9 $\frac{4}{36} = \frac{1}{9}$
4 $\frac{3}{36} = \frac{1}{12}$ 10 $\frac{3}{36} = \frac{1}{12}$
5 $\frac{4}{36} = \frac{1}{9}$ 11 $\frac{2}{36} = \frac{1}{18}$
6 $\frac{5}{36}$ 12 $\frac{1}{36}$
7 $\frac{6}{36} = \frac{1}{6}$

There are eleven discrete outcomes in this experiment,

$$X = \{2, 3, 4, \dots , 11, 12\},$$

where $X$ is our discrete random variable and the set of $p_i$ are the probabilities of the ith value of $X_i.$ No values of X between any of its discrete possibilities are allowed.

The probabilities here can be thought of as the weights in a weighted average. They have the advantage, however, of being normalized – they sum to 1. So in all such cases the weighted average of all possible outcomes is

$$ \begin{align} \bar X &= \frac{X_1 p_1 + X_2 p_2 + \dots + x_{11} p_{11}}{p_1 + p_2 + \dots + p_{11}} \\[8pt] \bar X &= X_1 p_1 + X_2 p_2 + \dots + x_{11} p_{11} \end{align}$$

We can make that more general using summation notation:

$$\bar X = \sum_{i=1}^{n} X_i p_i$$

This is often called the expected value of the distribution. The expected value for this distribution is

$$ \begin{align} \bar X &= 2\bigg(\frac{1}{36} \bigg) + 3\bigg(\frac{1}{16} \bigg) + 4\bigg(\frac{1}{12} \bigg) \\[5pt] &+ 5\bigg(\frac{1}{9} \bigg) + 6\bigg(\frac{5}{36} \bigg) + 7\bigg(\frac{1}{6} \bigg) \\[5pt] &+ 8\bigg(\frac{5}{36} \bigg) + 9\bigg(\frac{4}{36} \bigg) + 10\bigg(\frac{3}{36} \bigg) \\[5pt] &+ 11\bigg(\frac{1}{16} \bigg) + 12\bigg(\frac{1}{36} \bigg) = 7 \end{align}$$

Notice that a mean of 7 here is a member of the set of X's, but it need not be. You can check for yourself that the mean of the DRV that represents the outcomes of a throw of a single, six-sided die, $X = \{1, 2, 3, 4, 5, 6\}$, with probability $p = \frac{1}{6}$ of each, is 3.5, not one of the discrete values of $X$.

The expectation value (mean) of a discrete random variable need not be in the set of discrete outcomes.

Variance $(\sigma^2)$ of a discrete random distribution


The variance of a distribution is

$$\sigma^2 = \frac{1}{n - 1} \sum_{i = 1}^n (X_i - \bar X)^2$$

By analogy with the mean of a discrete random distribution (DRD) above, we have the variance of a DRD:

$$\sigma^2 = \sum_{i = 1}^n (X_i - \bar X)^2 p_i$$

Here's an example calculation using our sum-of-two-dice data from above.

The standard deviation of the distribution is

$$ \begin{align} \sigma &= \sqrt{\sigma^2} \\[5pt] &= \sqrt{5.83} \\[5pt] &= 2.42 \end{align}$$

$$ \begin{align} \sigma^2 &= (2 - 7)^2\bigg(\frac{1}{36} \bigg) + (3 - 7)^2\bigg(\frac{1}{16} \bigg) \\[5pt] &+ (4 - 7)^2\bigg(\frac{1}{12} \bigg) + (5 - 7)^2\bigg(\frac{1}{9} \bigg) \\[5pt] &+ (6 - 7)^2\bigg(\frac{5}{36} \bigg) + (7 - 7)^2\bigg(\frac{1}{6} \bigg) \\[5pt] &+ (8 - 7)^2\bigg(\frac{5}{36} \bigg) + (9 - 7)^2\bigg(\frac{4}{36} \bigg) \\[5pt] &+ (10 - 7)^2\bigg(\frac{3}{36} \bigg) + (11 - 7)^2\bigg(\frac{1}{16} \bigg) \\[5pt] &+ (12 - 7)^2\bigg(\frac{1}{36} \bigg) = 5.83 \end{align}$$

Calculator tip

The mean and standard deviation of discrete random data can be found using lists and the [STAT] functions on a TI-84 calculator. Here are the steps using the dice data from above.

First, enter the Xi values in a list; I've used $L_1$ here. Then enter the probabilities (pi) or frequencies into a second list; I've used $L_2$.

Choose the 1-var stats function and enter the X-data in the List: space using [2nd]+L1. Likewise, enter the probabilities into the FreqList: space.

Then hit calculate and you'll see (red arrows) your mean and σ.


Practice 1


Fill in any missing probabilities and calculate the mean and standard deviation of these discrete random distributions. Be sure to check the solutions to make sure you're getting it.


  1. These are data from a 2021 survey of United States households, inquiring about the number of members in the houshold from 1 to 7 or more.

    No. persons 1 2 3 4 5 6 >6
    Prob. (%) 28.45 35.03 12.39 5.83 2.03 1.24

    Fill in the missing probability and calculate the mean and standard deviation of this distribution.

    Solution

    The missing value must be 0.1503 or 15.03% because we assume that the probabilities are normalized (sum to one). The mean is

    $$ \begin{align} \bar X &= 1(0.2845) + 2(0.3503) + 3(0.1503) \\[5pt] &+ 4(0.1239) + 5(0.0583) + 6(0.0203) \\[5pt] &+ 7(0.00124) = 2.4317 \end{align}$$

    Notice that the mean of a discrete random distribution doesn't have to be one of the allowed discrete values.

    The variance is

    $$ \begin{align} \sigma^2 &= (1 - 2.4317)^2(0.2845) + (2 - 2.4317)^2(0.3503) \\[5pt] &+ (3 - 2.4317)^2(0.1503) + (4 - 2.4317)^2(0.1239) \\[5pt] &+ (5 - 2.4317)^2(0.0583) + (6 - 2.4317)^2(0.0203) \\[5pt] &+ (7 - 2.4317)^2(0.00124) = 1.9035 \end{align}$$

    Taking the square root of the variance gives us $\sigma = 1.3797.$ So our mean is $\bar X = 2.43 ± 1.38$. We'd conclude from this data that 68% of households (± one standard deviation from the mean) have between 1 and 4 members, inclusive.

    Note that we made one small approximation here in lumping all families with 7 or mor members into the 7-member category. Give the low probability for such a household, the error introduced should be small.


  2. The number of traffic accidents per month at a certain busy intersection follows this distribution:

    Accidents 0 1 2 3 4
    Probability 0.465 0.382 0.135 0.015

    Fill in the missing probability and calculate the mean and standard deviation of this distribution.

    Solution

    The missing value must be 0.003 or 0.3% because we assume that the probabilities are normalized (sum to one). The mean is

    $$ \begin{align} \bar X &= 0(0.465) + 1(0.382) + 2(0.135) \\[5pt] &+ 3(0.015) + 4(0.003) = 0.709 \end{align}$$

    The variance is

    $$ \begin{align} \sigma^2 &= (0 - 0.709)^2(0.465) + (1 - 0.709)^2(0.382) \\[5pt] &+ (2 - 0.709)^2(0.135) + (3 - 0.709)^2(0.015) \\[5pt] &+ (4 - 0.709)^2(0.003) = 0.602 \end{align}$$

    Taking the square root of the variance gives us $\sigma = 0.776.$ So our mean is $\bar X = 0.709 ± 0.776$. We'd conclude from this data that in 68% of months the number of accidents lies in the interval [0, 2].


Mean and $\sigma$ of a discrete random distribution

The mean of a discrete random distribution is

$$\bar X = \sum_{i=1}^{n} X_i p_i$$

The variance of a discrete random distribution is

$$\sigma^2 = \sum_{i = 1}^n (X_i - \bar X)^2 p_i$$


Transformations of DRVs

We'll often need to multiply and divide discrete random variables by a constant, and to add or subtract two variables. But when we do this, we're maniplating whole distributions, characterized by their means and variances.


Multiplication and division.

It's only really necessary to consider multiplication here because division is just multiplication by the reciprocal. Consider this distribution. It's made up, but it will do the job. It approximates a normal distribution, but that's not necessary for this purpose. Its mean is $\bar X ± \sigma = \bar X = 5.0 ± 0.1.456$ .

Now let's take that entire distribution and multiply it by 2. That amounts to multiplication of both the mean and the variance ( σ2 ) by 2. The new mean and variance are $\bar X = 10$ and $\sigma^2 = 4.239$. The variance of the original distribution is 1.4562 = 2.119, so we can see that when we multiply a distribution by 2, we double the mean and we double the variance. Be cautious, though, the standard deviation doesn't double, but is multiplied by the square root of 2.

For example, if we have a variance of x and double it to 2x, then the resulting standard deviations are

$$ \begin{align} \sigma_1 &= \sqrt{x} \\[5pt] \sigma_2 &= \sqrt{2x} = \sqrt{2} \sqrt{x}, \end{align}$$

So while the variance scales with the mean, the standard deviation does not. So remember that when we multiply or divide a discrete random variable by a constant, both the mean and variance are multiplied or divided in the same manner.


When a discrete random distribution is multiplied by 2, its mean and variance are also multiplied by 2. Thus the whole distribution is stretched in the left ↔ right direction.


Adding and subtracting

When we add and subtract discrete random variables, we add/subtract both means and variances (not standard deviations). For example, if we have random variables

$$ \begin{align} x_1 ± \sigma_1 \\[5pt] x_2 ± \sigma_2, \end{align}$$

then the sum is

$$x_1 + x_2 ± \sqrt{\sigma_1^2 + \sigma_2^2}$$

The same rule holds for subtraction:

$$x_1 - x_2 ± \sqrt{\sigma_1^2 + \sigma_2^2}$$

Think of it this way: If we were to subtract variances, it's entirely possible to have two means with two identical, large variances that would subtract to zero, giving the impression that the error in combinbing these two means had somehow vastly improved, and that's not right.

Why we add variances

... and why we do it when adding or subtracting distributions


Here is the underlying mathematics of why we add variances and take the square root of the sum to find the standard deviation of any combination of distributions.

We begin with the expectation value of anything in a discrete distribution, say the expectation of the random variable $X$, which we write $E(X)$.

$$E(X) = \sum_{i=1}^n X p_i(X)$$

That would just be the mean of the distribution. The standard deviation is then

$$E[(X - \mu)^2] = \sum_{i=1}^n (X - \mu) p_i(X)$$

Now we often want to express that in a way that is more useful for what comes next, so see if you can follow this process. Here the term $'\text{Var}(X)'$ will mean "the variance of $X$."

$$ \begin{align} \text{Var}(X) &= E[(X - \mu)^2] \\[5pt] &= E(X^2 -2 X \mu - \mu^2) \\[5pt] &= E(X^2) - 2 \mu E(X) + E(\mu^2) \tag{1} \\[5pt] &= E(X^2) - 2 \mu^2 + \mu^2 \\[5pt] \text{Var}(X) &= E(X^2) - \mu^2 \tag{2} \end{align}$$

In equation (1) we've used the fact that $E(X) = \mu$. In the last relationship, $\text{Var}(X) = E(X^2) - \mu^2$ (2) is a handy one.

The

The same rule holds for subtraction:

$$x_1 - x_2 ± \sqrt{\sigma_1^2 + \sigma_2^2}$$

Think of it this way: If we were to subtract variances, it's entirely possible to have two means with two identical, large variances that would subtract to zero, giving the impression that the error in combinbing these two means had somehow vastly improved, and that's not right.

Transformations

Multiplication or division

Means and variances are multiplied or divided by a constant. The position and width of the distribution changes, but the shape of the curve (i.e. that it is normal or some other shape) does not.

$$ \begin{align} a(\bar x ± \sigma) &= a\bar x ± \sigma \\[5pt] \frac{1}{a} (\bar x ± \sigma) &= \frac{\bar x}{a} ± \frac{\sigma}{a} \end{align}$$

Addition and subtraction: constants

When a constant is added to or subtracted from a mean ± standard deviation, both shift left or right, accordingly, but neither the width of the distribution nor its shape change.

$$(\bar x ± \sigma) ± a = (\bar x ± a) ± \sigma$$

Addition or subtraction of two means

$$ \begin{align} \bar x_1 ± \sigma_1 + \bar x_2 ± \sigma_2 &= \bar x_1 + \bar x_2 ± \sqrt{\sigma_1^2 + \sigma_2^2} \\[5pt] \bar x_1 ± \sigma_1 - \bar x_2 ± \sigma_2 &= \bar x_1 + \bar x_2 ± \sqrt{\sigma_1^2 + \sigma_2^2} \\[5pt] \end{align}$$


Practice 2


  1. Let $A = 2.36 ± 0.74$ and $B = 9.76 ± 2.18$, where the numbers after ± are one standard deviation. Calculate the following:

    1. $A + B$
    2. $A - B$
    3. $A + 4B$
    4. $B - \frac{A}{3}$
Solutions

Narrow screens: scroll left-right for wide equations

$$ \begin{align} A + B &= 2.36 + 9.76 ± \sqrt{0.74^2 + 2.18^2} \tag{a} \\[5pt] &= 12.12 ± 2.30 \end{align}$$

$$ \begin{align} A - B &= 2.36 - 9.76 ± \sqrt{0.74^2 + 2.18^2} \tag{b} \\[5pt] &= -7.44 ± 2.30 \end{align}$$

$$ \begin{align} A - 4B &= 2.36 - 4(9.76) ± \sqrt{0.74^2 + (4\cdot 2.18)^2} \tag{c} \\[5pt] &= -36.68 ± \sqrt{0.5476 + 76.0384} \\[5pt] &= -36.68 ± 8.75 \end{align}$$

$$ \begin{align} B - \frac{A}{3} &= 9.76 - \frac{2.36}{3} ± \sqrt{2.18^2 + \left( \frac{1}{3}(0.74)\right)^2} \tag{d} \\[5pt] &= 8.98 ± \sqrt{4.75 + 0.0608} \\[5pt] &= 8.97 ± 2.19 \end{align}$$

  1. Let $A = 0.07 ± 0.01$ and $B = 0.22 ± 0.18$, where the numbers after ± are one standard deviation. Calculate the following:

    1. $A - B$
    2. $A - 2B$
    3. $A + 9B$
    4. $B - \frac{A}{2}$
Solutions

Narrow screens: scroll left-right for wide equations

$$ \begin{align} A - B &= 0.07 - 0.22 ± \sqrt{0.01^2 + 0.18^2} \tag{a} \\[5pt] &= -0.15 ± 0.18 \end{align}$$

$$ \begin{align} A - 2B &= 0.07 - 2(0.22) ± \sqrt{0.01^2 + (2\cdot 0.18)^2} \tag{b} \\[5pt] &= -0.37 ± \sqrt{0.0001 + 0.1296} \\[5pt] &= -0.37 ± 0.36 \end{align}$$

$$ \begin{align} A + 9B &= 0.07 + 9(0.22) ± \sqrt{0.01^2 + (9\cdot 0.18)^2} \tag{c} \\[5pt] &= 2.05 ± \sqrt{0.0001 + 2.6244} \\[5pt] &= 2.05 ± 1.62 \end{align}$$

$$ \begin{align} B - \frac{A}{2} &= 0.22 - \frac{1}{2}(0.07) ± \sqrt{0.22^2 + \left( \frac{1}{2}\cdot 0.07\right)^2} \tag{d} \\[5pt] &= 0.185 ± \sqrt{0.0484 + 0.0012} \\[5pt] &= 0.185 ± 0.0496 \end{align}$$



X

discrete

Discrete means individually separate and distinct. In mathematics, a discrete varable might only take on integer values, or values from a set {a, b, c, ... d}. In quantum mechanics, things the size of atoms and molecules can have only discrete energies, E1 or E2, but nothing in between, for example.

Creative Commons License   optimized for firefox
xaktly.com by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2012-2019, Jeff Cruzan. All text and images on this website not specifically attributed to another source were created by me and I reserve all rights as to their use. Any opinions expressed on this website are entirely mine, and do not necessarily reflect the views of any of my employers. Please feel free to send any questions or comments to jeff.cruzan@verizon.net.