From events to numbers
So far, we've talked about events: "roll a 6," "draw an ace," "test positive." Now we'll start extracting numbers from random experiments.
You flip a coin 10 times. How many heads did you get? The answer could be 0, 1, 2, ..., up to 10. Each flip is random, so the count is random too. This "random count" is our first example of a random variable.
What is a random variable?
A random variable is a function that assigns a numerical value to each outcome in a sample space. We typically denote random variables with capital letters like , , .
Think of a random variable as a measurement or score you compute from the outcome of a random experiment.
Examples
| Experiment | Random Variable | Possible Values | Type |
|---|---|---|---|
| Roll a die | X = face value | 1, 2, 3, 4, 5, 6 | Discrete |
| Flip 10 coins | Y = number of heads | 0, 1, 2, ..., 10 | Discrete |
| Pick a person | H = their height | Any positive number | Continuous |
| Wait for a bus | T = waiting time | Any non-negative number | Continuous |
Discrete vs. continuous
Random variables come in two flavors:
A random variable that can only take on a countable number of values (like integers, or a finite set). You can list all possibilities.
A random variable that can take on any value in some interval. There are uncountably many possibilities.
Discrete examples: Number of emails you receive, dice rolls, coin flip counts, number of customers
Continuous examples: Height, weight, temperature, time, distance
Can you list all possible values? If yes, it's discrete. If the values form a continuous range, it's continuous.
Number of emails you receive today
The key question: Can you list all possible values? If yes, then it's discrete. If the values form a continuous range, then it's continuous.
Notation and events
When we write , we mean "the event that the random variable takes the value 3."
We can use random variables to describe events:
- : probability that equals 5
- : probability that is at most 3
- : probability that is between 2 and 7
Example: sum of two dice
Let = sum of two fair dice. The sample space has 36 equally likely outcomes. The random variable can take values 2, 3, 4, ..., 12.
Why random variables matter
Random variables let us:
- Summarize complex outcomes with a single number
- Calculate expected values, variances, and other statistics
- Model real-world quantities like measurements and counts
- Compare different random phenomena on the same scale
Functions of random variables
If is a random variable, then is also a random variable for any function .
Examples:
- If is a test score, then is the squared score
- If is temperature in Celsius, then is temperature in Fahrenheit
- If is income, then is log-income
Multiple random variables
Often we work with several random variables at once:
- = your score on exam 1, = your score on exam 2
- = height, = weight of a randomly chosen person
- = results of independent experiments
Understanding how multiple random variables relate (whether they're independent, correlated, or dependent) lets us model complex situations.
What comes next
The next few lessons cover PMFs and CDFs for fully describing a discrete random variable, Bernoulli and binomial distributions for yes/no experiments, the hypergeometric distribution for sampling without replacement, independence of random variables, and expected value.
Summary
| Concept | Meaning | Example |
|---|---|---|
| Random variable | A number determined by a random outcome | X = number of heads in 10 flips |
| Discrete | Countable possible values | Die roll: {1,2,3,4,5,6} |
| Continuous | Uncountable values in an interval | Height: any value > 0 |
| Probability that X takes value x | for dice sum | |
| Function of RV | is also a random variable | If X is temp in °C, then 9X/5+32 is °F |
A random variable turns the abstract world of sample spaces into the concrete world of numbers. This lets us use all the tools of mathematics (algebra, calculus, statistics) to understand randomness.
Test your understanding
What's next
Now that we know what random variables are, how do we describe them completely? Enter the probability mass function (PMF) and cumulative distribution function (CDF), two complementary ways to capture everything about a discrete random variable's behavior.