Variance and standard deviation: raw data
The variance is the average of the squared deviations from the mean. The standard deviation is its square root. Why squared deviations? They:
- Treat positive and negative deviations symmetrically.
- Are differentiable (no absolute values) , convenient for algebra.
- Amplify large deviations, which is often what we want to detect.
Definitions
For raw data x1,x2,…,xn with mean xˉ:
σ2=n1i=1∑n(xi−xˉ)2.
This is the variance. The standard deviation is
σ=σ2.
The standard deviation has the same units as the data. Variance has units squared.
Expanding the square:
σ2=n1∑(xi2−2xˉxi+xˉ2)=n∑xi2−2xˉ⋅xˉ+xˉ2=n∑xi2−xˉ2.
So
σ2=n∑xi2−xˉ2=n∑xi2−(n∑xi)2.
This is often easier to compute , you only need ∑xi and ∑xi2, no pre-computed xˉ needed inside the sum.
Properties
Non-negativity. σ2≥0, with equality iff all xi are equal.
Shift invariance. If yi=xi+a, then σy=σx.
Scale. If yi=bxi, then σy=∣b∣σx, and σy2=b2σx2.
Combining: if yi=a+bxi, then σy=∣b∣σx.
Worked examples
Example 1. Variance and SD of 4,6,8,10,12.
xˉ=40/5=8. Deviations: −4,−2,0,2,4. Squared: 16,4,0,4,16. Sum: 40. σ2=40/5=8. σ=8=22≈2.83.
Example 2. Variance of 2,4,6,8,10 using alternative formula.
∑x=30⇒xˉ=6. ∑x2=4+16+36+64+100=220. σ2=220/5−36=44−36=8. σ=22.
Example 3. SD of 1,3,5,7,9,11.
xˉ=36/6=6. ∑x2=1+9+25+49+81+121=286. σ2=286/6−36=47.6−36=11.6. σ≈3.42.
(Or directly: deviations −5,−3,−1,1,3,5; squares 25,9,1,1,9,25; sum 70; σ2=70/6≈11.67.)
Example 4. Find the SD of the first n natural numbers.
xˉ=(n+1)/2. ∑xi2=n(n+1)(2n+1)/6.
σ2=nn(n+1)(2n+1)/6−(2n+1)2=6(n+1)(2n+1)−4(n+1)2.
Common denominator 12: 122(n+1)(2n+1)−3(n+1)2=12(n+1)[2(2n+1)−3(n+1)]=12(n+1)(n−1)=12n2−1.
So σ=12n2−1.
Example 5. If σx=5 and y=3x+7, find σy.
σy=∣3∣⋅σx=15.
Try it yourself
- SD of 2,4,4,4,5,5,7,9.
- Variance of 7,7,7,7.
- SD of 1,2,3,4,5,6,7.
- Variance and SD of 10,12,14,16,18.
- If ∑xi=50, ∑xi2=500, n=10, find σ.
- Find SD of first 20 natural numbers.
- If y=2x−5 and σx=4, find σy.
- The mean of 5 numbers is 20 and the variance is 4. Add a number equal to the mean. What is the new variance?
- Show that if all xi are equal, σ=0.
- SD of 3,5,7,9,11,13,15.
- The variance of 25 observations is 4. If each is multiplied by 2, find the new variance.
- The mean of 10 numbers is 24, SD is 6. If 3 is added to each, what are the new mean and SD?
Pitfalls / Tricks
- Variance has units squared (e.g., cm²); standard deviation has the same units as data.
- Use the alternative formula when raw sums are easy to compute.
- Shifting data does not change SD; scaling multiplies it.
- Insight. Variance is the square of standard deviation. They contain the same information; choose the one that's algebraically convenient.