In probability, a real-valued function, defined over the sample space of a random experiment, is called a **random variable**. That is, the values of the random variable correspond to the outcomes of the random experiment. Random variables could be either discrete or continuous. In this article, let’s discuss the different types of random variables.

A random variable’s likely values may express the possible outcomes of an experiment, which is about to be performed or the possible outcomes of a preceding experiment whose existing value is unknown. They may also conceptually describe either the results of an “objectively” random process (like rolling a die) or the “subjective” randomness that appears from inadequate knowledge of a quantity.

The domain of a random variable is a sample space, which is represented as the collection of possible outcomes of a random event. For instance, when a coin is tossed, only two possible outcomes are acknowledged such as heads or tails.

**Also, read:**

Related Links | |

Probability | Probability Mass Function |

Probability Density Function | Mean and Variance of Random Variable |

## Random Variable Definition

A random variable is a rule that assigns a numerical value to each outcome in a sample space. Random variables may be either discrete or continuous. A random variable is said to be discrete if it assumes only specified values in an interval. Otherwise, it is continuous. When X takes values 1, 2, 3, …, it is said to have a discrete random variable.

As a function, a random variable is needed to be measured, which allows probabilities to be assigned to a set of potential values. It is obvious that the results depend on some physical variables which are not predictable. Say, when we toss a fair coin, the final result of happening to be heads or tails will depend on the possible physical conditions. We cannot predict, which outcome will be noted. Though there are other probabilities like the coin could brake or lost, but such consideration is avoided.

As discussed in the introduction, there are two random variables, such as:

- Continuous Random Variable
- Discrete Random Variable

## Variate

A variate can be defined as a generalization of the random variable. It has the same properties as that of the random variables without stressing to any particular type of probabilistic experiment. It always obeys a particular probabilistic law.

- A variate is called discrete variate when that variate is not capable of assuming all the values in the provided range.
- If the variate is able to assume all the numerical values provided in the whole range, then it is called continuous variate.

## Discrete Random Variable

A discrete random variable can take only a finite number of distinct values such as 0, 1, 2, 3, 4, … and so on. The probability distribution of a random variable has a list of probabilities compared with each of its possible values known as probability mass function.

In an analysis, let a person be chosen at random, and the person’s height is demonstrated by a random variable. Logically the random variable is described as a function which relates the person to the person’s height. Now in relation with the random variable, it is a probability distribution that enables the calculation of the probability that the height is in any subset of likely values, such as the likelihood that the height is between 175 and 185 cms, or the possibility that the height is either less than 145 or more than 180 cm. Now another random variable could be the person’s age which could be either between 45 years to 50 years or less than 40 or more than 50.

## Continuous Random Variable

A numerically valued variable is said to be continuous if, in any unit of measurement, whenever it can take on the values a and b. If the random variable X can assume an infinite and uncountable set of values, it is said to be a continuous random variable. When X takes any value in a given interval (a, b), it is said to be a continuous random variable in that interval.

Formally, a continuous random variable is such whose cumulative distribution function is constant throughout. There are no “gaps” in between which would compare to numbers which have a limited probability of occurring. Alternately, these variables almost never take an accurately prescribed value c but there is a positive probability that its value will rest in particular intervals which can be very small.

## Random Variable Formula

For a given set of data the mean and variance random variable is calculated by the formula. So, here we will define two major formulas:

- Mean of random variable
- Variance of random variable

**Mean of random variable: **If X is the random variable and P is the respective probabilities, the mean of a random variable is defined by:

**Mean (μ) = ∑ XP**

where variable X consist of all possible values and P consist of respective probabilities.

**Variance of Random Variable: **The variance tells how much is the spread of random variable X around the mean value. The formula for the variance of a random variable is given by;

Var(X) = σ^{2} = E(X^{2}) – [E(X)]^{2}

where E(X^{2}) = ∑X^{2}P and E(X) = ∑ XP

## Functions of Random Variables

Let the random variable X assume the values x_{1}, x_{2}, …with corresponding probability P (x_{1}), P (x_{2}),… then the expected value of the random variable is given by:

Expectation of X, E (x) = ∑ x P (x).

A new random variable Y can be stated by using a real Borel measurable function g:R→R, to the results of a real-valued random variable X. That is, Y = f(X). The cumulative distribution function of Y is then given by:

F_{Y}(y) = P(g(X)≤y)

If function g is invertible (say h = g^{-1} )and is either increasing or decreasing, then the previous relationship can be extended to obtain:

Now if we differentiate both the sides of the above expressions with respect to y, then the relation between the probability density functions can be found:

f_{Y}(y) = f_{x}(h(y))|dh(y)/dy|

## Random Variable and Probability Distribution

The probability distribution of a random variable can be

- Theoretical listing of outcomes and probabilities of the outcomes.
- An experimental listing of outcomes associated with their observed relative frequencies.
- A subjective listing of outcomes associated with their subjective probabilities.

The probability of a random variable X which takes the values x is defined as a probability function of X is denoted by f (x) = f (X = x)

A probability distribution always satisfies two conditions:

- f(x)≥0
- ∑f(x)=1

The important probability distributions are:

- Binomial distribution
- Poisson distribution
- Bernoulli’s distribution
- Exponential distribution
- Normal distribution

### Transformation of Random Variables

The transformation of a random variable means to reassign the value to another variable. The transformation is actually inserted to remap the number line from x to y, then the transformation function is y = g(x).

**Transformation of X or Expected Value of X for a Continuous Variable**

Let the random variable X assume the values x_{1}, x_{2}, x_{3}, ..… with corresponding probability P (x_{1}), P (x_{2}), P (x_{3}),……….. then the expected value of the random variable is given by

Expectation of X, E (x) = ∫ x P (x)

### Random Variable Example

**Question: Find the mean value for the continuous random variable, f(x) = x, 0 ≤ x ≤ 2.**

**Solution:**

Given: f(x) = x, 0 ≤ x ≤ 2.

The formula to find the mean value is \(E(X)=\int_{-\infty }^{\infty }x f(x)dx\)

\(E(X)=\int_{0}^{2 }x f(x)dx\)

\(E(X)\int_{0}^{2 }x.xdx\)

\(E(X)\int_{-\infty }^{\infty }x^{2}dx\)

\(E(X)=\left (\frac{x^{3}}{3} \right )_{0}^{2}\)

\(E(X)=\left (\frac{2^{3}}{3} \right )- \left (\frac{0^{3}}{3} \right )\)

\(E(X)=\left (\frac{8}{3} \right )- \left (0\right )\)

\(E(X)=\frac{8}{3}\)

Therefore, the mean of the continuous random variable, E(X) = 8/3.

Register with BYJU’S – The Learning App to learn Math-related concepts and watch personalized videos to learn with ease.