A random variable is a function that assigns a numerical value to each possible outcome of a random experiment. It provides a way to quantify randomness and to apply mathematical and statistical tools.
For example, if we toss three coins and define the function X as “the number of heads obtained,” each outcome of the sample space is assigned a numerical value:
- X(H,H,T)=2
This function X is what we call a random variable. Hence, the probability of getting exactly two heads is P(X=2)=

Depending on the type of values it can take, it is classified as:
- Discrete random variable: takes a finite or countable set of values (e.g. the number of heads in three coin tosses).
- Continuous random variable: can take any value within a real interval (e.g. temperature or a person’s height).
Note: Random variables form the basis for defining concepts such as expected value, variance, and probability distributions (binomial, normal, exponential, etc.).
« Back to Glossary Index