Random Variables
Learn what random variables are and how to distinguish between discrete and continuous types
Lesson Objectives
By the end of this lesson, you will be able to:
- Define random variable and explain why it's important in probability
- Distinguish between discrete and continuous random variables
- Identify examples of discrete and continuous random variables
- Use proper notation for random variables (X, x)
- Classify real-world variables as discrete or continuous
1. What is a Random Variable?
Definition: Random Variable
A random variable is a numerical variable whose value is determined by the outcome of a random experiment or chance process.
We typically use capital letters (like X, Y, or Z) to denote random variables, and lowercase letters (like x) to denote specific values.
Think of a random variable as a function that assigns a number to each outcome of a random experiment. This numerical representation allows us to use mathematical tools to analyze probability.
Example 1: Flipping a Coin Three Times
Random experiment: Flip a fair coin 3 times
Possible outcomes: HHH, HHT, HTH, HTT, THH, THT, TTH, TTT
Random variable X: The number of heads observed
Possible values of X: x = 0, 1, 2, or 3
- If outcome is TTT → X = 0
- If outcome is HTT, THT, or TTH → X = 1
- If outcome is HHT, HTH, or THH → X = 2
- If outcome is HHH → X = 3
The key insight is that X assigns a number to each outcome, transforming qualitative outcomes (H and T) into quantitative values we can analyze mathematically.
Random variables allow us to:
- Use mathematical formulas to calculate probabilities
- Find averages and measures of spread
- Make predictions about future outcomes
- Apply statistical techniques to real-world problems
2. Discrete Random Variables
Definition: Discrete Random Variable
A discrete random variable is a random variable that can take on a countable number of distinct values. You can list all possible values, even if the list is infinite.
Discrete random variables typically result from counting. The values are often whole numbers (0, 1, 2, 3, ...), though they can be any specific set of numbers.
Example 2: Discrete Random Variables
X = Number of students absent from class today
Possible values: x = 0, 1, 2, 3, ..., 30 (assuming 30 students)
Y = Number of cars passing through an intersection in one hour
Possible values: y = 0, 1, 2, 3, 4, ... (theoretically infinite but countable)
Z = Sum of two dice rolls
Possible values: z = 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
- Result from counting processes
- Take on specific, separated values (no in-between values)
- Often (but not always) whole numbers
- Can be listed: x₁, x₂, x₃, ...
- Gaps exist between possible values
3. Continuous Random Variables
Definition: Continuous Random Variable
A continuous random variable is a random variable that can take on any value within an interval or range. The possible values form a continuum with no gaps.
Continuous random variables typically result from measuring. They can take on infinitely many values within any interval, including decimal values.
Example 3: Continuous Random Variables
X = Height of a randomly selected adult (in inches)
Possible values: Any positive number, like 64.5, 68.23, 71.004, ...
Y = Time it takes to run a mile (in minutes)
Possible values: Any positive number, like 6.5, 8.234, 10.0, ...
Z = Amount of rainfall on a randomly selected day (in inches)
Possible values: Any non-negative number, like 0, 0.3, 1.25, 2.7, ...
- Result from measuring processes
- Can take on any value in an interval
- Infinitely many possible values
- No gaps between possible values
- Probability of any exact value is zero (we use ranges instead)
In this module, we focus on discrete random variables. Continuous random variables require different techniques and will be covered in later modules.
4. Discrete vs. Continuous: A Comparison
| Feature | Discrete Random Variable | Continuous Random Variable |
|---|---|---|
| Source | Counting | Measuring |
| Possible Values | Countable, distinct values | Any value in an interval |
| Gaps | Gaps between values | No gaps (continuous) |
| Examples | Number of students, dice rolls, defective items | Height, weight, time, temperature |
| Probability | P(X = specific value) can be > 0 | P(X = specific value) = 0 |
| Representation | Probability mass function (PMF) | Probability density function (PDF) |
Example 4: Practice Classifying Variables
Classify each random variable as discrete (D) or continuous (C):
- The number of text messages you receive in a day
- The exact weight of a newborn baby
- The number of defective lightbulbs in a box of 100
- The amount of time spent studying for an exam
- The number of goals scored in a soccer game
- The temperature in degrees Fahrenheit at noon
- Discrete (D) - Counting messages (0, 1, 2, ...)
- Continuous (C) - Weight is measured (6.2 lbs, 7.35 lbs, ...)
- Discrete (D) - Counting defective items (0, 1, 2, ..., 100)
- Continuous (C) - Time is measured (1.5 hrs, 2.25 hrs, ...)
- Discrete (D) - Counting goals (0, 1, 2, ...)
- Continuous (C) - Temperature is measured (72.3°F, 85.67°F, ...)
5. Notation for Random Variables
Standard Notation
- Capital letter (X, Y, Z): Denotes the random variable itself
- Lowercase letter (x, y, z): Denotes a specific value the variable can take
- P(X = x): Probability that random variable X equals specific value x
Example 5: Using Notation
Let X = number of heads when flipping a coin 3 times
- X is the random variable (the concept)
- x = 2 is one specific value X can take
- P(X = 2) means "the probability of getting exactly 2 heads"
- P(X ≤ 1) means "the probability of getting 1 or fewer heads"
Using this notation allows us to write probability statements concisely and precisely. It separates the random variable (X) from its possible values (x).
Check Your Understanding
Question 1: What is the main difference between a discrete and continuous random variable?
Answer: A discrete random variable has countable values (usually from counting), while a continuous random variable can take any value in an interval (usually from measuring). Discrete variables have gaps between possible values; continuous variables do not.
Question 2: Is the number of pages in a randomly selected book discrete or continuous? Why?
Answer: Discrete. The number of pages is a counting variable (1 page, 2 pages, 3 pages, etc.). You cannot have 2.5 pages. The possible values are whole numbers with gaps between them.
Question 3: If X represents the number of cars in a parking lot, what does P(X = 50) represent?
Answer: P(X = 50) represents the probability that there are exactly 50 cars in the parking lot. It's asking: "What is the likelihood of observing this specific value?"
Question 4: A manufacturer measures the diameter of ball bearings. Is this discrete or continuous?
Answer: Continuous. Diameter is a measurement that can take on any value within a range (e.g., 5.234 mm, 5.235 mm, 5.2351 mm, etc.). There are infinitely many possible values with no gaps.
Question 5: Can a discrete random variable have an infinite number of possible values?
Answer: Yes! A discrete random variable can have infinitely many values, as long as they're countable. For example, "number of coin flips until first heads" can be 1, 2, 3, ... infinitely, but each value is distinct and can be listed. The key is that the values are separated (countable), not that there's a finite number of them.
Summary
- A random variable assigns numerical values to outcomes of random experiments
- Discrete random variables have countable values (from counting)
- Continuous random variables can take any value in an interval (from measuring)
- We use capital letters (X) for random variables and lowercase (x) for specific values
- This module focuses on discrete probability distributions