Probability theory studies uncertainty, but “uncertain” doesn’t mean unanalyzable. A probability model first lists possible outcomes, then describes how likely different outcomes are with numbers. Statistics, in turn, works backward from already-observed data to infer a model, estimate unknown parameters, or judge whether some hypothesis is credible.
Beginners often memorize combinatorics or distribution formulas directly, without clearly distinguishing samples, events, random variables, and observed values. Mixing up these concepts makes conditional probability, expectation, statistical inference, and stochastic processes hard to understand. This article first builds a vocabulary that can be reused repeatedly, then works through calculations using examples like rolling dice, quality inspection, and server requests.
1. From Random Experiments to a Probability Space
1.1 Random experiments and sample spaces
An operation whose result can’t be determined before it’s carried out can be treated as a random experiment. Typical examples include rolling a die and recording the number, drawing a product and checking whether it passes inspection, recording the number of requests a server receives in the next minute, and measuring an electronic component’s lifespan. A probability model needs to clearly define “one trial” and “the outcome to record” — a vaguely defined experiment can’t produce a well-defined probability.
The set of every possible outcome of a random experiment is called the sample space, usually written ; a single outcome in the sample space is written . The sample space of rolling a six-sided die is . When rolling two distinguishable dice, represents 36 ordered outcomes. and are different outcomes, even though both sum to 7.
A sample space can also be an infinite set. Repeatedly flipping a coin until the first heads can be represented with for the waiting count; an electronic component’s lifespan can be represented with ; a temperature curve over a period of time needs to be represented with a set of functions instead. A finite sample space is suited to counting methods, while a continuous or function-valued sample space needs tools like density, integration, and measure.
1.2 Events and set operations
An event is a subset of the sample space. When rolling a die, let represent “the number is even,” and let represent “the number is greater than 3.” The observed outcome falling within the event’s set means the event occurred.
| Set notation | Event meaning |
|---|---|
| and both occur | |
| at least one of or occurs | |
| does not occur | |
| occurs but does not | |
| and cannot occur simultaneously |
In the example above, , so “even and greater than 3” contains the numbers 4 and 6.
For a finite sample space, every subset can generally be treated as an event. In an infinite sample space, pathological sets exist that can’t be consistently assigned a probability, so a rigorous probability model specifies a family of event sets . is closed under complementation and countable union, and is called a -algebra. At an introductory level, can be understood as the collection of events the model allows you to ask about and assign a probability to.
1.3 Probability measures and the equally-likely assumption
A probability measure maps an event to a value within . Kolmogorov’s axioms require nonnegativity , normalization , and countable additivity over mutually exclusive events. The triple is called a probability space.
The axioms let us derive and . The union formula subtracts the intersection because directly adding and would double-count the intersection.
If the elementary outcomes of a finite sample space are equally likely, can be used. The 36 ordered outcomes of two fair dice are equally likely, but the sums of the two dice are not. A sum of 7 has six outcomes — — so ; a sum of 2 has only one outcome, . Treating the sums from 2 to 12 as 11 equally likely outcomes gives the wrong answer.
Counting formulas can’t be applied to a biased die, components with different failure rates, or continuous measurements. Before using combinatorics, you must first confirm that the finiteness and equally-likely assumptions actually hold.
2. Random Variables and Distributions
2.1 A random variable is a function
A random variable isn’t a symbol that changes randomly — it’s a function that maps from the sample space to a set of numbers, written . In the two-dice experiment, we can define . The elementary outcome is , and the random variable’s observed value is .
Multiple random variables can be defined on the same sample space — for example, the sum of the dice, the maximum of the two, the difference between them, or whether the first die is even. A random variable lets a researcher ignore irrelevant details of the trial and keep only the quantity the question actually cares about.
2.2 Discrete variables, continuous variables, and the CDF
A discrete random variable has finitely or countably many possible values — for example, a die roll, a request count, or a failure count. A discrete variable uses a probability mass function (PMF), .
If is the sum of two fair dice, then and . Computing the PMF requires summing over every elementary outcome that produces each possible value, and the sum of every PMF value must equal 1.
A continuous random variable usually takes values across an interval — for example, time, temperature, or voltage. A continuous variable commonly uses a probability density function (PDF), , with interval probabilities given by . The probability of a continuous variable taking any single point is usually 0; a density value can exceed 1 — what’s actually bounded within is the probability represented by the area under the curve.
Any real-valued random variable can use a cumulative distribution function (CDF), . The CDF is monotonically nondecreasing, and satisfies and . A discrete variable’s CDF looks like a staircase; if a continuous variable has a PDF, then .
3. Conditional Probability, Independence, and Bayes’ Theorem
3.1 Conditional probability narrows the sample range
Given that event has already occurred, the conditional probability of event is defined as , where . Conditional probability restricts the analysis to within , then renormalizes the probability using .
Using two fair dice as an example: let represent “the sum is 8,” and let represent “the first die is even.” Event contains 18 equally likely outcomes; the outcomes satisfying both and are , so . Without knowing the parity of the first die, a sum of 8 has five outcomes, giving . The extra piece of information changed the comparable set of outcomes, and therefore changed the event’s probability too.
The multiplication rule can be extended to multiple events. For a sequence of events , their joint probability can be decomposed into a product of successive conditional probabilities. Autoregressive models in machine learning use the same chain rule, breaking a token sequence’s joint probability into the probability of each token conditioned on the tokens before it.
3.2 Independence is a condition on the joint distribution
Events and are independent when . If , an equivalent condition is : learning that occurred doesn’t change the probability of .
Mutual exclusivity and independence have different meanings. Two mutually exclusive events, each with positive probability, cannot occur together, so , yet — mutually exclusive events are therefore not independent. Independence also can’t just be declared by intuition; it must come from the sampling design, the generating mechanism, or a testable assumption about the joint distribution.
For multiple events, pairwise independence only requires that every pair’s joint probability factors; mutual independence additionally requires that the joint probability of any subset factors. Mutual independence always implies pairwise independence, but the converse generally doesn’t hold.
3.3 The law of total probability and Bayes’ theorem
If are pairwise mutually exclusive and their union is the entire sample space, then the probability of event can be split by source: . This is called the law of total probability.
Bayes’ theorem reverses the direction of conditioning: . The numerator is made up of the likelihood and the prior probability ; the denominator sums the joint probability over every possible source, making the posterior probabilities sum to 1.
Suppose a disease has a 1% prevalence, a test has a 95% true-positive rate for patients, and a 5% false-positive rate for non-patients. Let represent having the disease, and represent a positive test. The overall probability of a positive result is , so the probability of actually having the disease given a positive result is . Even with a highly sensitive test, someone testing positive only has about a 16.1% chance of actually being sick — because there are far more non-patients than patients, and a 5% false-positive rate accumulates into a large number of positive results.
A Bayes calculation needs to keep both the base rate and the test’s conditional probability in view at the same time. Looking only at and mistaking that 95% figure for is a common mix-up of the direction of conditioning.
4. Summary: A Probability Space Is the Shared Language for Later Topics
A probability space defines the possible outcomes, the events that can be asked about, and the rules governing probability; a random variable then maps elementary outcomes into numbers that can be analyzed. The PMF, PDF, and CDF describe the distribution of a single random variable, while conditional probability, independence, and Bayes’ theorem describe how multiple events affect each other and how probability judgments get updated given new evidence. This vocabulary — sample space, event, probability measure, and random variable — is the foundation that gets reused repeatedly when later discussing comparing distributions, joint distributions, and statistical estimation.
From here, you can continue on to Stochastic Processes 1: What Is a Stochastic Process?, which extends a random variable into an indexed family of random variables; for a counting-based application, see Stochastic Processes 9: The Poisson Process.