📊 Advanced Study Notes – Average (Mean)
Audience: University students (MIT‑level) in quantitative aptitude, statistics, or data science.
Goal: Build a deep, first‑principles understanding of averages – why they exist, how they behave, and how to use them in complex, edge‑case scenarios.
1. Primer: What Is an Average?
| Symbol | Definition | Intuition |
|---|---|---|
| (\bar{x}) | Arithmetic mean of a set (X={x_1,\dots,x_n}) | “Best single value” representing the central tendency. |
| (\bar{x} = \dfrac{1}{n}\sum_{i=1}^{n}x_i) | Formula | Sum all observations, divide by count. |
Why “mean”? Historically, the mean was the balance point of a collection of numbers—like a lever balanced on the average.
2. First Principles
2.1. The Balance (Centroid) Argument
Consider a set of weights (x_i) placed on a lever arm of unit length. The center of mass (\bar{x}) satisfies:
[ \sum_{i=1}^{n} x_i(\bar{x} - x_i) = 0 ]
Expanding:
[ \bar{x}\sum_{i=1}^{n}x_i - \sum_{i=1}^{n}x_i^2 = 0 ;;\Rightarrow;; \bar{x} = \frac{\sum_{i=1}^{n}x_i^2}{\sum_{i=1}^{n}x_i} ]
But for equal lever length, the standard mean (\sum x_i/n) is the equilibrium point. The centroid argument justifies why division by (n) balances the moment.
2.2. Convexity & Jensen’s Inequality
For any convex function (f),
[ f!\Bigl(\frac{1}{n}\sum x_i\Bigr) \le \frac{1}{n}\sum f(x_i) ]
Setting (f(x)=x) (linear), we recover equality. This shows that the arithmetic mean is a linear transformation, preserving convexity exactly.
3. Deeper Theory
3.1. Weighted Averages
If observations have different importances (w_i>0):
[ \bar{x}w = \frac{\sum{i=1}^{n} w_i x_i}{\sum_{i=1}^{n} w_i} ]
- Special Case: (w_i = 1) → ordinary mean.
- Interpretation: Weighted mean is the center of mass when each observation carries mass (w_i).
3.2. Generalized Means (Power Means)
For real (p\neq 0),
[ M_p = \Bigl(\frac{1}{n}\sum_{i=1}^{n}x_i^p\Bigr)^{1/p} ]
- (p=1): Arithmetic mean.
- (p=2): Root‑mean‑square (RMS).
- (p\to 0): Geometric mean.
- (p\to -\infty): Harmonic mean.
Monotonicity: If (p<q), then (M_p \le M_q). This is a direct consequence of Hölder’s inequality.
3.3. Robustness & Influence Functions
- Influence function of the arithmetic mean: (IF(x) = x - \bar{x}).
- Linear and unbounded: a single outlier can shift (\bar{x}) arbitrarily.
- Robust alternatives: median, trimmed mean, Winsorized mean.
4. Edge Cases & Pathologies
| Case | Description | Effect on (\bar{x}) |
|---|---|---|
| Zero‑count | (n=0). | Undefined; often treated as NaN or error. |
| Infinite values | One or more (x_i = \pm\infty). | (\bar{x}) becomes (\pm\infty) unless infinite terms cancel (rare). |
| Large‑magnitude outliers | (x_{\max}\gg \bar{x}). | Pulls mean toward outlier; relative influence (\approx x_{\max}/(n\bar{x})). |
| Missing data | Some (x_i) unknown. | Use imputation (mean, median) or maximum likelihood under assumptions. |
| Dependent data | Observations not independent. | Standard errors of (\bar{x}) inflate; need variance‑inflation factor or generalized least squares. |
5. Practical Computation Tips
-
Numerical Stability
- Kahan summation or pairwise summation to reduce floating‑point errors.
- For very large (n) or huge values, use online algorithms:
[ \bar{x}_{k+1} = \bar{x}k + \frac{x{k+1} - \bar{x}_k}{k+1} ]
-
Streaming Data
- Maintain running sum & count; update as new data arrive.
- For weighted streams, keep running weighted sum and total weight.
-
Memory Constraints
- When (n) is huge (e.g., terabytes), compute (\bar{x}) in chunks and reconcile:
[ \bar{x} = \frac{\sum_j w_j \bar{x}_j}{\sum_j w_j} ] where (j) indexes chunks.
- When (n) is huge (e.g., terabytes), compute (\bar{x}) in chunks and reconcile:
6. Challenging Problem (MIT‑Level)
Problem Statement
Let (X={x_1,\dots,x_n}) be a set of positive real numbers. Suppose we can replace any one element (x_k) by a non‑negative value (y) (i.e., (y\ge 0)) to minimize the arithmetic mean of the new set.
- Show that the optimal (y) is always (0).
- Derive a closed‑form expression for the minimal possible mean in terms of the original sum (S=\sum_{i=1}^{n}x_i) and (n).
- If instead we constrain (y) to lie in ([a,b]) with (0<a<b), find the optimal (