Complete reference
Discrete random variables
Use this page when you want the full derivations, source detail, and method notes. The main lesson keeps the shorter study path.
Lesson notes
From outcomes to a numerical random variable
The source outline covers discrete random variables, probability distributions, expectations and variances. A random variable is a function assigning one real number to each outcome in a sample space. Capital letters such as denote random variables; lowercase denotes an observed value. In the source example, and represent two independent repetitions of the three-toss experiment. Subscripts are labels; they do not by themselves imply independence.
For three coin tosses the complete sample space is , where H means heads and T means tails. Let count heads, assigning the values respectively. The Teacher note asks us to explain fair: heads and tails each have probability on an individual toss. With independent tosses, all eight sequences have probability ; independence is a separate modelling assumption.
A discrete random variable takes finitely many or at most countably infinitely many values. Draw two balls successively without replacement from four red and three black balls, and let X count reds:
| Colour outcome | RR | RB | BR | BB |
|---|---|---|---|---|
| Red count x | 2 | 1 | 1 | 0 |
R means a red ball was drawn and B means a black ball. Different outcomes can have the same numerical value; these four colour strings need not be equally likely.
Throw a fair die until the first six. Here T means a six and F means a non-six (different notation from the coin example):
| Stopped outcome | T | FT | FFT | FFFT | … |
|---|---|---|---|---|---|
| Number of throws y | 1 | 2 | 3 | 4 | … |
Under independent throws the die eventually gives a six with probability one. The source lists the finite stopped outcomes; the never-six sequence is a null event, not a finite waiting time. Discrete values need not be integers: the source’s shoe-size example includes .
Probability mass functions
Each possible value is assigned a probability. The source calls the formula a probability function, probability mass function or probability distribution (and later “probability distribution function”). We use mass function to distinguish it from the cumulative function . As emphasized in the source’s Function note, the input is a numerical value and the output is its probability. A valid law satisfies and , summed over all possible values.
For the number of heads in three independent fair tosses:
| x | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
Equivalently for , and zero elsewhere. The middle values combine three sequences each; they are not equally likely to the endpoints. Always check nonnegativity and total probability one before using a distribution.
Descriptive statistics: centre and spread
Mean, median and mode describe central tendency. Standard deviation measures spread; variance is its square and measures variability. Together these provide a descriptive summary rather than a complete account of a data set.
For an observed data list, the mode is the value occurring most often. Sort the observations in ascending or descending order to find the median: the middle observation for an odd count, or the average of the two middle observations for an even count. The source examples are:
| Data | Mode | Median |
|---|---|---|
| 1, 3, 3, 6, 7, 8, 9 | 3 | 6 |
| 1, 2, 3, 4, 5, 6, 6, 9 | 6 | |
| 1, 1, 1, 3, 4, 6, 8, 8, 8 | 1 and 8 | 4 |
For a discrete probability distribution, a mode maximizes . A median satisfies both and .
Qualify the printed parity shortcut. The source also prints for an even number of values, with and , and for an odd number.
Counting observations works for an empirical data list; counting distinct possible values of a non-uniform distribution does not determine its median. Use the two probability inequalities.
Example 7 has five possible values, yet its source answer is the midpoint of the full median interval .
When cumulative probability is exactly one half across a gap, the midpoint is a reporting convention, not the sole mathematical median.
Mean as a weighted long-run average
For data , . For a random variable with mass function , its mean or expectation is . With independent repetitions under a fixed distribution and a finite expectation, this is the long-run average interpretation. Infinite distributions require the appropriate convergence; symmetry alone does not guarantee an expectation exists.
The source scores one fair coin throw as for heads and for tails:
| x | 0 | 1 |
|---|---|---|
Repeat the experiment n times and plot the running average.
The Student copy provides blank axes; the Teacher copy completes one particular run, reproduced in the diagram below.
Its horizontal axis covers 0–100 tosses and its vertical average covers 0–1. The early averages fluctuate and later values settle near .
This one run illustrates the long-run mean ; it is not a claim that every run approaches monotonically or equals one half after a fixed number of tosses.
Constant and symmetric distributions: source proofs
If a is constant, its distribution places probability one at a:
| x | a |
|---|---|
| 1 |
Therefore .
For a finite distribution symmetric about , let . Then . With listed values, write them as . Expanding the source sum gives
Replace each negative-side probability by its equal positive-side probability. Every pair becomes , and the central term is zero, so . Since , shifting every value back by a gives . If only values are listed, insert the central value a with probability zero; the same cancellation applies. Follow the Teacher suggestion to use Example 8 to see the matching pairs explicitly.
Expectation of a function
For and mass function , , whenever the expectation exists. You may average g(x) using X’s masses without first constructing a separate Y table.
The source proof begins with n possible values:
| x | … | ||||
|---|---|---|---|---|---|
| … | |||||
| … |
Qualify the printed proof. Its assertion is valid when each image has just one preimage among the possible X values. Under that one-to-one condition, its full chain is .
For a general transformation the images may repeat, as in Example 5. Group first: . Then . This proves the same rule without the extra one-to-one restriction, while the original printed proof remains in the native transcription.
Variance describes spread around the mean
A mean locates the centre but does not describe the full shape or spread. The source’s four panels, labelled n=5,35,70,100, are reproduced below with their original histograms, red and black curves, x axes and different vertical scales. They are centred at zero but have different spreads. Compare horizontal concentration; the varying height scales are not a common probability scale. Source attribution printed in the PDF: University of Pennsylvania illustration.
For a discrete X with mean , the variance is the probability-weighted average squared distance from that mean:
The standard deviation is , taking the nonnegative square root. The source says “positive”; zero variance has standard deviation zero. These finite formulas apply when the second moment is finite.
The source’s alternative formula is . Retain every step of the proof:
The three sums in the fourth line are respectively , and . Constants have no variability: a variable equal to a with probability one has the one-column table , ; and . The source points ahead to Section 5, the appendix relating these probability-weighted formulas to the mean and variance of a frequency distribution from secondary school; use that connection to recognize the same weighted-average structure.
Linear transformations: complete source proofs
For constants a and b, if and , then and . The same choice of plus or minus is used throughout each expression. For discrete X with mass f(x), retain the expectation proof:
The last two sums are E(X) and 1 respectively. The variance proof uses that transformed mean:
The sum of squared deviations is Var(X). Adding or subtracting b cancels inside the deviation; scaling by a squares the distance multiplier. The standard deviation therefore scales by , a supplementary consequence that also handles negative a.
Calculator values: population spread and stored precision
The full seven-step Example 11 workflow enters probabilities as frequency weights. Use the population output σx and square its stored value to obtain variance. The source’s n=1 is the sum of those weights. Do not substitute the sample output Sx or retype a rounded sigma. Example 13 uses the same workflow before applying the transformation rules.
Independent observations and repeated trials
The source models an experiment repeated n times under identical conditions, such as repeated fair-die throws. X denotes one result and the respective first through nth results. They are modelled as independent and identically distributed observations of X. Identical conditions justify a common distribution in this model; independence is a separate assumption, not a consequence of the subscripts or the phrase “identical conditions”.
For n independent observations with the same finite moments, the source gives
and
The signs carry through the expectation, but all variance contributions are added. The source omits proofs because they use joint distributions and covariance, which it identifies as outside the syllabus.
Read the dependence remark as a restriction on using a rule. Even without independence, . The source prints for dependent variables. The precise statement is that adding their variances is not guaranteed; some dependent pairs can still have additive variances. The equality alone does not establish independence; its failure rules out independence when these variances exist.
Doubling one observation versus adding two independent observations
For two independent copies of X:
| Quantity | Double one observation | Add two independent observations |
|---|---|---|
| Expectation | ||
| Variance |
The source warning means these constructions are not interchangeable in general. With positive variance, their variances differ by a factor of two; a constant zero-variance case is a degenerate exception. Example 14 connects normalization and base moments to a transformation and an independent sum. Example 15 makes the independent outcome table explicit before comparing signed and absolute differences.
Appendix: from observed frequencies to a probability law
A fair die is tossed 20 times. The source data, in their original order, are:
5, 4, 5, 3, 6, 2, 1, 1, 6, 3, 3, 1, 6, 5, 1, 3, 2, 1, 3, 5.
(i) Find the mean and variance of this set of data. Method 1: use frequencies. Here denotes an observed frequency, rather than the probability-mass-function notation used earlier. Write and .
| Score | Frequency | Relative frequency | |
|---|---|---|---|
| 1 | 5 | ||
| 2 | 2 | ||
| 3 | 5 | ||
| 4 | 1 | ||
| 5 | 4 | ||
| 6 | 3 |
The source uses the variance with divisor n, not the unbiased sample-variance estimator with divisor n−1:
Equivalently, .
Method 2: use relative frequencies as an empirical probability distribution. Let be a value selected uniformly from these 20 recorded observations, so repeated scores receive their observed relative frequencies:
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| Empirical probability |
Therefore .
(ii) What happens to relative frequencies after many tosses, for example 10,000? Under repeated independent fair-die tosses, the relative frequency for each face approaches in the long-run probability model. This does not say all six counts are exactly equal after a particular finite number of tosses, or that each new toss makes the approximation better.
(iii) Connect the data calculation to expectation and variance. As n grows, the sample mean approaches the theoretical fair-die mean:
This is the sense in which the source calls expectation a limiting value of sample means. The population variance uses :
The source’s last line writes inside a variance sum weighted by the theoretical probabilities. Read this as a limiting connection: the empirical variance is , while the theoretical variance is centred at . The empirical values 3.3 and 3.21 from these 20 observations are not the true fair-die moments and . Both original copies are retained with the printed notation unchanged.