1. Random Variable

A random variable is an uncertain quantity whose value depends on the outcome of a random event.

Strict mathematical definition:

A random variable is a mapping (function) from the sample space to the set of real numbers.

$$ X : \Omega \to \mathbb{R} $$

where:

<aside> đź’ˇ

We use a deterministic function to map a “random outcome” to a “number”.

</aside>

2. Expectation

The value that a random variable takes on average over a large number of repeated trials.

Strict mathematical definition:

Discrete random variable

Probability mass function (PMF) is $P(X=x_i)$

Then the expectation is defined as:

$$ \mathbb{E}[X] = \sum_{i} x_i \, P(X = x_i) $$

Continuous random variable

its probability distribution is described by the probability density function $f(x)$:

$$ \mathbb{E}[X] = \int_{-\infty}^{\infty} x f(x)\, dx $$