# Random Variable: Definition, Types, How It’s Used, and Example

> **Definition**
>
> A random variable is a number whose value is unknown and can be changed to evaluate an outcome, such as the future price of a stock.

## What Is a Random Variable?

A random variable is one whose value is unknown or a function that assigns values to each of an experiment’s outcomes. Random variables are often designated by letters and can be classified as [discrete](https://www.investopedia.com/terms/d/discrete-distribution.asp) or continuous. Discrete variables have specific values. Continuous variables can have any values within a continuous range.

Random variables are often used in [econometric](https://www.investopedia.com/terms/e/econometrics.asp) or [regression](https://www.investopedia.com/terms/r/regression.asp) analysis to determine statistical relationships among each other.

### Key Takeaways

*   A random variable is a variable whose value is unknown or a function that assigns values to each of an experiment’s outcomes.
*   A random variable can be either discrete, having specific values, or continuous with any value in a continuous range.
*   The use of random variables is most common in probability and statistics, where they’re used to quantify outcomes of random occurrences.
*   Risk analysts use random variables to estimate the probability of an adverse event occurring.

![Random Variable](https://www.investopedia.com/thmb/ci7MEvtiGrPafPXESgwGEBswhnc=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/Random-Variable-Final-6dda42cdda4e4f73aa090bd6e228208b.jpg)

*The future price of a stock and the return on an investment are random variables, since they are uncertain and depend on various factors. — Xiaojie Liu / Investopedia*

## How a Random Variable Works

Random variables are used in probability and [statistics](https://www.investopedia.com/terms/s/statistics.asp) to quantify outcomes of a random occurrence, and they can therefore take on many values. They’re required to be measurable and are typically real numbers. The letter X might be designated to represent the sum of the resulting numbers after three dice are rolled. X could be 3 (1 + 1 + 1), 18 (6 + 6 + 6), or somewhere between 3 and 18 because the highest number on a dice is 6 and the lowest number is 1.

A random variable is different from an algebraic variable. The variable in an algebraic equation is an unknown value that can be calculated. The equation 10 + X = 13 shows that we can calculate the specific value for X, which is 3. A random variable has a set of values, and any of those values could be the resulting outcome, as seen in the example of the dice.

> **Important**
>
> Random variables can be assigned in the corporate world to properties such as the average price of an asset over a given time, the return on investment after a specified number of years, or the estimated turnover rate at a company within six months.

Risk analysts assign random variables to risk models when they want to estimate the probability of an adverse event occurring. These variables are presented using tools such as [scenario](https://www.investopedia.com/terms/s/scenario_analysis.asp) and [sensitivity analysis](https://www.investopedia.com/terms/s/sensitivityanalysis.asp) tables, which risk managers use to make decisions concerning risk mitigation.

## Types of Random Variables

A random variable can be either discrete or continuous.

### Discrete Random Variables

Discrete random variables take on a countable number of distinct values. Consider an experiment where a coin is tossed three times. If X represents the number of times the coin comes up heads, then X is a discrete random variable that can only have the values 0, 1, 2, or 3 from no heads in three successive coin tosses to all heads. No other value is possible.  

### Continuous Random Variables

Continuous random variables can represent any value within a specified range or interval and can take on an infinite number of possible values. An example would be an experiment that involves measuring the amount of rainfall in a city over a year or the average height of a random group of 25 people.

You’ll find that the resulting outcome is a continuous figure if Y represents the random variable for the average height of a random group of 25 people, because height can be 5 feet, 5.01 feet, or 5.0001 feet. There are an infinite number of possible values for height.  

## Example of a Random Variable

A typical example of a random variable is the outcome of a coin toss. Consider a probability distribution in which the outcomes of a random event aren’t equally likely to happen. Y could be 0, 1, or 2 if the random variable Y is the number of heads we get from tossing two coins. We could have no heads, one head, or both heads on a two-coin toss.

However, the two coins land in four different ways: TT, HT, TH, and HH. The P(Y=0) = 1/4 because we have one chance of getting no heads when the coins are tossed: two tails \[TT\]. The probability of getting two heads (HH) is also 1/4. Notice that getting one head has a likelihood of occurring twice in HT and TH. P (Y=1) = 2/4 = 1/2 in this case.

## Explain Like I’m 5 Years Old

A random variable has a [probability distribution](https://www.investopedia.com/terms/p/probabilitydistribution.asp) that represents the likelihood that any of the possible values will occur. You roll the dice once. The random variable Z is the one that shows on the top when it lands.

Z could have six possible values because the dice could land with 1, 2, 3, 4, 5, or 6 on top. They all have the same chance of coming out on top, so the probability of any one of them landing there is 1/6.

## What Are the 2 Kinds of Random Variables?

Random variables can be categorized as either discrete or continuous. A discrete random variable is a type of random variable that has a countable number of distinct values, such as heads or tails, playing cards, or the sides of dice. A continuous random variable can reflect an infinite number of possible values, such as the average rainfall in a region.

## What Is a Mixed Random Variable?

A mixed random variable combines elements of both discrete and continuous random variables.

## How Do I Identify a Random Variable?

A random variable is one whose value is unknown or one that’s assigned a random value based on a data-generating process or mathematical function.

## Why Are Random Variables Important?

Random variables produce probability distributions based on experimentation, observation, or some other data-generating process. Random variables allow us to understand the world around us based on a sample of data in this way. We know the likelihood that a specific value will occur in the real world or at some point in the future.

## The Bottom Line

Random variables are a key concept in statistics and experimentation, whether they’re discrete or continuous. They’re random with unknown exact values, so they allow us to understand the probability distribution of those values or the relative likelihood of certain events. Analysts can test hypotheses and make inferences about the natural and social world around us as a result.

> **Article Sources**
>
> 1.  Encyclopœdia Britannica. “[Random Variables and Probability Distributions](https://www.britannica.com/science/statistics/Random-variables-and-probability-distributions).”
>     
> 2.  Algebra Class. “[Understanding Algebraic Variables](https://www.algebra-class.com/algebraic-variables.html).”
>     
> 3.  Yale University, Department of Statistics and Data Science. “[Random Variables](http://www.stat.yale.edu/Courses/1997-98/101/ranvar.htm#:~:text=It%20is%20a%20function%20giving,Definition%20taken%20from%20Valerie%20J.).”