Standard deviation (sample) / average leads to constant when all values but one are zero I was doing some database work for a client, and I came across an oddity that I hoped someone could explain.
Take the sequence 0,0,0...,0,n (where n is any non-zero number), calculate the standard deviation (sample), and divide that by the average, and you always get the square root of the total number of samples.
e.g.(for 5 samples)
0,0,0,0,100 = 2.236067977
0,0,0,0,-0.21 = -2.236067977

(for 12 samples)
0,0,0,0,0,0,0,0,0,0,0,22 = 3.464101615
0,0,0,0,0,0,0,0,0,0,0,-0.1 = -3.464101615

Is there an obvious explanation for this?
 A: Assuming $ x_i = 0 $ for $ i \neq N $ as in yout example.
Mean:
$$ \bar x = \frac{1}{N}\sum_{i=1}^Nx_i = \frac{x_N}{N} $$
Variation:
$$ \sigma^2 = \frac{1}{N-1}\sum_{i=1}^N(x_i-\bar x)^2 $$
Ratio $ \sigma/\bar x $
$$ \frac{\sigma^2}{\bar x^2} = \frac{1}{N-1}\sum_{i=1}^N\left(\frac{x_i}{\bar x} - 1\right)^2 = \frac{1}{N-1}(N-1) + \frac{1}{N-1}\left(\frac{x_N}{x_N/N} - 1\right)^2 = 1 + (N-1) = N $$
Note how the sum becomes $ N-1 $ terms of $(-1)^2=1$ and the the final different term.
A: The sample standard deviation divided by the average (the coefficient of variation, or abbreviated 'CV) can be denoted as:
$$CV = \frac{\sigma}{\mu}$$
or (with the sample standard deviation)
$$ CV= \frac{\sqrt{\frac{1}{n-1}\sum_{i=1}^n(x_i-\bar x)^2}}{\frac{1}{n}\sum_{i=1}^nx_i} $$
When all entries (n-entries) from the sequence are zero, except for one (let's call this entry $E$), we know that the average will be uniformly distributed over the sequence, so $$\mu= \frac{E}{n}$$
And then we can also write the $CV$ differently, as:
$$ CV= \frac{\sqrt{\frac{1}{n-1}\sum_{i=1}^{n-1}(\frac{E}{n})^2+(E-\frac{E}{n})^2}}{\frac{E}{n}} $$
or as
$$ CV= \frac{\sqrt{\frac{1}{n-1}\times[(n-1)(\frac{E}{n})^2+(E-\frac{E}{n})^2}]}{\frac{E}{n}} $$
easier to simplify, we take:
$$ CV= \frac{\sqrt{\frac{1}{n-1}\times[(n-1)(\frac{E}{n})^2+(E-\frac{E}{n})^2}]n}{E} $$
which simplifies to:
$$\frac{n\frac{E}{\sqrt{n}}}{E}$$ and leaves you $$\sqrt{n}$$
