A11 · Lesson 9 · Random variables, mean and variance
Two numbers that summarize anything random
A bag of 1 kΩ, ±5% resistors doesn't contain 1 kΩ resistors. It contains values scattered between 950 and 1050 Ω. Put ten in series and the worst case is off by 500 Ω, but you'll almost never see that: the errors mostly cancel. How much do they cancel? Two numbers, the mean and the standard deviation, answer that for any random quantity, and they combine by simple rules when quantities add.
Play
- Each draw is the total error of resistors in series, each one somewhere between % and % of 1 kΩ, all values equally likely.
- Start with . The histogram is flat. Now raise . How does its shape change?
- Compare the measured spread with the worst case as grows. Which grows faster?
Predict
Ten ±5% resistors of 1 kΩ are put in series. The worst-case error is ±500 Ω. What is the typical size of the error (the standard deviation)?
About 90 Ω. One resistor's error, spread evenly over ±50 Ω, has a standard deviation of Ω. For independent errors the variances add, so ten of them give Ω. The worst case needs all ten at their limits in the same direction, which essentially never happens. Designing to worst case is safe but expensive; designing to the standard deviation is how mass production works.
Name it
Random variables
A random variable is a number that comes out of a random experiment: the face of a die, a resistor's value, the noise voltage at an instant. Its distribution says how likely each value is: a list of probabilities for a discrete variable, or a probability density for a continuous one, where is the chance of landing in a small range .
The mean (expected value) is the long-run average:
The variance is the mean squared distance from the mean, and the standard deviation σ is its square root, back in the variable's own units:
Common distributions:
| Variable | Mean | Variance |
|---|---|---|
| one fair die | 3.5 | 35/12 |
| coin, 1 with probability | ||
| uniform between and |
Rules for constants and :
- Scaling and shifting: and . Shifting doesn't change the spread.
- Sums: means always add. For independent variables, variances add too:
Standard deviations don't add; they combine like the sides of a right triangle. That's the root-sum-square (RSS) rule for stacking tolerances: identical independent errors give , not .
Worked example
Find the mean, variance and standard deviation of one fair die.
Show the solution
- Mean.
- Mean square.
- Variance.
- Standard deviation.
Answer the mean is 3.5, the variance and the standard deviation 1.71.
Worked example
Three resistors in series each have a value spread of σ = 10 Ω, independently. What is the spread of the total? And of for a variable with σ = 10?
Show the solution
- Variances add. less than the 30 Ω you'd get by adding the spreads.
- The shift. For , adding 1 does nothing to the spread.
- The scale doubles it.
Answer the total has a spread of 17.3 Ω, and has .
Worked example
A random bit is +1 V with probability 0.7 and −1 V otherwise. Find its mean and variance.
Show the solution
- Mean.
- Mean square. Both levels square to 1, so .
- Variance. a standard deviation of 0.917 V.
- The DC component. An unbalanced bit stream has a DC component of 0.4 V, which an AC-coupled link has to cope with; line codes are designed to keep it at zero.
Answer the mean is 0.4 V and the variance 0.84 V², a standard deviation of 0.917 V.
Check
A random voltage is 1 V with probability 0.2, 4 V with probability 0.5 and 9 V with probability 0.3.
(a)
What is its mean?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
(b)
What is its standard deviation?
Check
An error is equally likely to be anywhere between −20 mV and +20 mV. What is its standard deviation?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
A voltage X has mean 4 V and standard deviation 1 V. What is the standard deviation of ?
Check
Two independent noise sources with standard deviations 5 mV and 4 mV add together. What is the standard deviation of the total?
Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.
Check
A bit is 1 with probability 0.2 and 0 otherwise. What is its standard deviation?
Check
A bit is V with probability 0.6 and V otherwise.
(a)
What is its mean?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
(b)
What is its variance?
Check
has mean and standard deviation ; .
Step 1
What is the mean of ?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
What is its standard deviation?
Explain why
Why do the standard deviations of independent errors combine as rather than simply adding?
Adding standard deviations would assume both errors are always at their typical size in the same direction. Independent errors are just as likely to push opposite ways as the same way, so they partly cancel. Working through the squares, the cross term averages to zero when the errors are independent, leaving the variances to add. The total spread is therefore larger than either one but smaller than their sum.
Practice
Keep practicing
9 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.