Problem about Riemann lower sum in piecewise-defined function We have real piecewise function $f(x)$ such that:
$$f(x)=\begin{cases}
x&\text{if $x\geq 0$,}\\
1-x&\text{if $x<0$.}
\end{cases}$$
We define $L_n$ as the lower Riemann sum for a given interval by breaking the interval to $n$ partitions. For example for $n =2$ and $[0,2]$ the partitions are $[0,1],[1,2]$.
We want to find a general equation for $L_{2n}$ of $f(x)$ in interval $[-1,1]$ in terms of $n$. In the book I saw this problem the answer was $L_{2n} = 2-\frac{1}{n}$. in the solution it said we have $n$ intervals between $[-1,0]$ and $n$ intervals between $[0,1]$. then it calculated the sums and got the above equation. My problem is that in the solution, for $x=0$ in the left interval, it said $\inf f(x) = 1$ and for the right interval it said $\inf f(x) =0$. I think it is wrong. In the definition of lower sum, it is said that we must use infimum of $f(x)$ in the (closed) interval $[a,b]$ so in the interval $[-\frac{1}{n},0]$ I think we must use $0$ for $\inf f(x)$.
If we use the method given in the book, for $n =1$ or $2n=2$, the lower sum would be $L_{2*1} = 2-\frac{1}{1} = 1$ but if we use the method I said, it would be $0$. because $f(-1) = 2, f(0) = 0 , f(1) = 1$ so the infimum in both intervals are $0$ and $\frac{2}{2}(0+0) = 0$
So, which method is right?
 A: The evaluation of this Riemann lower sum $L_{2n}$ depends on its definition.
Let $x_j=j/n$ with $j=-n,\dots, n$ is a uniform partition of the interval $[-1,1]$ and note that $f$ is decreasing in $[-1,0]$ and increasing in $[0,1]$. Let $f_1(x)=1-x$ and $f_2(x)=x$. 
1) The infimum is taken over the half-closed interval $[x_{j-1},x_j)$:
$$
\begin{align}
L_{2n}&=\frac{1}{n}\sum_{j=-n+1}^{n}\inf_{t\in [x_{j-1},x_j)}f(t) \\
&=\frac{1}{n}\sum_{j=-n+1}^{0}f_1(x_j)+\frac{1}{n}\sum_{j=0}^{n-1}f_2(x_j)=1-\frac{1}{n^2}\sum_{j=-n+1}^{0}j+\frac{1}{n^2}\sum_{j=0}^{n-1}j\\
&=1+\frac{1}{n^2}\sum_{j=0}^{n-1}j+\frac{1}{n^2}\sum_{j=0}^{n-1}j=1+\frac{n(n-1)}{n^2}=2-\frac{1}{n}.
\end{align}$$
2) The infimum is taken over the closed interval $[x_{j-1},x_j]$:
$$\begin{align}
L_{2n}&=\frac{1}{n}\sum_{j=-n+1}^{n}\inf_{t\in [x_{j-1},x_j]}f(t) \\
&=\frac{1}{n}\sum_{j=-n+1}^{-1}f_1(x_j)+\frac{f_2(x_0)}{n}+\frac{1}{n}\sum_{j=0}^{n-1}f_2(x_j)=\frac{n-1}{n}-\frac{1}{n^2}\sum_{j=-n+1}^{-1}j+\frac{1}{n^2}\sum_{j=0}^{n-1}j\\
&=\frac{n-1}{n}+\frac{1}{n^2}\sum_{j=1}^{n-1}j+\frac{1}{n^2}\sum_{j=0}^{n-1}j=\frac{n-1}{n}+\frac{n(n-1)}{n^2}=2-\frac{2}{n}.
\end{align}$$
