Random variable
Up to now, probability has been calculated for events ("drawing an ace", "it rains"). But many real questions are numerical: how many breakdowns will there be this week? How much is won in this raffle? How many bits will arrive correctly? A random variable is the tool that turns the outcome of a random experiment into a number, so that we can calculate with it: add it, average it, see how spread out it is.
What a random variable is
This section deals only with discrete variables; at the end of the topic the continuous variable is briefly introduced, and it will be developed further with the normal distribution.
A random number app generates integers from $1$ to $4$, all with equal probability. Let $X$ be the number generated. a) Write down the probability function of $X$ in…
A random number app generates integers from $1$ to $4$, all with equal probability. Let $X$ be the number generated.
- a) Write down the probability function of $X$ in table form.
- b) Calculate the mean $\mu$.
- c) Calculate the standard deviation $\sigma$, rounding to two decimal places.
Probability function
To describe a discrete random variable completely, it is enough to say what probability each of its possible values has.
A discrete random variable $X$ takes the values $1$, $2$, $3$ and $4$ with this incomplete probability function: | $x_i$ | $1$ | $2$ | $3$ | $4$ | |---|---|---|---|---|…
A discrete random variable $X$ takes the values $1$, $2$, $3$ and $4$ with this incomplete probability function:
| $x_i$ | $1$ | $2$ | $3$ | $4$ |
|---|---|---|---|---|
| $p_i$ | $0,15$ | $k$ | $0,35$ | $0,25$ |
- a) Calculate the value of $k$.
- b) Find $P[X \ge 3]$.
- c) Find $P[X < 2]$.
State, giving reasons, which of the following tables can represent the probability function of a discrete random variable: Table 1: values $1$, $2$, $3$ with…
State, giving reasons, which of the following tables can represent the probability function of a discrete random variable:
-
Table 1: values $1$, $2$, $3$ with probabilities $0,3$; $0,4$; $0,2$.
-
Table 2: values $1$, $2$, $3$, $4$ with probabilities $0,5$; $0,3$; $0,3$; $-0,1$.
-
Table 3: values $1$, $2$, $3$, $4$ with probabilities $0,25$; $0,25$; $0,25$; $0,25$.
In each case, state the condition (or conditions) that are satisfied or violated.
Distribution function
Sometimes a cumulative probability ("at most this much") is more useful than the exact value at a point.
The cumulative distribution function of a discrete random variable $X$ is given by: $F(0) = 0,2 \qquad F(1) = 0,5 \qquad F(2) = 0,8 \qquad F(3) = 1$ a) Calculate…
The cumulative distribution function of a discrete random variable $X$ is given by:
$F(0) = 0,2 \qquad F(1) = 0,5 \qquad F(2) = 0,8 \qquad F(3) = 1$
- a) Calculate $P[X \le 2]$.
- b) Calculate $P[X = 2]$.
- c) Calculate $P[X > 1]$.
The figure shows the cumulative distribution function $F(x)$ of a discrete random variable $X$ that takes the values $0$, $1$, $2$ and $3$. a) Deduce from the graph the…
The figure shows the cumulative distribution function $F(x)$ of a discrete random variable $X$ that takes the values $0$, $1$, $2$ and $3$.
- a) Deduce from the graph the probability function of $X$ (the values $p_i = P[X = x_i]$) and write it down in table form.
- b) Calculate $P[1 \le X < 3]$ using the cumulative distribution function.
- c) Find the mean of $X$.
Mean, variance and standard deviation
Just as a table of statistical data has a mean and a standard deviation, a random variable has its own parameters, calculated using probabilities instead of frequencies.
In a bag for a board game there are $20$ point cards: $6$ cards with a $1$, $4$ cards with a $2$ and $10$ cards with a $3$. A card is drawn at random and its score $X$…
In a bag for a board game there are $20$ point cards: $6$ cards with a $1$, $4$ cards with a $2$ and $10$ cards with a $3$. A card is drawn at random and its score $X$ is noted.
- a) Write down the probability function of $X$ in table form.
- b) Calculate the mean $\mu$ and interpret it: what average score per card can be expected in the long run?
- c) Calculate the standard deviation $\sigma$, rounding to two decimal places.
Amina is studying the variable $X$ = "number of weekly breakdowns of a photocopier", with this probability distribution: | $x_i$ | $0$ | $1$ | $2$ | $3$ |…
Amina is studying the variable $X$ = "number of weekly breakdowns of a photocopier", with this probability distribution:
| $x_i$ | $0$ | $1$ | $2$ | $3$ |
|---|---|---|---|---|
| $p_i$ | $0,1$ | $0,3$ | $0,4$ | $0,2$ |
She has calculated the mean, $\mu = 1,7$, and then wrote:
«$\sigma^2 = \sum p_i \cdot x_i^2 - \mu = 3,7 - 1,7 = 2 \implies \sigma = \sqrt{2} \approx 1,41$»
- a) Check her calculation of $\sum p_i \cdot x_i^2$ and confirm that it is correct.
- b) Locate the error in the formula she applied for the variance and correct it.
- c) Calculate the correct standard deviation.
Expected value as a criterion: games and raffles
The expected value has a very practical interpretation: it tells you what happens "on average, if it is repeated many times". It is the tool for deciding whether a game, a raffle or a bet is worthwhile.
The PTA of a secondary school organises a charity raffle: it sells $200$ tickets at $2\ \text{€}$ each, with one prize of $100\ \text{€}$, four prizes of $25\ \text{€}$…
The PTA of a secondary school organises a charity raffle: it sells $200$ tickets at $2\ \text{€}$ each, with one prize of $100\ \text{€}$, four prizes of $25\ \text{€}$ and ten prizes of $5\ \text{€}$.
- a) Write down the probability function of the variable $G$ = "net winnings from buying a ticket" (value of the prize minus the $2\ \text{€}$ it costs).
- b) Calculate the expected value of $G$.
- c) Interpret the sign of the result: if the expected value is negative, where does that money go? Does that contradict the charitable purpose of the raffle?
At a fairground stall, a game is played with two cubic dice: you win $12\ \text{€}$ if you roll doubles (both dice the same), $6\ \text{€}$ if the sum is $7$, and…
At a fairground stall, a game is played with two cubic dice: you win $12\ \text{€}$ if you roll doubles (both dice the same), $6\ \text{€}$ if the sum is $7$, and nothing in any other case.
- a) Calculate the probability of winning each prize and the probability of winning nothing. (Note that rolling doubles and having a sum of $7$ are mutually exclusive events; why?)
- b) Find the expected value of the prize per game and deduce what the price of the stake should be for the game to be fair.
- c) If the stall charges $4\ \text{€}$ per game, who does the game favour? How much is a player who plays $100$ games expected to win or lose?
Linear transformations and the continuous variable
So far $X$ has taken isolated values (discrete). When a quantity can take any value in an interval —a time, a length, a weight— a continuous variable is needed: instead of a table of probabilities, a density function $f(x)$ is used, and the probability of an interval is the area under $f$ between its endpoints (the total area equals $1$, just as $\sum p_i=1$ in the discrete case).
Let $X$ be a discrete random variable with mean $\mu$ and standard deviation $\sigma$, and let $Y = a \cdot X + b$ be a new variable obtained by applying a linear…
Let $X$ be a discrete random variable with mean $\mu$ and standard deviation $\sigma$, and let $Y = a \cdot X + b$ be a new variable obtained by applying a linear transformation to $X$.
- a) Prove, from the definition of the mean, that $\mu_Y = a \cdot \mu + b$.
- b) Prove that $\sigma_Y = |a| \cdot \sigma$. Why does the constant $b$ not affect the spread?
- c) Application: in an exam, the marks have a mean of $6,2$ and a standard deviation of $1,4$. The teacher decides to transform each mark $X$ into $Y = 0,9 \cdot X + 1$. Calculate the new mean and the new standard deviation.
The time (in minutes) it takes for a server to boot after a restart is a continuous random variable $X$ with probability density function $f(x) = k \cdot x$ for…
The time (in minutes) it takes for a server to boot after a restart is a continuous random variable $X$ with probability density function $f(x) = k \cdot x$ for $x \in [0, 4]$ and $f(x) = 0$ elsewhere, represented in the figure.
- a) Calculate the value of $k$ knowing that the total area under the probability density function must be $1$.
- b) Find the probability that the server takes less than $2$ minutes to boot.
- c) Calculate the median of $X$ (the value $m$ such that $P[X \le m] = \frac{1}{2}$) and the mean $\mu$. Which of the two is greater? What do you think is the reason for this?
Back to the start: The number of breakdowns or the result of a raffle cannot be predicted with certainty for a single case, but the expected value ($E[X]$ or $E[G]$) determines exactly what to expect on average in the long run.