a sequence defined by a measurable set, with Lebesgue measure 1/2 Let $A$ be a subset of $[0,1]$ with Lebesgue measure $\mu(A) = 1/2$.
Let $I_{i,n} ~ = ~ [(i-1)/n,i/n]$.
I am interested in the sequence:
$$S_n(A) = n\sum_{i=1}^n \mu(A \cap I_{i,n} )^2 $$
I can show that $S_n(A)$ is between $1/4$ and $1/2$.
My question is: Does $S_n(A)$ converge to $1/2$ ?
I can show it is true when $A$ is a finite union of intervals.
For large $n$, all except a finite number of the $I_{i,n}$ are inside or outside $A$.
For general $A$, the Lebesgue density theorem seems relevant.
If the answer is no, then what is the smallest possible value of
$\liminf S_n(A)$, as $A$ ranges over all measurable sets with $\mu(A) = 1/2$ ?  
 A: The answer to the question is yes.
Rewrite the sequence as:
$$S_n(A) = \sum_{i=1}^n n^{-1} ( n \mu(A \cap I_{i,n} ) )^2 $$
For each $n$ define a step function by:
$$f_n(x) = n \mu( A \cap I_{i,n} ) ~~ {\rm for} ~~ x \in I_{i,n}$$
and note that
$$\int_0^1 f_n(x)^2 \,dx  = S_n(A) $$
Fix an $x \in [0,1]$ and set $E_n$ to the interval $I_{i,n}$ that contains $x$.  Then $E_n$ "shrinks nicely" to $x$ (as defined by Rudin).
By the Lebesgue differentiation theorem, $f_n$ converges a.e. to ${\bf1}_A$ 
$$f_n \rightarrow {\bf1}_A ~~~ \rm a.e.$$
where ${\bf1}_A$ is the indicator function of $A$.
Because squaring is continuous
$$f_n^2 \rightarrow {\bf1}^2_A = {\bf1}_A ~~~ \rm a.e.$$
Obviously $|f_n^2| \le {\bf1}$, so by the Lebesgue dominated convergence theorem
$$\int_0^1 f_n^2 \,dx  \rightarrow   \int_0^1  {\bf1}_A \,dx  ~~=~~  \mu(A) = 1/2$$
As a followup, does anyone know of a set $A$ where the difference between these integrals goes to $0$ slower than $O(1/n)$ ?
For example, $O(1/\sqrt n )$ ?
Terry Tao has written that the convergence can be arbitrarily slow, 
but I am not able to make an example.
