# Random variables

## In words...

A random variable is a function associating a number to any outcome of a random experiment.
The set of all possible outcomes of a given experiment is called the sample space, so a random variable is a function that maps the sample space to a set of real numbers. Depending on the nature of this set of numbers, we distinguish between discrete and continuous random variables.

Given a probability space, the behavior of a random variable is governed by its probability distribution.

## In picture...

Here is a population of individuals of various widths and heights.
We consider a random experiment in which we pick one individual at random from the population and measure his height. Let's denote this height by $X$. Then $X$ is a random variable.

$X =$

Exercise: what is the sample space in this example?

Exercise: is $X$ a discrete or continuous random variable?

## In maths...

Let $\Omega$ denote the sample space. A random variable $X$ is a function $X : \Omega \rightarrow \R$. But we often use the shorthand $X$ to refer to $X(\omega)$ for $\omega \in\Omega$. Similarly, given a set $A\subset \R$, $$\mbox{we often write }\quad X\in A \quad\mbox{ instead of } \quad \{\omega\in\Omega\ :\ X(\omega) \in A \} .$$

A discrete random variable $Y$ is a random variable taking values in a finite set: $$Y \in \Y\quad \mbox{with } \quad |\Y| < +\infty .$$