Why Map Outcomes to Numbers?
Many experiments produce outcomes that are descriptions rather than numbers. A coin-toss experiment might produce the sequence HTT, and an inspection might produce a list of which items are defective. To use numerical summaries later, we first need a consistent way to turn each possible outcome into a number. That is the role of a random variable.
The mapping depends on the question. For three coin tosses, one variable could count the number of heads, while another could record whether the first toss was heads. Both describe the same experiment, but they assign different numbers to its outcomes. Defining the variable carefully is therefore part of defining the statistical question.
Definition: A Numerical Function on Outcomes
A probability model specifies a sample space \(\Omega\), the set of possible outcomes, together with a collection of events to which probabilities can be assigned. An individual element \(\omega\in\Omega\) is one outcome. For example, when a coin is tossed twice, an outcome might be HT: heads on the first toss and tails on the second.
In a finite sample space, any specified set of outcomes is an event, so the event condition is automatically satisfied. For more general probability models, the condition ensures that probabilities such as \(P(X=2)\) are defined. The notation \(X(\omega)\) means “the number assigned by \(X\) to outcome \(\omega\).” Once the experiment occurs, the realized value is a particular number, such as \(X(\omega)=2\).
The possible values of \(X\) are the numbers it assigns to at least one outcome. In set notation, they are
This is the collection of distinct numerical results, not the collection of outcomes themselves. Several different outcomes can map to the same value. For instance, HT and TH are different outcomes of two coin tosses, but both give one head.
A Reliable Way to Define a Variable
A useful construction has three parts: describe the experiment and its possible outcomes, state in words what you want to measure, and give a rule that assigns a number to every outcome. Then list the distinct values the rule can produce. The rule should be unambiguous: two people applying it to the same outcome should obtain the same number.
Describe what a complete result of the experiment records. Keep the description detailed enough to answer the question being asked.
State what number the variable is meant to record, such as a face value, a count, or an indicator equal to 1 when a condition holds and 0 otherwise.
Check that each possible outcome receives exactly one numerical value, then identify the distinct values that result.
Worked Example: The Score on a Fair Die
A hypothetical experiment consists of rolling one standard six-sided die. Assume the die is fair, so each face has probability \(1/6\). Define \(X\) to be the number of spots on the face that lands upward.
Outcomes and rule. The sample space is \(\Omega=\{1,2,3,4,5,6\}\). For every outcome \(\omega\), set \(X(\omega)=\omega\). Thus \(X(1)=1\), \(X(2)=2\), and so on through \(X(6)=6\).
Possible values. The set of values is \(\{1,2,3,4,5,6\}\). In this example, each outcome maps to a different number, so the variable preserves the die’s face outcome.
The probability of a numerical condition on \(X\) can be found by identifying the outcomes that meet it. For example, \(X\geq 5\) occurs for outcomes 5 and 6. Since the die is fair,
The event \(X\geq 5\) and the set of outcomes \(\{5,6\}\) are two ways to describe the same event in this model.
Different Outcomes Can Give the Same Number
A random variable often deliberately discards some details of an outcome. That is not an error: it is how a variable focuses on a particular feature of the experiment. For a count, the order or identity of the counted items may not matter once the total is known.
Worked Example: Counting Heads in Two Tosses
Suppose a hypothetical experiment consists of tossing a fair coin twice. Assume the tosses are independent, so each of the four ordered outcomes has probability \(1/4\). Define \(X\) as the number of heads. The sample space is \(\Omega=\{HH,HT,TH,TT\}\).
Apply the counting rule outcome by outcome: \(X(HH)=2\), \(X(HT)=1\), \(X(TH)=1\), and \(X(TT)=0\). The possible values are therefore \(\{0,1,2\}\). Notice that \(HT\) and \(TH\) remain different outcomes even though both map to 1.
For example, the event \(X=1\) consists precisely of the outcomes HT and TH. The outcomes are mutually exclusive, so their probabilities add:
The count \(X\) does not say which toss was heads. It records only how many heads occurred. If the question were instead whether the first toss was heads, a different variable would be needed.
Counts from an Inspection
Counting defects is another direct use of a discrete random variable. The outcome should record each item’s status if the variable is meant to count how many items are defective. For \(m\) inspected items, encode each item’s status as 1 if defective and 0 if not defective; the count is the sum of those indicators. This is a definition of the variable, not an assumption about how likely defects are.
Worked Example: Number of Defects in Four Items
Consider a hypothetical inspection of four labeled items. Assume the only recorded status for each item is defective or not defective. Represent a complete outcome by a vector \((a_1,a_2,a_3,a_4)\), where each \(a_i\) is 1 for a defective item and 0 otherwise. Define \(X\) to be the number of defective items.
The rule is
For example, if the first and third items are defective and the other two are not, the outcome is \((1,0,1,0)\), and
The smallest possible count is 0, when all four entries are 0; the largest is 4, when all four are 1. Every integer between these extremes can occur, so the possible values are \(\{0,1,2,3,4\}\). Many different vectors give the value 2: any vector with exactly two entries equal to 1 does so. No probability assumptions about defect rates or independence are needed to define this mapping.
Why Numerical Conditions Correspond to Events
A numerical statement about a random variable can be translated into a set of outcomes. For any specified set \(B\) of real numbers, the corresponding event is the set of outcomes whose assigned values belong to \(B\):
This set is often called the inverse image of \(B\) under \(X\). In ordinary language, it means “all outcomes for which the variable’s value is in \(B\).” For example, in the four-item inspection, taking \(B=\{2\}\) gives every status vector with exactly two defective items. Taking \(B=\{0,1\}\) gives all outcomes with no more than one defect.
The connection can be justified directly. By definition, \(X(\omega)\in B\) exactly when the outcome \(\omega\) receives a number in \(B\). Therefore the outcomes that make the numerical statement true are precisely the outcomes in the set above. Since that set is an event, its probability is defined, and we can write
For a single value \(c\), take \(B=\{c\}\). Then \(P(X=c)\) is the probability of all outcomes mapped to \(c\). If those outcomes are \(\omega_1,\ldots,\omega_k\) and are mutually exclusive, their probabilities add:
This explains why different outcomes that yield the same numerical value contribute together to the probability of that value. A full organization of these value-probability pairs is a separate topic; here, the key step is identifying exactly which outcomes map to the value of interest.
Common Mistakes and Why the Mapping Matters
- Treating the outcome as the variable. HT is an outcome of two tosses; the number of heads is the value assigned by \(X\). The distinction matters because several outcomes can have the same value.
- Listing outcomes as possible values. For the two-toss head count, the outcomes are HH, HT, TH, and TT, but the possible values of \(X\) are 0, 1, and 2.
- Leaving the rule vague. “Measure the defects” does not say whether to count defective items, record their locations, or assign another number. State exactly what number is assigned to every outcome.
- Assuming every number is possible. A variable’s possible values come from the outcomes and its rule. For a four-item defect count, values such as 1.5 or 5 cannot occur.
- Assuming the mapping gives probabilities by itself. The function determines which number each outcome receives. Probabilities of those values also depend on the probability model for the outcomes.
The mapping is important because it makes later numerical questions precise. Before asking about a typical value, variability, or the chance of a certain numerical result, one must know what each number represents and which outcomes produce it. Poorly chosen or ambiguously defined variables can make even correct calculations answer the wrong question.
Check Your Understanding
For each situation, identify the outcome representation, define the requested variable, and state its possible values.
- One fair six-sided die is rolled. Define \(X\) as 1 if the result is even and 0 otherwise. Which outcomes map to each value?
- Three coins are tossed. Define \(Y\) as the number of tails. What are the possible values, and which outcomes give \(Y=2\)?
- Five labeled components are checked, each recorded as defective (1) or not defective (0). Define \(Z\) as the total defect count. What is the smallest and largest possible value, and what rule defines \(Z\)?
- In two coin tosses, why do HT and TH count as different outcomes even when a head-count variable assigns both the same number?
- Suppose a variable assigns the number of defective items in a batch of four. Explain why 5 cannot be one of its possible values, regardless of the defect probabilities.