Sample Space
A sample space is the set of all possible outcomes of a random experiment, listed so that exactly one outcome occurs each time the experiment is run, and it is the foundation on which every probability statement is built. For a single coin toss it is {heads, tails}; for one roll of a die it is {1, 2, 3, 4, 5, 6}; for the time until a light bulb fails it is the continuous interval of all non-negative numbers. It is conventionally written S or with the Greek capital omega, and each element is called an outcome or elementary outcome. Before any probability can be assigned, the sample space has to be pinned down, because a probability is always a statement about how likely some part of this set is relative to the whole.
A sample space must be both exhaustive and mutually exclusive at the level of its outcomes: every possible result is in it, and no two outcomes can happen at once. Tossing two coins in sequence gives four outcomes (HH, HT, TH, TT), not three, and rolling two dice gives 36 ordered outcomes, not 21 unordered pairs. How finely the outcomes are described is a modeling choice, and the same real situation can have several valid sample spaces of different granularity, such as recording only the sum of two dice (11 outcomes, from 2 to 12) versus the ordered pair (36 outcomes). The coarser description loses information, and, importantly, the outcomes in it are not equally likely: a sum of 7 arises from six of the 36 ordered pairs, a sum of 2 from only one.
Choosing the wrong sample space is among the oldest and most persistent sources of probability errors. The French mathematician Jean le Rond d'Alembert famously argued in the 18th century that tossing two coins has three equally likely outcomes (two heads, one head, two tails), overlooking that the middle case combines two distinct ordered outcomes and therefore has probability 1/2, not 1/3. The same trap appears in the classic two-children puzzle, where the answer depends on whether the sample space records birth order, and in the Monty Hall problem, where a correct count of the full set of host and contestant scenarios resolves what intuition gets wrong. The lesson is that the question "what are the equally likely cases?" must be answered before counting, and that the right level of description is whichever makes the outcomes symmetric.
Sample spaces can be finite, countably infinite, or uncountable, and the type determines the mathematics that applies. A die roll has a finite space; the number of coin tosses until the first heads has a countably infinite one (1, 2, 3, ...); a measured height, waiting time or temperature has an uncountable continuum. For finite spaces with equally likely outcomes, probability reduces to counting (favorable outcomes divided by total outcomes), the classical approach worked out in the correspondence between Pascal and Fermat in 1654. For continuous spaces, each single point has probability zero and probabilities attach to intervals through a density, a distinction that required a more careful framework. That framework came in 1933 when Andrey Kolmogorov formalized probability as a triple: a sample space, a collection of allowed events (a sigma-algebra), and a probability measure on them.
Even a carefully constructed sample space can be ambiguous when the notion of "random" is not fully specified, as Bertrand's paradox shows. In 1889 Joseph Bertrand asked for the probability that a random chord of a circle is longer than the side of the inscribed equilateral triangle and obtained 1/3, 1/2 or 1/4 depending on how "random chord" is formalized: by random endpoints on the circle, by a random radius and midpoint, or by a random midpoint within the disk. Each is a legitimate sample space with a different notion of uniformity, so the problem is under-specified rather than contradictory. In practice, the same issue appears in data science as sampling frame bias: if a survey's sample space is limited to people with landlines or to users who open an app, conclusions apply only to that restricted space, not the population of interest.
Applications run from games to modern machine learning. Defining the sample space is the first step in designing a simulation, computing odds in a card game, assessing reliability of a system with several components that each work or fail, and specifying the output space of a classifier, where the set of possible class labels is the sample space of the prediction and a language model's vocabulary is the sample space for the next token. In A/B testing, the sample space of a single user visit might be {no click, click, click and purchase}, and every metric is an event within it.
Read the sample space as the complete map of what could happen: every probability is a fraction of this set, so getting its outcomes right, distinct and described at a level where they are equally likely is the step on which everything else in probability depends.