# The Definition

 English Português Français ‎Español Italiano Nederlands

Definition: A random variable is a function that assigns (real) numbers to the results of an experiment. Each possible outcome of the experiment (i.e. value of the corresponding random variable) occurs with a certain probability. ${\displaystyle X}$: random variable${\displaystyle x_{i},\ (i=1,\dots ,n)}$: results of ${\displaystyle n}$ experiments—the values of the random variable ${\displaystyle X}$ A random variable is created by assigning a real number to each event ${\displaystyle E_{j}}$ (an outcome of an experiment). The event ${\displaystyle E_{j}}$ is an element of the set ${\displaystyle S}$ of all possible outcomes of an experiment. The random variable is then defined by a function that maps the elements of the set ${\displaystyle S}$ with numbers on the real line${\displaystyle {}}$. ${\displaystyle X:E_{j}\rightarrow X(E_{J})=x_{j}}$

### Enhanced Example

The government carried out a socioeconomic study that examined the relationship between the size of a household and its lifestyle choices. Let us assume that the government has obtained the following results: ${\displaystyle E_{1}=\{\,{\text{households with one person}}\,\}}$.${\displaystyle E_{1}=\{\,{\text{households with two people}}\,\}}$.${\displaystyle E_{1}=\{\,{\text{households with three people}}\,\}}$.${\displaystyle E_{1}=\{\,{\text{households with four and more people}}\,\}}$. The set of the possible outcomes from the experiment consists of the following events: ${\displaystyle S=\{E_{1},E_{2},E_{3},E_{4}\}}$.We assign a real number to each event ${\displaystyle E_{i}\in S}$:

 ${\displaystyle S}$ ${\displaystyle R}$ ${\displaystyle E_{1}}$ ${\displaystyle \Rightarrow }$ ${\displaystyle 1}$ ${\displaystyle E_{2}}$ ${\displaystyle \Rightarrow }$ ${\displaystyle 2}$ ${\displaystyle E_{3}}$ ${\displaystyle \Rightarrow }$ ${\displaystyle 3}$ ${\displaystyle E_{4}}$ ${\displaystyle \Rightarrow }$ ${\displaystyle 4}$

The resulting random variable ${\displaystyle X}$ is defined as the size of the household. The set of possible values of this random variable is ${\displaystyle (1,2,3,4)}$, this means that the possible results of this random variable are ${\displaystyle x_{1}=1,x_{2}=2,x_{3}=3,x_{4}=4}$.

### The Experiment

Two outcomes are possible if you toss a coin: heads (h) or tails (t). Let us consider three tosses (${\displaystyle k=3}$). Our experiment will examine the number (n) of tails obtained in three tosses of a coin. There are 8 possible (${\displaystyle V^{W}(n;k)=n^{k}\rightarrow V^{W}(2;3)=2^{3}=8}$) outcomes of this experiment ${\displaystyle S=\{hhh,hht,hth,thh,htt,tht,tth,ttt\}}$ The random variable for this experiment assigns a real number ${\displaystyle (0,1,2,3)}$ to each element of ${\displaystyle S}$ based on the number of tails appearing in the tosses. For example:Tails appear once (${\displaystyle n=1}$): ${\displaystyle \{(hho)\cup (hoh)\cup (ohh)\}}$This random variable “works” in the following way: The corresponding random variable, denoted by the capital letter ${\displaystyle X}$, is defined as ${\displaystyle X=\{\,{\text{Number (n) of tails in three tosses of the coin}}\,\}{\text{.}}}$ This definition implies that the value of the random variable ${\displaystyle X}$ has to be one of the following 4 numbers: ${\displaystyle x_{1}=0;x_{2}=1;x_{3}=2;x_{4}=3}$.