Mean, variance and standard deviation of a discrete random variable
Master the mean, variance and standard deviation of a discrete random variable in Year 11 VCE Specialist Mathematics. A discrete random variable \(X\) takes separate numerical values, each with a probability set out in a probability distribution table. It sits in the Data analysis, probability and statistics area of study of the VCE Mathematics Study Design (VCAA), within the Simulation, sampling and sampling distributions topic of Unit 2.
You will learn to check a distribution and find an unknown probability from \(\sum P(x)=1\), calculate the mean \(E(X)=\sum x\,P(x)\), the variance \(\mathrm{Var}(X)=E(X^2)-[E(X)]^2\) and the standard deviation \(\mathrm{sd}(X)=\sqrt{\mathrm{Var}(X)}\), and apply the linear rule \(E(aX+b)=a\,E(X)+b\) — the foundation for sampling distributions later in Unit 2.
Theory
A discrete random variable \(X\) takes separate numerical values, each with a probability set out in a probability distribution table. In Year 11 Specialist Mathematics you find its mean \(E(X)=\sum x\,P(x)\), its variance \(\mathrm{Var}(X)=E(X^2)-[E(X)]^2\) and its standard deviation \(\mathrm{sd}(X)=\sqrt{\mathrm{Var}(X)}\), after checking the probabilities sum to \(1\). This page shows how, with fully worked examples.
A random variable \(X\) assigns a number to each outcome of a chance experiment. It is discrete when its possible values are separate numbers (for example \(0, 1, 2, 3\)) rather than a continuous range. The list of those values together with their probabilities is the probability distribution of \(X\), usually written as a table of \(x\) against \(P(X=x)\).
For a table to be a valid probability distribution, every probability must lie between \(0\) and \(1\), and the probabilities must add to \(1\): \(\sum P(x)=1\). This condition is what lets you solve for an unknown probability in a distribution.
The mean or expected value \(E(X)\), written \(\mu\), is the long-run average value of \(X\). It is the sum of each value multiplied by its probability, \(E(X)=\sum x\,P(x)\) — a weighted average that pulls towards the more likely values.
The variance \(\mathrm{Var}(X)\) measures how spread out the values are about the mean. It is the expected squared distance from the mean, \(\sum (x-\mu)^2 P(x)\), which rearranges to the shortcut \(E(X^2)-[E(X)]^2\). The standard deviation \(\mathrm{sd}(X)=\sqrt{\mathrm{Var}(X)}\) brings this spread back to the original units of \(X\).
| \(x\) | \(0\) | \(1\) | \(2\) | \(3\) |
|---|---|---|---|---|
| \(P(X=x)\) | \(0.1\) | \(0.3\) | \(0.4\) | \(0.2\) |
| sum | |||||
|---|---|---|---|---|---|
| \(x\) | \(0\) | \(1\) | \(2\) | \(3\) | \(—\) |
| \(P(x)\) | \(0.1\) | \(0.3\) | \(0.4\) | \(0.2\) | \(1\) |
| \(x\,P(x)\) | \(0\) | \(0.3\) | \(0.8\) | \(0.6\) | \(1.7\) |
| \(x^2P(x)\) | \(0\) | \(0.3\) | \(1.6\) | \(1.8\) | \(3.7\) |
A discrete random variable \(X\) has a valid probability distribution when the probabilities are non-negative and total \(1\):
The mean (expected value) is the probability-weighted sum of the values:
The variance is the expected squared distance from the mean; the right-hand form is the usual shortcut:
where \(E(X^2)=\sum x^2\,P(x)\). The standard deviation is the square root of the variance, restoring the units of \(X\):
Expectation is linear, so for a linear function \(aX+b\):
Finding the mean, variance and standard deviation
- Check the distribution. Confirm every \(P(x)\) is in \([0,1]\) and that \(\sum P(x)=1\). If a probability is unknown, use \(\sum P(x)=1\) to solve for it.
- Mean. Multiply each value by its probability and add: \(E(X)=\sum x\,P(x)\). A \(x\,P(x)\) column keeps this tidy.
- \(E(X^2)\). Square each value first, then multiply by its probability and add: \(E(X^2)=\sum x^2\,P(x)\).
- Variance. Subtract the square of the mean: \(\mathrm{Var}(X)=E(X^2)-[E(X)]^2\).
- Standard deviation. Take the positive square root: \(\mathrm{sd}(X)=\sqrt{\mathrm{Var}(X)}\).
- Function of \(X\). For a linear function use \(E(aX+b)=a\,E(X)+b\); there is no need to build a new distribution.
Laying the work out as columns of a table — \(x\), \(P(x)\), \(x\,P(x)\) and \(x^2P(x)\) — makes the two sums \(E(X)\) and \(E(X^2)\) easy to read off and check.
| \(x\) | \(0\) | \(1\) | \(2\) | \(3\) |
|---|---|---|---|---|
| \(P(X=x)\) | \(0.1\) | \(0.3\) | \(0.4\) | \(0.2\) |
First check the probabilities sum to \(1\):
| \(\sum P(x)\) | \(=\) | \(0.1+0.3+0.4+0.2\) |
| \(=\) | \(1\ \checkmark\) |
Multiply each value by its probability and add, \(E(X)=\sum x\,P(x)\):
| \(E(X)\) | \(=\) | \(0(0.1)+1(0.3)+2(0.4)+3(0.2)\) |
| \(=\) | \(0+0.3+0.8+0.6\) | |
| \(=\) | \(1.7\) |
The mean is \(E(X)=1.7\).
| \(x\) | \(1\) | \(2\) | \(3\) | \(4\) |
|---|---|---|---|---|
| \(P(X=x)\) | \(0.1\) | \(0.2\) | \(k\) | \(0.3\) |
The probabilities of a distribution add to \(1\), so set \(\sum P(x)=1\):
| \(0.1+0.2+k+0.3\) | \(=\) | \(1\) |
| \(0.6+k\) | \(=\) | \(1\) |
| \(k\) | \(=\) | \(1-0.6\) |
| \(=\) | \(0.4\) |
The unknown probability is \(k=0.4\).
| \(x\) | \(1\) | \(2\) | \(3\) |
|---|---|---|---|
| \(P(X=x)\) | \(0.2\) | \(0.5\) | \(0.3\) |
Mean, \(E(X)=\sum x\,P(x)\):
| \(E(X)\) | \(=\) | \(1(0.2)+2(0.5)+3(0.3)\) |
| \(=\) | \(0.2+1.0+0.9\) | |
| \(=\) | \(2.1\) |
\(E(X^2)=\sum x^2\,P(x)\) — square each value first:
| \(E(X^2)\) | \(=\) | \(1(0.2)+4(0.5)+9(0.3)\) |
| \(=\) | \(0.2+2.0+2.7\) | |
| \(=\) | \(4.9\) |
Variance, \(\mathrm{Var}(X)=E(X^2)-[E(X)]^2\):
| \(\mathrm{Var}(X)\) | \(=\) | \(4.9-(2.1)^2\) |
| \(=\) | \(4.9-4.41\) | |
| \(=\) | \(0.49\) |
Standard deviation, \(\mathrm{sd}(X)=\sqrt{\mathrm{Var}(X)}\):
| \(\mathrm{sd}(X)\) | \(=\) | \(\sqrt{0.49}\) |
| \(=\) | \(0.7\) |
\(E(X)=2.1\), \(\mathrm{Var}(X)=0.49\) and \(\mathrm{sd}(X)=0.7\).
| \(x\) | \(1\) | \(2\) | \(3\) | \(4\) |
|---|---|---|---|---|
| \(P(X=x)\) | \(0.4\) | \(0.3\) | \(0.2\) | \(0.1\) |
Mean and \(E(X^2)\) from the distribution:
| \(E(X)\) | \(=\) | \(1(0.4)+2(0.3)+3(0.2)+4(0.1)\) |
| \(=\) | \(0.4+0.6+0.6+0.4=2\) | |
| \(E(X^2)\) | \(=\) | \(1(0.4)+4(0.3)+9(0.2)+16(0.1)\) |
| \(=\) | \(0.4+1.2+1.8+1.6=5\) |
Variance, then standard deviation:
| \(\mathrm{Var}(X)\) | \(=\) | \(5-(2)^2=1\) |
| \(\mathrm{sd}(X)\) | \(=\) | \(\sqrt{1}=1\) |
Expectation is linear, so \(E(2X+3)=2\,E(X)+3\):
| \(E(2X+3)\) | \(=\) | \(2(2)+3\) |
| \(=\) | \(7\) |
\(\mathrm{sd}(X)=1\) and \(E(2X+3)=7\).
| sum | |||||
|---|---|---|---|---|---|
| \(x\) | \(1\) | \(2\) | \(3\) | \(4\) | \(—\) |
| \(P(x)\) | \(0.4\) | \(0.3\) | \(0.2\) | \(0.1\) | \(1\) |
| \(x\,P(x)\) | \(0.4\) | \(0.6\) | \(0.6\) | \(0.4\) | \(1.7\) |
| \(x^2P(x)\) | \(0.4\) | \(1.2\) | \(1.8\) | \(1.6\) | \(3.7\) |
Common pitfalls
Frequently asked questions
What is a discrete random variable?
It is a variable \(X\) whose possible values are separate numbers, each with a probability given by a probability distribution. For a valid distribution every \(P(x)\) lies in \([0,1]\) and \(\sum P(x)=1\).
How do I find the mean of a discrete random variable?
The mean, or expected value, is \(E(X)=\sum x\,P(x)\): multiply each value by its probability and add. It is a weighted average of the values.
What is the formula for the variance?
The variance is \(\mathrm{Var}(X)=E(X^2)-[E(X)]^2\), where \(E(X^2)=\sum x^2\,P(x)\). This is equal to \(\sum (x-\mu)^2 P(x)\) but is usually quicker to compute.
How is the standard deviation related to the variance?
The standard deviation is the square root of the variance, \(\mathrm{sd}(X)=\sqrt{\mathrm{Var}(X)}\). It measures spread in the same units as \(X\), whereas the variance is in squared units.
How do I find an unknown probability in a distribution?
Use the fact that the probabilities sum to \(1\). Add the known probabilities and the unknown, set the total equal to \(1\), and solve. For example \(0.1+0.2+k+0.3=1\) gives \(k=0.4\).
How do I find the expected value of a function of X?
For a linear function, expectation is linear: \(E(aX+b)=a\,E(X)+b\). For a general function \(g(X)\), use \(E\big(g(X)\big)=\sum g(x)\,P(x)\), for example \(E(X^2)=\sum x^2\,P(x)\).