# Normalizing to zero mean or median

Pick two random numbers ${x_1,x_2}$ from the interval ${[0,1]}$; independent, uniformly distributed. Normalize them to have mean zero, which simply means subtracting their mean ${(x_1+x_2)/2}$ from each. Repeat many times. Plot the histogram of all numbers obtained in the process.

No surprise here. In effect this is the distribution of ${Y=(X_1-X_2)/2}$ with ${X_1,X_2}$ independent and uniformly distributed over ${[0,1]}$. The probability density function of ${Y}$ is found via convolution, and the convolution of ${\chi_{[0,1]}}$ with itself is a triangular function.

Repeat the same with four numbers ${x_1,\dots,x_4}$, again subtracting the mean. Now the distribution looks vaguely bell-shaped.

With ten numbers or more, the distribution is not so bell-shaped anymore: the top is too flat.

The mean now follows an approximately normal distribution, but the fact that it’s subtracted from uniformly distributed ${x_1,\dots,x_{10}}$ amounts to convolving the Gaussian with ${\chi_{[0,1]}}$. Hence the flattened top.

What if we use the median instead of the mean? With two numbers there is no difference: the median is the same as the mean. With four there is.

That’s an odd-looking distribution, with convex curves on both sides of a pointy maximum. And with ${10}$ points it becomes even more strange.
k = 10
histplot(100,A(:))