**A random variable is the mathematical function of a random experiment.**

A priori, the definition of a random variable is not very complex. It is a concept that can be defined in a sentence. However, it is more complex than appearances can indicate.

Now, in economics, as we always do, we will explain it in a frankly simple way. So, we will go by parts. What parts is the sentence made of?

## What is a random variable?

How we can verify the phrase basically consists of two concepts: mathematical function and random experiment. So this is where we should start. That is, by first understanding what a mathematical function is and, later, by defining what we mean by a random experiment.

**Mathematical function:**Put simply, it is an equation that assigns values to a variable (dependent variable) based on other variables (independent variables).**Random experiment:**It is a real life phenomenon whose results are completely random. That is, under the same initial conditions, it produces different results.

In other words, it is an equation that describes or attempts to describe the results (with a number) of an event whose results are due to chance.

### What is the point of differentiating a random variable from a random experiment?

Let’s think about the following case. We want to study whether a coin is perfect or very close to it. To do this, we are going to carry out a random experiment that consists of tossing the coin in the air and recording the result.

The possible results of the coin toss are heads and tails. We can denote them as c (heads) and + (tails). Now, we cannot operate by substituting heads and tails in the corresponding functions. What do we do to facilitate the mathematical procedure? Assign numbers:

Raraible random X: 1 if heads and 0 if tails.

By assigning it a number, we can operate mathematically. Before with signs, we could not. That is the true goal of a random variable. Convert events that we cannot mathematically operate with into numbers. Another example could be predicting whether or not it rains. If it rains 1 and if it doesn’t rain 0.

## Random variable and probability distribution

The relationship between random variable and probability distribution is very close. In fact, a probability distribution is actually the function of a random variable. That is, it is a function of a function. So we have two related but different concepts:

**Random variable:**It is a function of a random experiment.**Probability distribution:**It is a function that establishes how the probability of a random variable is distributed.

## Types of random variable

Within the random variables, there are basically two types. Its classification depends on the type of number that the mathematical function throws. A random variable can be of two types:

**Discrete random variable:**A random variable is discrete if the numbers it gives rise to are integers. The way to calculate the probabilities of a discrete random variable is through the probability function.**Continuous random variable:**A random variable is continuous in case the numbers that are not integers are in place. That is, have decimals. The probability of a given event corresponding to a continuous random variable is established by the density function.

## Example of random variable

A random variable could well be a function of the results of a die roll. It is important to distinguish three concepts here.

**Given:**It is not the random variable. The die is simply an object.**Die roll:**It is not the random variable. The throwing of a dice is the random experiment.**Dice roll results:**Yes is the random variable. It is the function that collects the results of the dice roll. An example of a random variable could be: Let a number greater than 2 come up when rolling the dice.

X: That it comes out greater than 2 when rolling the dice

Probability distribution: 1/3 does not come out greater than 2 and 2/3 if it comes out greater than 2.

That is, the probability is distributed such that the probability of a number less than or equal to 2 coming out is 1/3. Meanwhile, the probability that it comes out greater than 2 is 2/3

Therefore, our random variable will depend on the concrete result of the value of the die. The type of variable we are referring to is discrete. Why do we know? Because when we roll a die we can only get 6 possible results. All of them are integers. Specifically, between 1 and 6.