What the heck is a random variable?
It is not a variable in the same sense that you have seen before in equations such as y = 2x + 1.
A random variable is the number of possible outcomes (in number form) which could occur from a random experiment.
Let’s unpack what that definition means. The first thing you need to understand is what a random experiment means. When someone says “let’s decide at random“, most of the time, someone will pull out a coin to decide (or if you have a cool friend who has a die in their pocket you can use that 😎). These are random experiments. Another example of a random experiment is the height of students in your class. In contrast to the coin and the die, heights of students can vary drastically, and have a wider range of possibilities. We will talk more about that later.
To sum up:
A random experiment is an experiment, trial or observation that can be repeated under the same conditions and is independent (does not depend on) any outcomes before.
Okay, so we have the “random” part down. What about the “variable”?
Random variables are usually (meaning like 99.999% of the time) denoted with capital letters. Can you guess the most common random variable? Yup, it’s X. (note, it is a capital X).
Example:
Let’s take our coin example. We can define the random variable:
X = number of heads that come up when you toss a fair coin three times.
Note: a fair coin means the coin is not biased. In other words, you have a 50% chance of getting a heads and 50% chance of getting a tails.
So when you want to calculate the probability that you get two heads after tossing the coin three times, you would write:
P(X=2)
This is the reason we care about random variables! Think about it. Which would you rather:
P(2 heads come up when you toss a fair coin 3 times) or P(X=2).
In the second case, we already defined the random variable X above, so we can calculate P(X=0), P(X=1) etc, without having to write an essay to describe what we are calculating.
Different Types of Random Variables
There are two types of random variables: discrete random variables and continuous random variables.
A discrete random variable X has a set of distinct possible values. Examples include: number of heads that come up when you toss a fair coin or the number of lollipops sold at a candy store each year.
A continuous random variable X can take infinitely many values. When talking about probabilities of continuous random variables, we consider intervals and not distinct numbers. Examples include: height of students or volume of coffee in a cup.