Trading Dev AcademyFree quant education

Free lesson · Math & notation

Read sums, indices, averages and squared deviations

Open interactive lessonPractice calculationsExplore labs

Start with the idea

Expand a compact sum into a short list before generalising. The notation saves space, but every term still describes an ordinary arithmetic operation.

Symbols, units & horizon
  • xᵢ: observation i in the chosen units
  • n: count of observations, at least 2 for sample variance
  • x̄: arithmetic sample average
  • Σ with limits: sum over the specified indices
  • s²: sample variance in squared units
  • s: sample standard deviation in the units of x

When and why to use this

Use this when hand-checking statistics computed by a spreadsheet or a Python function.

The summation symbol Σ means “add these terms.” The index i tells you which observation to use; the lower and upper limits tell you where to start and stop. A bar above x means its arithmetic average. The notation xᵢ is the i-th value; it does not mean x raised to i.

x‾=1n∑i=1nxi,s2=1n−1∑i=1n(xi−x‾)2
Algebra and arithmetic

Expand the mean and variance sums

  1. For n=3, ∑i=13xi=x1+x2+x3. Divide by 3 to obtain the mean.
  2. For x=(1,2,3), mean=2. The variance numerator expands to (1−2)2+(2−2)2+(3−2)2=2. Divide by n−1=2.
Work it by hand

Sample variance=1; sample SD=√1=1 in the units of x.

Subtracting the mean centres observations. Squaring makes negative and positive deviations contribute positively. Variance has squared units; taking its square root gives standard deviation in the original units. The sample variance uses n−1 when estimating a population variance under the usual assumptions.

Python implementation

Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.

from statistics import mean, variance, stdev

def sample_summary(values):
    if len(values) < 2:
        raise ValueError("At least two observations required")
    return mean(values), variance(values), stdev(values)

print(sample_summary([1, 2, 3]))

Continue learning

Math & Notation Essentials — all lessons
  1. Start with numbers, variables and an equals sign
  2. Percentages, basis points and units
  3. Rearrange an equation without changing its meaning
  4. Powers, square roots, exponentials and logarithms
  5. Read sums, indices, averages and squared deviations
  6. Probability, expectation and conditioning
  7. Vectors, matrices and transpose notation
  8. Derivatives, integrals and approximations

Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations