# Random Variable

Introduction to the discrete and continuous random variable and their mean and variance.

A random variable is a set of possible values from a random experiment. It can be of two types: discrete and continuous.

Discrete random variable: A random variable can take countable numbers of distinct values like 1,2,3,4. These variables are usually counted. The variable can take only a finite number of values. Examples of discrete random variables are customers standing in a queue or number of the people in a movie hall.

Continuous random variable: A continuous random variable can take infinite possible values. For example, the weight of a person or the temperature of a city.

Probability distribution: A list of probabilities associated with every value. The probability distribution can be defined for both discrete and continuous variables. For discrete variables, it is known as probability mass function, or pmf. For continuous variables, it is known as a probability density function, or pdf.

Cumulative distribution function (cdf): The probability that a variable takes a value less than or equal to x. cdf(x) = P[X<=x] = a

Consider the example of the probability of five discrete values.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.