How to compute $\displaystyle\lim_{n\to\infty} \frac1{n+1}\sum_{k=1}^n \left|X+\frac kn\right|-\left|X-\frac kn\right|$?

127 Views Asked by At

I was just playing around with the real absolute value, trying to build something smooth (for no particular reason). After some experimentation I got to the sequence $(f_n)_n$ given by $$f_n(X) := \frac1{n+1}\sum_{k=1}^n \left|X+\frac kn\right|-\left|X-\frac kn\right|$$ This sequence got my attention for its graphs (in fact, I build it so its graphs would behave like this):

enter image description here enter image description here enter image description here enter image description here enter image description here

I wonder how to compute $f(X) = \displaystyle\lim_{n\to\infty} f_n(X)$. I haven't been able to solve this not even with the help of Wolfram Mathematica. Is $f$ really smooth? Of course, I'm only interested in values in $(-1, 1)$ for $X$.

2

There are 2 best solutions below

3
On BEST ANSWER

$\frac1{n}\sum_{k=1}^n \left|x \pm\frac kn\right|$ are Riemann sums for $\int_0^1 |x \pm t|\, dt$, respectively, so that $$ \lim_{n \to \infty} f_n(x) = f(x) = \int_0^1 (|x+t|-|x-t|) \, dt \, . $$

This can be integrated, using $\int|x|dx=\frac12x|x|+C$: $$ \begin{align} f(x) &= \bigl. \frac 12 (x+t)|x+t|+\frac 12 (x-t)|x-t|\bigr]_{t=0}^{t=1} \\ &= \frac 12 \bigl( (x+1)|x+1| - 2x |x| + (x-1)|x-1|\bigr) \\ &= \begin{cases} -1 & \text{ for } x \le -1 \\ 2x+x^2 & \text{ for } -1 \le x \le 0 \\ 2x-x^2 & \text{ for } 0 \le x \le 1 \\ 1 & \text{ for } x \ge 1 \\ \end{cases} \end{align} $$

$f$ is a piecewise quadratic function. One can see that $f$ is continuous everywhere, also that $f$ is differentiable at $x=-1, 0, 1$, but not twice differentiable at those points. In particular it is not a smooth function on $(-1, 1)$.

enter image description here

0
On

Assume without loss of generality that $0 < X < 1$, since $f_n$ is symmetric and $f_n(X) = 1$ for $X \ge 1$. Then we have $$\left|X + \frac{k}{n}\right| - \left|X - \frac{k}{n}\right| = \begin{cases}2X, & 0 < X < k/n \\ 2k/n, & k/n \le X < 1. \end{cases}$$ Consequently, $$\begin{align} f_n(X) &= \frac{1}{n+1} \left( \sum_{k=1}^{\lfloor nX \rfloor} \frac{2k}{n} + \sum_{k=\lfloor nX \rfloor + 1}^n 2X \right) \\ &= \frac{1}{n+1}\left(\frac{\lfloor nX \rfloor (1 + \lfloor nX \rfloor)}{n} + 2X (n - \lfloor nX \rfloor)\right) \\ &= \frac{2n^2 X + \lfloor nX \rfloor (1 - 2nX + \lfloor nX \rfloor)}{n(n+1)}. \end{align}$$

For a fixed $X \in (0,1)$, we note that $nX - 1 < \lfloor nX \rfloor \le nX$, so that $$f_n(X) \le \frac{2n^2 X + nX (1 - 2nX + nX)}{n(n+1)} = \frac{X + 2nX - nX^2}{n+1},$$ and $$\lim_{n \to \infty} f_n(X) \le X(2-X).$$ Similarly, $$f_n(X) \ge \frac{2n^2 X + nX (1 - 2nX + nX - 1)}{n(n+1)} = \frac{nX(2-X)}{n+1}$$ and $$\lim_{n \to \infty} f_n(X) \ge X(2-X).$$ So by the squeeze theorem, $$f(x) = \lim_{n \to \infty} f_n(X) = X(2-X)$$ for $0 < X < 1$, and we have more generally $$f(X) = \begin{cases} -1, & X \le -1 \\ X(2-|X|), & |X| < 1 \\ 1, & X \ge 1. \end{cases}$$