A b o u t   M e      |       P r o j e c t s     |       N o t e s       |       T h e   D a y    ︎ ︎

Maximum of Variance

    Suppose that a vector `x in mathbb{R^n}` consists of the elements which are in `[0, c]` for a positive real number `c`. Then
\begin{align} \sum_{i=1}^n x_i^2 \leq \sum_{i=1}^n c x_i = c \sum_{i=1}^n x_i = c n \bar{x}\end{align}  where `bar{x}` is the mean of `x` elements. Let `Var(x)` be the variance of `x` elements, then \begin{align} Var(x) &= \frac{1}{n} \sum_{i=1}^n (x_i - \bar{x})^2 = \frac{1}{n} \sum_{i=1}^n (x_i^2 - 2\bar{x} x_i + \bar{x}^2) \\ &= \frac{1}{n} \left\{ \sum_{i=1}^n x_i^2 - 2\bar{x} \sum_{i=1}^n x_i + n \bar{x}^2 \right\} = \frac{1}{n} \left\{ \sum_{i=1}^n x_i^2 - 2n \bar{x}^2 + n \bar{x}^2 \right\} \\ &= \frac{1}{n}\left\{ \sum_{i=1}^n x_i^2 - n \bar{x}^2 \right\} \leq \frac{1}{n} (c n \bar{x}  - n \bar{x}^2) = c \bar{x} - \bar{x}^2 \end{align}    If we define `f(bar{x})=cbar{x}-bar{x}^2`, then its extreme value is as follows:\begin{equation} f(\bar{x}) = c \bar{x} - \bar{x}^2 \\ f^{\prime}(\bar{x}) = c - 2\bar{x} = 0 \Rightarrow \bar{x} = \frac{c}{2} \\ f\left( \frac{c}{2} \right) = \frac{c^2}{2} - \frac{c^2}{4} = \frac{c^2}{4}   \end{equation}     It yields the following boundary. \begin{align} Var(x) \leq c\bar{x} - \bar{x}^2 \leq \frac{c^2}{4} \end{align}