# Random Variables: Discrete and Continuous

Benjamin Mayhew, Rudranath Beharrysingh
• Author
Benjamin Mayhew

Ben has tutored math at multiple levels for over three years and developed graduate-level biostatistics course materials. He holds an MS in biostatistics focusing on data science and spatial statistics and a sustainable horticulture certificate from the University of Minnesota. He received his BA in mathematics from Macalester College. He also is TEFL certified and tutors ESL students in his spare time.

• Instructor
Rudranath Beharrysingh

Rudy teaches math at a community college and has a master's degree in applied mathematics.

Understand what is a random variable and why it is used. Learn about the types of random variables and see examples of the random variables from everyday life. Updated: 12/10/2021

Show

## Random Variable Definition

A random variable, also known as a stochastic variable, means a collection of possible outcomes and their corresponding probabilities. In practical use, the meaning of random variable can be intuitively understood to be a variable that may take on different values randomly but whose value is not known.

More specifically, random variable definition

is as a set of possible outcomes, called a sample space, along with a probability distribution function that assigns specific outcomes or groups of outcomes to numbers between 0 and 1 that represent probabilities.

The outcome can represent an event that will happen in the future, like the result of rolling a 6-sided dice. In this example, the sample space is the set of integers from 1 to 6, with each integer corresponding to one side of the dice. For a fair dice, the probability of each of these outcomes is 1/6.

A random variable does not necessarily need to represent something that will happen in the future. A random variable can also represent a quantity that already exists but for which the precise value is unknown. For example, in a doctor's office, the systolic blood pressure of the next patient to be treated could be seen as a random variable. Now, the patient has some particular systolic blood pressure, but it is not precisely known until measured.

### Sample Space Examples

Consider the example of rolling six-sided dice. The sample space S is a finite set of six integers:

{eq}S_\text{dice roll} = \{1,2,3,4,5,6\} {/eq}

In the blood pressure example above, the sample space is the set of nonnegative real numbers because blood pressure is measured as a single real number and cannot be negative:

{eq}S_\text{blood pressure} = \{x \in \mathbb{R} \mid x\geq 0\} {/eq}

Finally, consider flipping a coin repeatedly until it first comes up heads. The random variable representing the number of coin flips required to get heads has a sample space that is all of the positive integers (the natural numbers):

{eq}S_\text{flip coin until heads} = \{x \mid x \in \mathbb{N} \} = \{1,2,3, \ldots \} {/eq}

An error occurred trying to load this video.

Try refreshing the page, or contact customer support.

Coming up next: Finding & Interpreting the Expected Value of a Discrete Random Variable

### You're on a roll. Keep up the good work!

Replay
Your next lesson will play in 10 seconds
• 0:04 What Is a Random Variable?
• 1:06 Discrete Random Variables
• 2:50 Continuous Random Variables
• 4:39 Probabilities Range…
• 5:36 Sum of Probabilities…
• 8:39 Lesson Summary
Save Save

Want to watch this again later?

Timeline
Autoplay
Autoplay
Speed Speed

## Types of Random Variable

There are two types of random variables: discrete random variables and continuous random variables. Random variables are classified as discrete or continuous based on whether the sample space is countable or uncountable.

Discrete and continuous random variables are different in that, for a discrete random variable, each outcome in the sample space has an associated probability, while for a continuous random variable, each outcome instead has a probability density and probabilities are instead assigned to ranges of outcomes.

## What is a Discrete Random Variable?

A discrete random variable is defined as a random variable for which the sample space is countable. A countable sample space is one that has either a finite number of outcomes, like rolling a six-sided dice, or has a countably infinite number of outcomes. An infinite sample space is countably infinite when it's possible to assign a natural number (a positive integer) to each outcome.

### Discrete Random Variable Example

In the example above, where a coin is repeatedly flipped until heads come up, the sample space of the number of flips this takes is countably infinite, and therefore this random variable is classified as discrete according to the definition of a discrete random variable.

For a discrete random variable, every outcome in the sample space has an associated probability, and the random variable as a whole can be described using a probability distribution function in the form of a histogram.

The probability distribution function P gives the specific probabilities of the different outcomes. The probability that a person gets heads on the first coin flip is 1/2, so this means that P(1) = 1/2, as shown in this histogram.

The probability that it takes two coin flips in getting first heads is equal to the probability of getting tails on the first flip and getting heads on the second; that is, the probability is {eq}\frac{1}{2} \times \frac{1}{2} = \frac{1}{4}{/eq}. Likewise, the probability that they get the first heads on the {eq}n^{\text{th}} {/eq} coin flip is {eq}\frac{1}{2^n} {/eq}. Note that the sum of all of the probabilities in the probability distribution function is always 1.

## What is a Continuous Random Variable?

A continuous random variable is defined as a random variable for which the sample space is uncountable. Usually, this means that the random variable can take on values from a range of real numbers. One example could be a person's systolic blood pressure. This is measured as a positive real number, and a typical value is approximately 120 mmHg.

To unlock this lesson you must be a Study.com Member.

#### What is random variable and its types?

A random variable is a function that associates certain outcomes or sets of outcomes with probabilities. Random variables are classified as discrete or continuous depending on the set of possible outcomes or sample space.

#### How to identify a random variable?

A variable is a random variable when it is meant to represent the outcome of some random event. Usually, it is denoted by a capital letter, like X or Y.

### Register to view this lesson

Are you a student or a teacher?