Random Variable

What is Random Variable in Statistics?

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.

Table of Contents:

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:

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. We generally denote the random variables with capital letters such as X and Y. 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 break or be lost, such consideration is avoided.


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.

Types of Random Variable

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

  • Discrete Random Variable
  • Continuous Random Variable

Let’s understand these types of variables in detail along with suitable examples below.

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 cm, 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 consists 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(X2) – [E(X)]2

where E(X2) = ∑X2P and E(X) = ∑ XP

Functions of Random Variables

Let the random variable X assume the values x1, x2, …with corresponding probability P (x1), P (x2),… 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:

FY(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:

Functions of Random Variables

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:

fY(y) = fx(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 x1, x2, x3, ..… with corresponding probability P (x1), P (x2), P (x3),……….. 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.


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.

Frequently Asked Questions – FAQs

What is meant by a random variable?

A random variable is a rule that assigns a numerical value to each outcome in a sample space, or it can be defined as a variable whose value is unknown or a function that gives numerical values to each of an experiment’s outcomes.

What is a random variable and its types?

As we know, a random variable is a rule or function that assigns a numerical value to each outcome of the experiment in a sample space. There are two types of random variables, i.e. discrete and continuous random variables.

How do you identify a random variable?

In general, random variables are represented by capital letters for example, X and Y.

How do you know whether a random variable is continuous or discrete?

A discrete variable is a variable whose value can be obtained by counting since it contains a possible number of values that we can count. In contrast, a continuous variable is a variable whose value is obtained by measuring.

What are the examples of a discrete random variable?

The probability of any event in an experiment is a number between 0 and 1, and the sum of all the probabilities of the experiment is equal to 1. Examples of discrete random variables include the number of outcomes in a rolling die, the number of outcomes in drawing a jack of spades from a deck of cards and so on.

Test your Knowledge on Random Variable


Free Class