Random Variables
Recall prompts
Section titled “Recall prompts”Attempt these from memory before reading.
- What does it mean for to be a random variable? Which part is the “random” part?
- State three properties of a cumulative distribution function.
- What is the difference between a discrete and a continuous random variable?
- Name a distribution that is neither.
- What is a moment generating function, and what is it for?
Check your answers against the text. The first prompt is the one most people answer wrongly — the randomness is in and , not in .
Motivation: a random variable is not random
Section titled “Motivation: a random variable is not random”The name is a historical accident, and it causes real confusion. A random variable is a deterministic function from the sample space to the real numbers. Nothing about it is random.
The randomness lives in the outcome: roll a die and you get a number, and the number is whatever the physics gave you. The function is the bookkeeping that turns the outcome into a quantity you care about. If the outcome is “rolled a four”, then is certain once is known — it is that was uncertain.
Why measurability is the definition. Writing is shorthand for , and that set has to be in or the probability is undefined. So must be measurable: preimages of Borel sets must be events. That single requirement is the whole definition, and it is not technicality for its own sake — it is what stops you asking probability questions about sets that cannot be measured (recall the Vitali set from Probability Spaces).
Why this matters for what follows. Everything on this page — distribution functions, densities, moments — is a statement about the pushforward of by . A random variable transports probability from the sample space onto the real line, and the CDF records where it landed.
2.1 Definition and Distribution Functions
Section titled “2.1 Definition and Distribution Functions”Definition. A random variable is a measurable function . The cumulative distribution function (CDF) of is
Proposition 2.1 (Properties of the CDF).
- is non-decreasing: if Then .
- and .
- is right-continuous: .
Proof. (1) If Then So by Proposition 1.1(3).
(2) As The events decrease to So by continuity from above of probability measures, . As The events increase to So .
(3) As The events decrease to Giving right-continuity.
2.2 Discrete Random Variables
Section titled “2.2 Discrete Random Variables”A random variable is discrete if its range is countable. The probability mass function (PMF) is .
Definition (Expected Value). For a discrete random variable:
Provided the sum converges absolutely.
Definition (Variance). where .
Proposition 2.2 (Linearity of Expectation). for any random variables , and constants , .
Proof. Direct computation from the definition of expected value. For the discrete case:
2.3 Continuous Random Variables
Section titled “2.3 Continuous Random Variables”A random variable is continuous if its CDF is absolutely continuous, i.e., there exists a probability density function (PDF) such that
Key properties:
- for all .
- .
- .
- for any single point .
2.4 Common Distributions
Section titled “2.4 Common Distributions”Discrete distributions:
| Distribution | PMF | ||
|---|---|---|---|
| Bernoulli | , | ||
| Binomial | |||
| Poisson | |||
| Geometric | , |
Continuous distributions:
| Distribution | |||
|---|---|---|---|
| Uniform | on | ||
| Exponential | , | ||
2.5 The Normal Distribution
Section titled “2.5 The Normal Distribution”Definition. if has PDF .
Theorem 2.3 (Standardisation). If Then .
Proof. The CDF of : . Substituting : Which is the CDF of .
Theorem 2.4 (Moment Generating Function). If Then
Proof. . Completing the square in the exponent and evaluating the Gaussian integral gives the result.
2.6 Moment Generating Functions
Section titled “2.6 Moment Generating Functions”Definition. The moment generating function (MGF) of is (when it exists in a neighbourhood of ).
Theorem 2.5. If the MGF exists in a neighbourhood of 0, it uniquely determines the distribution. Furthermore, .
2.7 Intuition: What Is a Random Variable?
Section titled “2.7 Intuition: What Is a Random Variable?”A random variable is a function that converts uncertain outcomes into numbers, making it possible to compute averages, variances, and probabilities of numerical events. The cumulative distribution function tells you the probability that falls at or below a given value, and it completely determines the distribution of . For discrete random variables, the probability mass function gives the probability at each point. For continuous random variables, the probability density function gives the “rate” at which probability accumulates, and probabilities are computed by integrating.
Expected value is the long-run average: if you repeated an experiment infinitely many times and averaged the results, the expected value is what you would converge to. Variance measures spread around the mean. The normal distribution is special because the central limit theorem shows that sums of many independent random variables, regardless of their original distribution, tend toward a normal distribution. Moment generating functions encode all moments of a distribution into a single function, and they convert the hard operation of convolution (adding independent random variables) into the easy operation of multiplication.
2.8 Worked Examples
Section titled “2.8 Worked Examples”Problem. Let and be independent. Find the distribution of .
Solution
The MGF of is .
.
This is the MGF of . Since the MGF uniquely determines the distribution, .
Worked Example: Minimum of Exponential Random Variables
Solution. Let be independent with . Find the distribution of .
So where . This means .
Counterexamples worth knowing by name
Section titled “Counterexamples worth knowing by name”| Distribution | CDF | Density? | MGF near 0? | The point |
|---|---|---|---|---|
| Bernoulli | step | no (atoms) | yes | the discrete case |
| Normal | smooth | yes, | yes | the continuous case everyone knows |
| Cantor | continuous | no | diverges | neither discrete nor continuous |
| Cauchy | smooth | yes, | no | a density with no moments |
| (point mass) | step at 0 | no | yes | degenerate but legal |
The Cantor distribution is the one to remember. Take uniform on the Cantor set: its CDF is the Cantor function, which is continuous everywhere and constant on the complement of the Cantor set. So is not discrete — it takes uncountably many values — and not continuous — there is no density with respect to Lebesgue measure. It is singular, and it is the reason the discrete/continuous dichotomy is a simplification rather than a theorem.
The Cauchy is the one that bites in practice. It has a perfectly good density, so it is a legitimate continuous random variable, and its moment generating function does not exist in any neighbourhood of zero because the moments themselves are infinite. Any argument that starts “take the MGF of…” silently assumes the moments exist. That assumption fails for the most famous heavy-tailed distribution in statistics.
Common Mistakes
Section titled “Common Mistakes”Mistake 1: Confusing with . The conditional probability is not the same as . These are equal only when . A common error is to assume that if is high, then is also high. This is the basis of the prosecutor’s fallacy.
Mistake 2: Assuming that independence implies uncorrelatedness. If two random variables and are independent, then they are uncorrelated (their covariance is zero). However, the converse is not true: uncorrelated variables can be dependent. For example, let be uniform on and . Then and are uncorrelated but not independent.
Mistake 3: Forgetting Bayes’ theorem. Bayes’ theorem states that . A common mistake is to ignore the prior and the evidence , leading to incorrect updates of probabilities. Always use the full form of Bayes’ theorem when updating beliefs based on new evidence.
Mistake 4: Confusing the expectation of a product with the product of expectations. holds only when and are independent (or uncorrelated). as a rule, . Do not assume that the expectation of a product factors without checking independence.
Mistake 5: Forgetting that variance is not linear. , not . The variance of a sum is . If and are independent, then , but this does not hold as a rule.
Cross-References
Section titled “Cross-References”Probability Spaces: Probability spaces provide the foundational framework for defining random variables and their distributions.
Joint Distributions and Independence: Joint distributions describe the behavior of multiple random variables simultaneously.
Limit Theorems: The central limit theorem shows that sums of random variables converge to normal distributions.