In This Article

What is a Variable?

Categorical Variables and Numerical Variables

What is a Discrete Variable?

What is a Continuous Variable?

Are Continuous Variables Treated as Discrete Variables?

What is a Random Variable?

Discrete vs Continuous Variables

## What is a Variable?

To understand what discrete, continuous, and random variables are, you first need to know what a variable is.

In math, a variable is a quantity that can take on different values. It is a quantity that “varies.”

We typically denote variables using a lower-case or uppercase letter of the Latin alphabet, such as $a$, $b$, $X$, or $Y$. You can attach a subscript to the letter to provide more information about the variable. For example, if $h$ is a variable representing height, you might use h1 and h2 to differentiate between the height of two different people. Similarly, you could write $h_{male}$ and $h_{female}$ to differentiate between a variable that represents the heights of males and the heights of females.

##
Categorical Variables and Numerical Variables

Variables can be categorical or numerical.

Categorical — also called qualitative — variables consist of names and labels that divide data into specific categories. When you select your nationality or your race on a survey, those responses are categorical.

Numerical — also called quantitative — variables have values that can either be counted or measured. Discrete and continuous variables are specific types of numerical data.

## What is a Discrete Variable?

A discrete variable is a variable that takes on distinct, countable values. In theory, you should always be able to count the values of a discrete variable.

###
Examples

Examples of discrete variables include:

Years of schooling

Number of goals made in a soccer match

Number of red M&M’s in a candy jar

Votes for a particular politician

Number of times a coin lands on heads after ten coin tosses

All of these variables take a finite number of values that you can count. They are examples of discrete variables.

##
What is a Continuous Variable?

A continuous variable is a variable that can take on any value within a range. A continuous variable takes on an infinite number of possible values within a given range.

Because the possible values for a continuous variable are infinite, we measure continuous variables (rather than count), often using a measuring device like a ruler or stopwatch. Continuous variables include all the fractional or decimal values within a range.

###
Examples

Examples of continuous variables include:

The time it takes sprinters to run 100 meters

The size of real estate lots in a city

The weight of baby elephants

The body temperature of patients with the flu

The deployment altitude of skydivers

None of these variables are countable. Each of them could take on an infinite number of values within a range.

##
Are Continuous Variables Treated as Discrete Variables?

Sometimes we treat continuous variables as if they were discrete.

Age is an excellent example of this. If you know a person’s time of birth, you could measure their age precisely up to the second or even millisecond if you wanted to. In this sense, age is a continuous variable. However, we don’t usually care about a person’s exact age. Instead, we treat age as a discrete variable and count age in years.

## What is a Random Variable?

A random variable is a variable where the values are the outcome of a random process.

An easy example of a random variable is:

X = the number you get when you roll a die |

When you roll a die, the roll itself is a random event. The possible values of X are 1, 2, 3, 4, 5, or 6, but the specific value you get depends on the randomness of the event. It’s uncertain which number will appear on any given roll. You can learn more about events and the odds of of results when you read our article about math probability.

Random variables can be numerical or categorical, continuous or discrete.

##
Discrete vs Continuous Variables

The table below summarizes the key differences between discrete and continuous variables and provides a few more examples.

**DISCRETE VARIABLES ** | **CONTINUOUS VARIABLES** |

__Definition__- A discrete variable is a variable that takes on distinct, countable values. | __Definition__- A continuous variable is a variable that takes on any value within a range, and the number of possible values within that range is infinite. |

Discrete variables have values that are counted. | The values of a continuous variable are measured. |

__Discrete Variable Examples__ - The number of workers in an office - The number of steps you take in a day - The number of babies born each day | __Continuous Variable Examples__ - The time it takes for office employees to commute to work - The distance you walk in a day - The weight of newborn babies |

**Explore Outlier's Award-Winning For-Credit Courses**

Outlier (from the co-founder of MasterClass) has brought together some of the world's best instructors, game designers, and filmmakers to create the future of online college.

Check out these related courses:

## Intro to Statistics

How data describes our world.

## Intro to Microeconomics

Why small choices have big impact.

## Intro to Macroeconomics

How money moves our world.

## Intro to Psychology

The science of the mind.