# Minimal distance limit problem

Consider a square $\{(x,y): 0\le x,y \le 1\}$ divided into $n^2$ small squares by the lines $x = i/n$ and $y = j/n$. For $1\le i \le n$, let $x_i = i/n$ and

$$d_i = \min_{0\le j\le n} \left| \sqrt{1 - x_i^2 } - j/n\right|.$$ Determine $$\lim_{n\to\infty} \sum_{i=1}^n d_i$$ if it exists.

This is a problem I had put aside. I think it can be proved using Weyl's Theorem (see, e.g., Korner, Fourier Anal., p11 (Cambridge), because as $n$ gets large the the behavior of the curve as it cuts the line joining two vertices is not unlike that of the fractional part of $n\cdot a$, $a$ irrational, as it travels around (say) a unit circle.

-