The Central Idea
A random variable is a numerical function defined on the outcomes of a random experiment.
If the sample space is \(S\), a random variable \(X\) assigns a real number \(X(\omega)\) to each outcome \(\omega\in S\):
\[ \boxed{X:S\to\mathbb{R}}. \]The word random describes how the underlying outcome is produced. Once an outcome occurs, the value assigned by \(X\) is determined.
From Outcomes to Numbers
Suppose two fair coins are tossed. The sample space is
\[ S=\{HH,HT,TH,TT\}. \]Define \(X\) to be the number of heads observed. Then
\[ X(HH)=2,\qquad X(HT)=1,\qquad X(TH)=1,\qquad X(TT)=0. \]The random variable replaces the detailed outcomes with the numerical feature we want to study.
The Random Variable Is Not the Outcome
The outcome and the value of a random variable are different objects.
In the two-coin experiment, \(HT\) is an outcome. The number
\[ X(HT)=1 \]is the value assigned to that outcome by the random variable \(X\).
Different outcomes may produce the same value of a random variable. Both \(HT\) and \(TH\), for example, give \(X=1\).
Why Random Variables Are Useful
Random variables translate probability questions into numerical form. Instead of asking about every underlying outcome separately, we can study quantities such as:
- the number of defective items in a shipment;
- the waiting time until a customer arrives;
- the amount of rainfall during a day;
- the number of goals scored in a match;
- the lifetime of a component;
- the return on an investment over a specified period.
Once a numerical quantity has been defined, probability can be organized around the values that quantity may take.
Possible Values of a Random Variable
The set of values a random variable can take is sometimes called its support or its set of possible values, depending on the context and level of detail required.
For the number of heads in two coin tosses,
\[ X\in\{0,1,2\}. \]The sample space contains four outcomes, but the random variable has only three possible values.
Two Major Types
At this level, random variables are organized into two major categories:
- discrete random variables, whose possible values can be counted;
- continuous random variables, whose possible values fill intervals or other continuous ranges.
This distinction determines how probabilities are assigned and how the corresponding distributions are represented.
Discrete Random Variables
A discrete random variable has a finite or countably infinite set of possible values.
Typical examples are counts:
- number of customers entering a store;
- number of correct answers on a test;
- number of machine failures in a week;
- number of attempts required before success;
- number of children in a household.
The values occur as separate possibilities rather than as every value in an interval.
Finite Discrete Random Variables
Some discrete random variables have only finitely many possible values.
If \(X\) is the number shown on a standard six-sided die, then
\[ X\in\{1,2,3,4,5,6\}. \]There are exactly six possible values, so \(X\) is discrete.
Countably Infinite Random Variables
A discrete random variable does not need to have a finite range.
Suppose \(X\) is the number of coin tosses required to obtain the first head. Then
\[ X\in\{1,2,3,4,\ldots\}. \]There is no fixed largest possible value, but the possibilities can still be listed in sequence. Therefore \(X\) is discrete.
Discrete Does Not Mean Small
A common misconception is that a variable is discrete only when it has a small number of possible values.
A count such as the number of website visits during a year may take millions of possible integer values and still be discrete. The key issue is not whether there are many values, but whether the values are separated and countable.
Continuous Random Variables
A continuous random variable can take values throughout a continuous interval or collection of intervals.
Typical examples include measurements such as:
- time;
- distance;
- mass;
- temperature;
- voltage;
- speed;
- concentration.
Between two possible values, additional possible values are generally available.
Example: Waiting Time
Suppose \(T\) is the waiting time, in minutes, for a bus.
A model might allow any value from \(0\) to \(15\):
\[ 0\le T\le 15. \]Values such as
\[ 2,\qquad 2.5,\qquad 2.51,\qquad 2.517,\qquad \ldots \]may all be possible. The set of modeled values is therefore continuous.
Count Versus Measurement
A useful first test is to ask whether the variable is fundamentally a count or a measurement.
- Counts are usually discrete.
- Measurements are usually continuous.
This is a practical guideline rather than a substitute for checking the actual set of possible values.
Example: Number of Customers
Let \(X\) be the number of customers who enter a store between noon and 1:00 p.m.
Possible values are
\[ 0,1,2,3,\ldots \]A value such as \(4.7\) customers is not possible. Therefore \(X\) is discrete.
Example: Customer Waiting Time
Let \(T\) be the amount of time a customer waits before service begins.
In an idealized model, \(T\) may take any nonnegative real value:
\[ T\ge 0. \]Since the variable is measured on a continuum rather than counted in whole units, \(T\) is continuous.
The Same Situation Can Produce Different Random Variables
One experiment may support several different random variables.
During a one-hour observation at an airport, we might define:
- \(X=\) number of arriving aircraft;
- \(Y=\) delay time of a selected aircraft;
- \(Z=\) number of passengers on that aircraft.
Here \(X\) and \(Z\) are naturally discrete, while \(Y\) is naturally continuous.
Notation for Random Variables
Random variables are commonly written with capital letters such as \(X\), \(Y\), \(Z\), or \(T\).
Particular numerical values are commonly written with lowercase letters such as \(x\), \(y\), \(z\), or \(t\).
For example,
\[ P(X=3) \]means the probability that the random variable \(X\) takes the value \(3\).
Events Defined by Random Variables
A numerical condition on a random variable defines an event.
Examples include
\[ X=2, \] \[ X\le 4, \] \[ 3Each statement identifies the outcomes for which the random variable meets the stated condition.
Example: Translating an Event
Toss three coins and let \(X\) be the number of heads.
The event
\[ X=2 \]consists of the outcomes
\[ \{HHT,HTH,THH\}. \]Random-variable notation gives a compact numerical description of a collection of underlying outcomes.
Probability at a Single Discrete Value
A discrete random variable may assign positive probability to an individual value.
For a fair die,
\[ P(X=4)=\frac16. \]The point \(X=4\) itself carries positive probability.
Probability at a Single Continuous Value
In a continuous model, the probability of any exact single value is zero:
\[ \boxed{P(X=x)=0}. \]This does not mean the value is impossible. It means probability is assigned to intervals rather than to isolated points.
For a continuous random variable, quantities such as
\[ P(aWhy a Single Continuous Value Has Probability Zero
A continuous interval contains infinitely many possible values. Probability is spread across the interval rather than concentrated at individual points.
For example, if a waiting time can vary continuously between \(0\) and \(10\) minutes, the probability of waiting exactly
\[ 4.000000\ldots \]minutes is zero in the mathematical model, even though waiting times near \(4\) minutes may collectively have substantial probability.
Endpoints Do Not Matter for Continuous Probabilities
Because individual points have probability zero for a continuous random variable,
\[ P(aRecorded Data May Look Discrete
A continuous quantity can appear discrete after measurement or rounding.
Suppose a scale reports mass to the nearest \(0.1\) kilogram. The recorded values may look like
\[ 62.3,\qquad 62.4,\qquad 62.5,\qquad\ldots \]but the underlying physical quantity may still be modeled as continuous. The apparent discreteness comes from the measurement device or reporting rule.
Discrete Models Can Approximate Continuous Quantities
Sometimes a continuous quantity is intentionally divided into bins or intervals.
For example, age might be recorded only as completed years:
\[ 18,19,20,\ldots \]The recorded variable is discrete even though physical age changes continuously with time.
The classification depends on the variable as it is actually defined in the model.
Mixed and More Advanced Cases
Not every random variable is purely discrete or purely continuous. Some probability models combine point probabilities with continuous ranges.
Those mixed distributions are important in more advanced probability, but the central distinction developed here remains essential: probability may be concentrated on countable points, spread continuously across ranges, or use both mechanisms.
Random Variables and Units
A random variable should be defined together with its meaning and, when relevant, its units.
Compare:
- \(X=\) number of failed components;
- \(T=\) operating time in hours;
- \(D=\) distance traveled in kilometers.
Units matter because they determine how values are interpreted and prevent numerical answers from becoming detached from the modeled quantity.
Random Variables Depend on Modeling Choices
Whether a variable is discrete or continuous is determined by the model, not merely by the real-world object being studied.
Suppose a machine's lifetime is recorded in completed days. The recorded value may be discrete:
\[ X\in\{0,1,2,\ldots\}. \]If lifetime is modeled as elapsed time measured continuously, then a continuous variable is more appropriate.
A Reliable Classification Procedure
- Define exactly what numerical quantity the random variable represents.
- List or describe the values it can take.
- Ask whether those values are countable and separated.
- If they are countable, classify the variable as discrete.
- If the values fill an interval or continuous range, classify the variable as continuous.
- Check whether rounding, measurement precision, or recording rules are affecting the apparent form of the data.
Example: Classifying Several Variables
Consider the following quantities:
- number of emails received during an hour;
- time required to download a file;
- number of defective bulbs in a box;
- temperature at noon;
- distance from a randomly selected point to a fixed location.
Their natural classifications are:
- discrete;
- continuous;
- discrete;
- continuous;
- continuous.
Common Error: Treating Every Numerical Variable as Continuous
Being numerical does not make a variable continuous.
The number of children in a household is numerical, but values such as \(2.4\) children are not possible for the count itself.
Therefore the variable is discrete.
Common Error: Treating Every Decimal as Continuous
Decimal notation does not determine whether a random variable is continuous.
A variable could take only the values
\[ \{0.0,0.5,1.0,1.5,2.0\}. \]Even though the values are written as decimals, the set is finite and therefore discrete.
Common Error: Treating Every Integer-Valued Measurement as Discrete
A measurement may be rounded to integers even when the underlying model is continuous.
If a person's height is reported to the nearest centimeter, the recorded data use integer centimeter values, but height itself is naturally modeled on a continuous scale.
Always distinguish the underlying quantity from the way it is recorded.
Common Error: Confusing Probability with the Variable Value
The value \(X=3\) and the probability \(P(X=3)\) are different quantities.
The statement
\[ X=3 \]describes a possible value or event, while
\[ P(X=3) \]is a number between \(0\) and \(1\) describing the probability of that event.
Common Error: Assuming Continuous Means Infinite and Discrete Means Finite
Both discrete and continuous random variables may have infinitely many possible values.
The difference is the structure of those values:
- a countably infinite list such as \(1,2,3,\ldots\) is discrete;
- an interval such as \([0,1]\) is continuous.
Practice 1: Coin Tosses
Three coins are tossed. Let \(X\) be the number of tails.
State the possible values of \(X\) and classify the random variable.
Practice 2: Waiting Time
Let \(T\) be the waiting time, in seconds, until the next customer enters a store.
Classify \(T\) as discrete or continuous.
Practice 3: Defective Items
A box contains \(20\) manufactured parts. Let \(X\) be the number of defective parts in the box.
State the possible values of \(X\) and classify the variable.
Practice 4: Temperature
Let \(T\) be the actual air temperature at a specified location and time.
Is \(T\) naturally modeled as discrete or continuous?
Practice 5: Rounded Temperature
A weather station records temperature only to the nearest whole degree.
Explain the difference between the recorded data and the underlying temperature variable.
Practice 6: Translate an Event
Four coins are tossed, and \(X\) is the number of heads.
Describe in words the event
\[ X\ge 3. \]Practice 7: Identify the Type
Classify each random variable.
- Number of calls received by a help desk in one day.
- Duration of a phone call.
- Number of goals in a soccer match.
- Mass of a randomly selected package.
Practice 8: Exact Continuous Value
Suppose \(X\) is a continuous random variable. What is
\[ P(X=5)? \]Practice 9: Endpoint Comparison
Suppose \(X\) is continuous. Compare
\[ P(2Practice 10: Model Definition
A machine's operating lifetime is measured continuously, but a maintenance database stores only the number of completed hours.
Identify which quantity is continuous and which recorded quantity is discrete.
Practice Answers
Practice 1
The possible values are
\[ \boxed{X\in\{0,1,2,3\}}. \]The variable is discrete because it is a count with finitely many possible values.
Practice 2
Waiting time is naturally measured on a continuum, so \(\boxed{T\text{ is continuous}}\).
Practice 3
The number of defective parts may be
\[ \boxed{X\in\{0,1,2,\ldots,20\}}. \]The variable is discrete.
Practice 4
Actual temperature is naturally modeled as \(\boxed{\text{continuous}}\).
Practice 5
The underlying temperature may vary continuously, but recording only whole degrees produces a discrete set of reported values.
Practice 6
The event \(X\ge3\) means that at least three of the four tosses are heads. Equivalently, the experiment produces either three heads or four heads.
Practice 7
- Discrete.
- Continuous.
- Discrete.
- Continuous.
Practice 8
For a continuous random variable,
\[ \boxed{P(X=5)=0}. \]Practice 9
They are equal:
\[ \boxed{P(2Practice 10
The actual elapsed lifetime is continuous. The stored number of completed hours is discrete because it takes integer values.
What to Remember
A random variable assigns a numerical value to each outcome:
\[ \boxed{X:S\to\mathbb{R}}. \]- A discrete random variable has a finite or countably infinite set of possible values.
- A continuous random variable varies across an interval or other continuous range.
- Counts are usually discrete; measurements are usually continuous.
- For a discrete random variable, an individual value can have positive probability.
- For a continuous random variable, \(P(X=x)=0\) for every single value \(x\).
- The classification depends on how the random variable is defined, not merely on how data are displayed or rounded.
The most important question is: what values can this random variable actually take in the model?
Where We Go Next
Classifying a random variable tells us what kind of probability structure we need, but it does not yet specify how probability is distributed among the possible values.
The next lesson, Probability Mass and Density Functions, develops the two principal ways of describing probability distributions for discrete and continuous random variables.