A119 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

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 k resistors in series, each one somewhere between −t% and +t% of 1 kΩ, all values equally likely.
  • Start with k=1. The histogram is flat. Now raise k. How does its shape change?
  • Compare the measured spread with the worst case as k 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)?

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 p(x) for a continuous one, where p(x)dx is the chance of landing in a small range dx.

The mean (expected value) is the long-run average:

μ=E[X]=∑xiP(xi)or∫xp(x)dx

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:

σ2=E[(X−μ)2]=E[X2]−μ2

Common distributions:

VariableMeanVariance
one fair die3.535/12
coin, 1 with probability ppp(1−p)
uniform between a and ba+b2(b−a)212

Rules for constants a and b:

  • Scaling and shifting: E[aX+b]=aE[X]+b and Var(aX+b)=a2Var(X). Shifting doesn't change the spread.
  • Sums: means always add. For independent variables, variances add too:
σX+Y=σX2+σY2

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: n identical independent errors give σn, not nσ.

Worked example

Find the mean, variance and standard deviation of one fair die.

Show the solution
  1. Mean. μ=1+2+⋯+66=3.5
  2. Mean square. E[X2]=1+4+9+16+25+366=916
  3. Variance. σ2=916−3.52=3512=2.92
  4. Standard deviation. σ=1.71

Answer the mean is 3.5, the variance 3512=2.92 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 Y=2X+1 for a variable X with σ = 10?

Show the solution
  1. Variances add. σtotal=3×102=17.3Ω less than the 30 Ω you'd get by adding the spreads.
  2. The shift. For Y=2X+1, adding 1 does nothing to the spread.
  3. The scale doubles it. σY=20

Answer the total has a spread of 17.3 Ω, and Y has σY=20.

Worked example

A random bit is +1 V with probability 0.7 and −1 V otherwise. Find its mean and variance.

Show the solution
  1. Mean. E[X]=0.7−0.3=0.4V
  2. Mean square. Both levels square to 1, so E[X2]=1.
  3. Variance. Var=1−0.42=0.84V2 a standard deviation of 0.917 V.
  4. 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 Y=5X+(6)?

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 +1 V with probability 0.6 and −1 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

X has mean a and standard deviation s; Y=3X+b.

Step 1

What is the mean of Y?

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°.

Explain why

Why do the standard deviations of independent errors combine as σ12+σ22 rather than simply adding?

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.