"

4.1 Random Variables

LEARNING OBJECTIVES

  • Describe a random variable.
  • Identify discrete or continuous random variables.

Previously, we learned about probability experiments and the possible outcomes of the experiment (the sample space). For example, flipping a coin two times is an experiment, and the possible outcomes of that experiment are [latex]\{HH, HT, TH, TT\}[/latex]. We also learned how to calculate probabilities associated with the outcomes of the experiment. In the case of flipping a coin two times, the probability of getting two heads is [latex]25\%[/latex].

Instead of listing the outcomes of the experiment, we want to associate numerical values with the outcomes of an experiment. For the flipping the coin two times experiment, we can associate the number of heads we get on the two flips with the outcomes in the sample space:  two heads is associated with the outcome [latex]HH[/latex], one head is associated with the outcomes [latex]HT[/latex] and [latex]TH[/latex], and zero heads is associated with the outcome [latex]TT[/latex]. In this way, we can assign a numerical value to the outcomes of the experiment. This numerical description of the outcomes of an experiment is called a random variable.

A random variable is a numerical description of the outcomes of an experiment.   Each possible outcome of an experiment is associated with a numerical value based on the random variable. The numerical values the random variable takes on depends on how the variable is defined and the outcomes of the experiment. The values of a random variable can vary with each repetition of an experiment. Upper case letters such as [latex]X[/latex] or [latex]Y[/latex] denote a random variable. Lowercase letters like [latex]x[/latex] or [latex]y[/latex] denote the value of a random variable. If [latex]X[/latex] is a random variable, then [latex]X[/latex] is written in words, and [latex]x[/latex] is given as a number. For example, if [latex]X[/latex] is the number of children in a family, then [latex]x[/latex] represents a specific integer [latex]0, 1, 2, 3,....[/latex].

EXAMPLE

Suppose a coin is tossed three times. Define a random variable for this experiment. List all the possible values of the random variable.

Solution

Define the random variable [latex]X[/latex] as the number of tails when a coin is tossed three times.

The sample space for this experiment is [latex]\{TTT, THH, HTH, HHT, HTT, THT, TTH, HHH\}[/latex]. Then the possible values of the random variable are [latex]x = 0, 1, 2, 3[/latex]. Here, [latex]x=0[/latex] corresponds to getting exactly zero tails on the three flips (i.e. the outcome [latex]HHH[/latex]), [latex]x=1[/latex] corresponds to getting exactly one tail on the three flips (i.e. the outcomes [latex]THH, HTH, HHT[/latex]), [latex]x=2[/latex] corresponds to getting exactly two tails on the three flips (i.e. the outcomes [latex]THH, HTH, HHT[/latex]), and [latex]x=3[/latex] corresponds to getting exactly three tails on the three flips (i.e. the outcome [latex]TTT[/latex]).

NOTES

  1. The random variable [latex]X[/latex] is described in words, and the values of [latex]x[/latex] are numbers.
  2. All of the outcomes in the sample space are associated with a value of [latex]x[/latex].
  3. Instead of the number of tails in the three flips, another way to define a random variable for this experiment is the number of heads in the three flips.

TRY IT

Suppose a six-sided die is rolled a single time. Define a random variable for this experiment. List all possible values of the random variable.

 

Click to see Solution

 

Define the random variable [latex]X[/latex] as the number on the top face of the die. The possible values of the random variable are [latex]x = 1, 2, 3, 4, 5, 6[/latex].

Variables in statistics differ from variables in intermediate algebra in the two following ways:

  • The values a random variable can take on are not necessarily numbers. The values may be expressed in words. For example, if [latex]X[/latex] is hair colour, then the values of the random variable are {black, blond, grey, brown, red}.
  • We can tell what specific value, [latex]x[/latex], the random variable [latex]X[/latex] takes only after performing the experiment.

Discrete Random Variables

A random variable that only takes on certain numerical values is called a discrete random variable. For example, the random variable defined as the number of heads obtained in two flips of a coin is a discrete random variable because the random variable can only take on the values [latex]0[/latex], [latex]1[/latex], and [latex]2[/latex].

EXAMPLE

Consider the experiment of orders taken at a restaurant drive-thru window in a single day. Define a random variable for this experiment. List all possible values of the random variable.

Solution

Define the random variable [latex]X[/latex] as the number of orders taken at the drive-thru window during a one-day period. The possible values of the random variable are [latex]x = 0, 1, 2, 3, 4, \ldots[/latex].

NOTES

This is a discrete random variable because the random variable can only take on a value from the numbers [latex]0, 1, 2, 3, \ldots[/latex]. The random variable is a count of the number of orders, and so must be a non-negative whole number. For example, the random variable cannot take on the value of [latex]20.73[/latex] because it is not possible to take [latex]20.73[/latex] orders at the drive-thru window.

Continuous Random Variables

A random variable that takes on any numerical value in an interval or a collection of intervals is called a continuous random variable. Examples of continuous random variables are random variables associated with measurements, such as time, weight, height, or distance. For example, the random variable defined as the height of students in a class is a continuous random variable because the height of a student may taken on any positive number.

EXAMPLE

Consider the experiment of measuring the mass of a package shipped by the post office. Define a random variable for this experiment. List all possible values of the random variable.

Solution

Define the random variable [latex]X[/latex] as the mass of a package. The random variable may take on any non-negative number.

NOTES

This is a continuous random variable because the random variable can take on any number greater than or equal to [latex]0[/latex].

NOTE

The values of discrete and continuous random variables can be ambiguous. For example, if [latex]X[/latex] is equal to the number of miles (to the nearest mile) you drive to work, then [latex]X[/latex] is a discrete random variable because you count the miles. If [latex]X[/latex] is the distance you drive to work, then [latex]X[/latex] is a continuous random variable because you measure the miles. For a second example, if [latex]X[/latex] is equal to the number of books in a backpack, then [latex]X[/latex] is a discrete random variable because the number of books is a count. If [latex]X[/latex] is the weight of a book, then [latex]X[/latex] is a continuous random variable because weights are measured. How the random variable is defined is very important.

TRY IT

Consider the experiment of preparing tax returns in an accounting office. Define a random variable for this experiment. List all possible values of the random variable. Identify the random variable as discrete or continuous.

 

Click to see Solution

 

Here are a couple of possible answers, depending on what we want the random variable to measure.

  1. Define the random variable [latex]X[/latex] as the time it takes to prepare a tax return. The random variable may take on any non-negative number. This is a continuous random variable.
  2. Define the random variable [latex]Y[/latex] as the number of tax returns the office can prepare in a day. The possible values of the random variable are [latex]y = 0, 1, 2, 3, 4, \ldots[/latex]. This is a discrete random variable.
  3. Define the random variable [latex]Z[/latex] as the amount of money owning on a tax return. The random variable may take on any possible dollar amount. This is a discrete random variable because the random variable cannot take on values such as [latex]12.37563[/latex].

Exercises

  1. A baker is deciding how many batches of muffins to make to sell in his bakery. He wants to make enough to sell every one and no fewer.
    1. Define a random variable for this experiment.
    2. List the possible values of the random variable.
    3. Is the random variable discrete or continuous?
    Click to see Answer
    1. The number of batches of muffins the baker needs to make.
    2. [latex]0, 1, 2, 3, \ldots[/latex]
    3. Discrete.

     

  2. A meteorologist monitors the temperature at the airport each day.
    1. Define a random variable for this experiment.
    2. List the possible values of the random variable.
    3. Is the random variable discrete or continuous?
    Click to see Answer
    1. The temperature at the airport on any given day.
    2. Any possible number.
    3. Continuous.

     

  3. Ellen is supposed to practice her music three days a week.
    1. Define a random variable for this experiment.
    2. List the possible values of the random variable.
    3. Is the random variable discrete or continuous?
    Click to see Answer
    1. The number of times Ellen practices each week.
    2. [latex]0, 1, 2, 3[/latex]
    3. Discrete.

     

  4. An IT helpdesk monitors the time a worker spends with a client on a call.
    1.  Define a random variable for this experiment.
    2. List the possible values of the random variable.
    3. Is the random variable discrete or continuous?
    Click to see Answer
    1. The amount of time, in minutes, the worker spends on a call.
    2. Any non-negative number.
    3. Continuous.

     

  5. Javier volunteers in community events each month. He does not do more than five events in a month.
    1.  Define a random variable for this experiment.
    2. List the possible values of the random variable.
    3. Is the random variable discrete or continuous?
    Click to see Answer
    1. The number of events Javier does in a month.
    2. [latex]0, 1, 2, 3, 4, 5[/latex].
    3. Discrete.

     

  6. A quality control expert monitors the volume of paint in 4-litre paint cans on an assembly line. The quality control expert randomly selects a paint can off of the assembly line to check its volume
    1. Define a random variable for this experiment.
    2. List the possible values of the random variable.
    3. Is the random variable discrete or continuous?
    Click to see Answer
    1. The number of litres of paint in the paint can.
    2. Any non-negative number.
    3. Continuous.

     


4.1 Introduction to Discrete Random Variables“, “5.1 Introduction to Contiuous Random Varibles“, and “4.6 Exercises” from Introduction to Statistics by Valerie Watts is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, except where otherwise noted.

License

Icon for the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License

Introduction to Statistics - Second Edition Copyright © 2025 by Valerie Watts is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, except where otherwise noted.

Share This Book