# What is a random variable?

S is a sample space associated with the experiment E.

Random variable is then: Function X, which assigns a real number to every element s ∈ S.

X: S -> R

R is the set of all real numbers.

## Example

Suppose we are tossing 2 coins.

Our sample space would be:

S = {HH, HT, TH, TT}

We can declare a random variable:

f(HH) = 2
f(TT) = 0