How to Compute Limit of Sum Involving Absolute Values

absolute valuelimitsreal-analysissmooth-functions

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$.

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

Related Question