Let's take a closer look at some terminology.
The plain language we use above can be translated into mathematical language through the use of sets and functions.
- The set of all possible outcomes is the *sample space*.
- An *event* is a subset of all possible outcomes.
### Mathematical definitions
>[!NOTE] Random Variable (Mathematical Definition)
>A random variable $X$ is a function whose domain is the sample space $\Omega$ and whose range is subset set of real numbers $\mathbb{R}$.
>If the range of $X$ is a finite (or countable) set of values, we call $X$ *discrete*.
>If the range of $X$ is an interval (or countable union of intervals), we call $X$ *continuous*.
##### Example: Flipping three two-sided coins
Suppose we have three coins, each with a side we call "heads" ($H$) and a side we call "tails" ($T$).
**Experiment**
Flip each coin and record whether each is an $H$ or a $T$.
**Outcomes**
The sample space for the experiment can be written as the following set
$
\Omega = \{HHH, HHT, HTH, THH, HTT, THT, TTH, TTT\}.
$
**Examples of events**
We could say, "let $A$ be the event that there is exactly one $H$," and "let $B$ be event that there are the second flip was an $H$. Then
$
A = \{HTT, THT, TTH\} \text{ and } B = \{HHH, HHT, THH, THT\}.
$
**Examples of random variables**
It is somewhat natural to say, "let $X$ be the number of heads in the sequence." Why do mathematicians say that $X$ is a function? Well, consider that for each element of the sample space $\Omega$, there is an assigned numerical value.
$
\begin{aligned}
X(HHH) &= 3 \\
X(HHT) &= 2 \\
X(HTH) &= 2 \\
X(THH) &= 2 \\
X(HTT) &= 1 \\
X(THT) &= 1 \\
X(TTH) &= 1 \\
X(TTT) &= 0
\end{aligned}
$
As we explore different