Expected Value and Variance
On a certain track team, the runners all take between 4 and 7 minutes to finish a mile. Suppose the probability density function for the length of time it takes a runner to finish a mile is $f(x)=\frac{4}{21}(x-4.5)^2, 4\leq x \leq 7$. Across all runners on the track team, what is the average time it takes to complete the mile?
An advantage of using random variables to describe experimental outcomes is that they make it possible to talk about the outcomes mathematically and to address questions such as 'What is the average outcome?' and 'How much are the outcomes likely to vary?' The answers to these questions are given by the expected value and the variance of the random variable. The expected value is a measure of the center of a distribution and the variance describes the spread of possible values around the expected value.
The shape of the density function shown here depends on the expected value ($\mu$) and variance $\sigma^2$ or standard deviation, $\sigma$.
Use the sliders to adjust the expected value and variance and to see how that affects the shape and position of the graph.
The expected value for this distribution could be any real number and the standard deviation can be any positive number, however, the graph has a very limited
range for both.
The Expected Value of A Random Variable
The expected value of a random variable is also referred to as the 'expectation' or the 'mean' of the variable. It is an average of the possible experimental outcomes weighted by their probabilities.
→ The expected value of random variable $X$ is the mean of the distribution of $X$.
Expected Value of a Discrete Random Variable
To find the expected value of a discrete random variable, sum the possible values weighted by their probabilities.
$E(X) = \sum_{i=1}^np_ix_i$
At the HuHot Mongolian Grill, there are 1-flame, 2-flame, 3-flame, all the way up to 7-flame sauces to choose from (the number of flames indicates how hot the sauce is). When customers come through the line, 17% of them choose a 1-flame sauce for their dish, 14% choose a 2-flame, 26% choose a 3-flame, 19% choose a 4-flame, 10% choose a 5-flame, 8% choose a 6-flame, and 6% choose a 7-flame. When a randomly selected HuHot customer's dish is selected, what is the expected value for the flame rating of the sauce on that dish?
A 5-prompt multiple-choice quiz has four possible solutions for each prompt, one of which is correct. If a student randomly selects answers, there probability of choosing correctly is 0.25 for each prompt.
Let $X$ denote the number of prompts a randomly guessing student gets correct out of the 5. The probability distribution of X is given by the formula $\small{P(X = x) = \binom 5x 0.25^x(1-0.25)^{5-x}}$. (This a binomial(5, 0.25) distribution).
What is the expected quiz score if a student randomly guesses the answer on every question?
Notice that the expected values in the examples are not possible outcomes of the random variable. In the first example, flame ratings are whole numbers 1-7 but the expected value is 3.39. In the second example, the random variable counts whole points on the quiz but the expected value is 1.25. The expected value can be thought of as a long term mean. That is, if the experiment were repeated many times (infinitely many!) the expected value is the mean outcome of all those trials.
Expected Value of a Continuous Random Variable
It is not possible to sum the probability weighted values of a continuous random variable since there are infinitely many. The analogous procedure is to integrate across the support of a continuous random variable and to use the probability density function to weight the outcomes.
$E(X) = \int_l^uxf(x)dx$
"Time headway" in traffic flow is the elapsed time between when one car finishes passing a fixed point and the instant that the next car begins to pass that point. Let $X$ denote the time headway, in seconds, for a randomly chosen pair of consecutive cars on a freeway. $f(x)=.15e^{-.15(x-.5)}$, for $x \geq 0.5$, and $f(x)=0$ otherwise. What is the expected value for seconds of time headway between any two consecutive cars on a freeway?
Toucans are most likely to be found near the equator, but can be found in other locations across the world. Let $X$ be a random variable indicating the latitude at which a toucan is spotted. Latitude $x=0$, the equator, is the most likely. A latitude of $x=-90$ denotes a toucan at the South Pole, and $x=90$ denotes a toucan at the North Pole.
Suppose the probability density function for $X$ is \[\small{ f(x) = \begin{cases} f(x)=\frac{1}{75}(\frac{x}{90}+1) & \text{for } & -90\leq x\leq 0\\ f(x)=\frac{2}{225}(1-\frac{x}{90}) & \text{for } & 0\leq x\leq 90\\ f(x)=0 & & \text{otherwise } \end{cases}} \] What is the expected latitude of a random toucan spotting?
The Variance of A Random Variable
- How much will the number of correct answers a student gets while guessing on a 5 prompt quiz vary between attempts?
- How spread out are the toucans around -6 degrees latitude?
As shown above, the expected score on the 5 prompt multiple choice quiz is 1.25 but a student won't score 1.25 every time (or ever) and many toucans will be spotted at latitudes other than -6 degrees. The variance of a random variable describes the spread of the outcomes of the random variable.
→ The variance of a random variable $X$ indicates how much the possible outcomes of the random variable vary around the expected value (mean).
The formula for computing variance of a random variable is the same whether the random variable is discrete or continuous. However, as with the expected value, the details of the process depend on the variable type.
\(Var(X) = E[(X - E(X))^2] \)
In practice, we generally use the simpler to work with formula $Var(X) = E(X^2) - [E(X)]^2$.
\(Var(X) = E(X^2) - [E(X)]^2] \)
Variance of a Discrete Random Variable
To find the variance of a random variable, compute the terms $E(X^2)$ and $[E(X)]^2$. $E(X^2)$ is a weighted mean of the squared values; it is computed like the expected value but the values are squared before being weighted and aggregated. The second term is the expected value squared.
$E(X^2) = \sum_{i=1}^np_ix_i^2$
The units of the variance are the square units of the context. This can be difficult to interpret (e.g. squared minutes or squared dollars). Thus, while many formulas work with variance, it is common to use the square root of the variance, the standard deviation, for interpretation. The units of the standard deviation are the same as the units of the context.
→ The standard deviation \(\sigma\), of a random variable $X$ is the positive square root of the variance.
At the HuHot Mongolian Grill, there are 1-flame, 2-flame, 3-flame, all the way up to 7-flame sauces to choose from (the number of flames indicates how hot the sauce is). Suppose that when customers come through the line, 17% of them choose a 1-flame sauce for their dish, 14% choose a 2-flame, 26% choose a 3-flame, 19% choose a 4-flame, 10% choose a 5-flame, 8% choose a 6-flame, and 6% choose a 7-flame. what is the variance for the flame rating of the sauce of the dish of a randomly selected HuHot customer?
A 5-prompt multiple-choice quiz has four possible solutions for each prompt, one of which is correct. If a student randomly selects answers, there probability of choosing correctly is 0.25 for each prompt. The probability that a student gets all 5 prompts correct is 0.0977% . Let $X$ denote the number of prompts a randomly guessing student gets correct out of the 5. The probability distribution of X is given by the formula $\small{P(X = x) = \binom 5x 0.25^x(1-0.25)^{5-x}}$. What are the variance and standard deviation for the score?
Variance of a Continuous Random Variable
As in the discrete case, the variance of a continuous random variable is computer with this formula: $Var(X) = E(X^2) - [E(X)]^2$.
The second term is the square of the expected value. The computations for the first term $E(X^2)$ are similar to those for computing the expected value
but the 'x' term is squared before being multiplied by the density function.
For a continuous random variable, X, with pdf $f(x)$ on $l\leq x \leq u$
\(E(X^2) = \int_l^u x^2f(x)dx \).
"Time headway" in traffic flow is the elapsed time between when one car finishes passing a fixed point and the instant that the next car begins to pass that point. Let $X$ denote the time headway, in seconds, for a randomly chosen pair of consecutive cars on a freeway during a period of heavy flow. Then $f(x)=.15e^{-.15(x-.5)}$, for $x \geq 0.5$, and $f(x)=0$ otherwise. What is the expected value for seconds of time headway between any two consecutive cars on a freeway with heavy flow?
Toucans are most likely to be found near the equator, but can be found in other locations across the world. Let $X$ be a random variable indicating the latitude at which a toucan is spotted. Latitude $x=0$, the equator, is the most likely. A latitude of $x=-90$ denotes a toucan at the South Pole, and $x=90$ denotes a toucan at the North Pole.
Suppose the probability density function for $X$ is \[ f(x) = \begin{cases} f(x)=\frac{1}{75}\left(\frac{x}{90}+1\right) & \text{for } & -90\leq x\leq 0\\ f(x)=\frac{2}{225}\left(1-\frac{x}{90}\right) & \text{for } & 0\leq x\leq 90\\ f(x)=0 & & \text{otherwise } \end{cases} \] What are the variance and standard deviation of the latitude of a random toucan spotting?
Interpretation of the Variance
- If one observation is sampled at random from a distribution with high variance, there is a high probability that the observation will be far from the mean.
- If one observation is sampled at random from a distribution with low variance, there is a small probability that the observation will be far from the mean.
Consider two gambling games. For both, the expected value of winnings (expected winnings) is -10 cents. If a gambler played either game wmany times, they would lose about 10 cents per game, on average.
The variance of the winnings playing game 1 is $\$^{2}5,500$, and the variance of the winnings playing game 2 is $\$^{2}700$.
Which game should you choose to play if your paramount strategy is...
- to try to win the largest amount possible?
- to risk losing as little as possible?
On a certain track team, the runners all take between 4 and 7 minutes to finish a mile. The probability density function for the length of time it takes a runner to finish a mile is $f(x)=\frac{4}{21}(x-4.5)^2, 4\leq x \leq 7$.
Find the expected value and variance of the time it takes a randomly selected member of the team to run a mile.