## Definition
A ==Random Variable== is a function that maps each outcome in a sample space to a real number. A discrete random variable takes on a countable number of values, while a continuous random variable can take any value in an interval. Random variables provide the mathematical bridge between experimental outcomes and numerical analysis.
> [!example]- Two fair coins are tossed. Let $X$ be the number of heads. What are the possible values and probabilities of $X$?
> The sample space is $\{HH, HT, TH, TT\}$. The random variable $X$ maps each outcome to its head count:
>
> | $x$ | 0 | 1 | 2 |
> |---|---|---|---|
> | $P(X = x)$ | $1/4$ | $2/4$ | $1/4$ |