Probability Basics › Random Variables
Machine Learning from ScratchAll chapters Probability Basics › Random VariablesOne section · Sections in this chapter3 / 12 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
A random variable is a quantity whose value is uncertain before it is observed. Unlike ordinary variables in mathematics that take fixed values, random variables represent outcomes of random processes that can vary from one observation to another. Random variables connect abstract probability theory and real-world measurements, allowing us to apply mathematical reasoning to uncertain phenomena.
We distinguish between two types of random variables based on the values they can assume:
- Discrete random variables take on countable values, often integers, such as the number of customers arriving at a store, the count of defective items in a batch, or the outcome of rolling a die.
- Continuous random variables can take any value within an interval, such as temperature, time, height, or stock prices. The distinction matters because discrete and continuous random variables require different mathematical tools: probability mass functions for discrete cases and probability density functions for continuous cases.
Consider a simple example: let represent the outcome of rolling a fair six-sided die. This discrete random variable can take values in the set , each with equal probability . In contrast, if represents the time until the next customer arrives at a store, this continuous random variable could take any positive real value, and we describe its behavior using a continuous probability distribution like the exponential distribution.