What are random variables? A random variable is a function that associates a real number with each element in a sample space. A sample space is the range of values of a random variable. In more simple terms, the random variable is the set of possible outcomes for something that you are measuring.

An example of what this is what happens when you flip a coin. You would define the random variable X to be the two possible outcomes: heads and tails. You then assign a number to each part of the random variable so that 0=heads and 1=tails. So this means that the random variable X is defined in the sample space as having the two possible outcomes 0=head and 1=tails. Another example is rolling two dice. You would define the random variable Y to have a sample space with 11 possible outcomes: numbers 2 to 12.

Random variables can be discrete or continuous. A random variable is discrete when the set of all possible outcomes are countable. A random variable is continuous when the outcomes are on a continuous scale.

A way to conceptualize this is to think of the interval [1,5]. For a discrete random variable, you can count all the numbers on the interval to make the set (1, 2, 3, 4, 5). For a continuous random variable, you can't reasonably count all the numbers on this interval [1,5] if it is on a continuous line such as in the real numbers.

A few examples of discrete variables are: the number of car sales made in a week, the number of pages in a book, and the score of a basketball game. A few examples of continuous variables are: the amount of water in a pool, the width of a field, and the height of a person.