## 2.3 Random variables and probability distributions

• A random variable assigns numerical values to the outcomes of a random experiment. More formal, a random variable $$X$$ is as a measurable function that maps from the sample space to the real numbers $$X:S\mapsto R$$

• Let consider a random variable $$X=$$“the number of heads you get when you toss two coins”. The values of a random variable $$X$$ are countable outcomes $$0$$, $$1$$ and $$2$$.

\begin{align} S&=\{HH,~TT,~HT,~TH\} \\ X(S)&=\{2,0,1,1\} \end{align}

• $$X$$ is a discrete random variable because you can count the possible values $$x_i$$ that $$X$$ can take

• Values $$x_i$$ and their associated probabilities $$p(x_i)$$ are organized into probability distribution with two requirements:

\begin{align} p(x_i)& \geq 0 \\ \\ \sum_{i=1}^n p(x_i)&=1 \\ \tag{2.5} \end{align}

• Considering that random variable $$X=$$“the number of heads you get when you toss two coins” probability distribution is given:
TABLE 2.2: Probability distribution of discrete random variable
$$x_i$$ $$p(x_i)$$
0 0.25
1 0.5
2 0.25
Total 1
• Any probability distribution can be described by the mean, variance and standard deviation

• The mean of a discrete probability distribution is the long-run average of occurrences. You must realize that any single trial yields only one outcome. However, if the random experiment is repeated long enough, the average of the outcomes is approaching to a long-run average, that we call expected value denoted as $$E(X)$$ or $$\mu$$

The expected value of a random variable X represents the average value of X that occurs if the
random experiment is repeated a large number of times.

$$$\mu=E(X)=\sum_{i=1}^n x_i p(x_i) \tag{2.6}$$$

• The variance and standard deviation are computed in a similar way

\begin{align} \sigma^2=Var(X)&=\underbrace{\sum_{i=1}^n x_i^2 p(x_i)}_{E(X^2)}-\underbrace{\mu^2}_{E(X)^2}\\ \\ \sigma&=\sqrt{Var(X)} \\ \tag{2.7} \end{align}

• Considering that random variable $$X=$$“the number of heads you get when you toss two coins” the expected value, variance and standard deviation of the randome variabl are:

\begin{align} E(X)&=0\cdot 0.25+1\cdot 0.5+2\cdot 0.25=1 \\ \\ Var(X)&=\bigg(0^2\cdot 0.25+1^2\cdot 0.5+2^2\cdot 0.25 \bigg)-1^2=1.5-1=0.5 \\ \\ \sigma&=\sqrt{0.5}=0.7071 \end{align}