# Random variable

## Random variable :

A random variable is a variable that takes on different values depending on the outcome of a random event. In other words, it is a variable whose value is determined by chance. There are two main types of random variables: discrete and continuous.
Discrete Random Variable :
A discrete random variable is a variable that can take on a finite or countably infinite number of distinct values. Examples of discrete random variables include the number of heads that come up when flipping a coin, the number of children in a family, or the number of cars in a parking lot.
For example, consider the random variable X that represents the number of heads that come up when flipping a coin. The possible values of X are 0, 1, or 2, and the probability of each value occurring is 0.5, 0.5, and 0, respectively. This means that there is a 50% chance of X being 0 or 1, and a 0% chance of X being 2.
Continuous Random Variable :
A continuous random variable is a variable that can take on an infinite number of values within a certain range. Examples of continuous random variables include the height of a person, the weight of an object, or the time it takes for a car to travel a certain distance.
For example, consider the random variable Y that represents the weight of an object. The possible values of Y are any value within a certain range, such as 0 to 100 pounds. The probability of a specific value occurring is 0, since there are an infinite number of values within the range. However, the probability of a value occurring within a specific interval, such as 25 to 50 pounds, can be calculated using probability density functions.
Probability Distributions :
The probability distribution of a random variable is a function that describes the probability of each possible value occurring. There are two main types of probability distributions: the probability mass function (PMF) and the probability density function (PDF).
The PMF is used for discrete random variables and assigns a probability to each possible value of the variable. For example, the PMF for the random variable X, which represents the number of heads that come up when flipping a coin, would be P(X=0)=0.5, P(X=1)=0.5, and P(X=2)=0.
The PDF is used for continuous random variables and describes the probability density of the variable. The PDF is defined as the derivative of the cumulative distribution function (CDF). The CDF is the probability that the random variable is less than or equal to a certain value. For example, the PDF for the random variable Y, which represents the weight of an object, could be described as f(y)=2y for values of y between 0 and 1, and f(y)=0 for all other values. This means that the probability density of Y is 2 times the value of Y for values between 0 and 1, and 0 for all other values.
Conclusion :
Random variables are variables whose values are determined by chance. There are two main types of random variables: discrete and continuous. Discrete random variables can take on a finite or countably infinite number of distinct values, while continuous random variables can take on an infinite number of values within a certain range. The probability distribution of a random variable is a function that describes the probability of each possible value occurring. The PMF is used for discrete random variables and the PDF is used for continuous random variables. Understanding random variables and probability distributions is important for analyzing and predicting the outcomes of random events.