The Corner at Zero
The function \(f(x)=|x|\) has a simple formula on either side of zero, but the formula changes at zero:
Its graph has a corner at zero. If an interval runs from a negative number to a positive number, a useful way to construct Riemann sums is to put zero itself into the partition. Then each subinterval lies on just one side of the corner, where the function has a linear formula.
In this tutorial we calculate those sums and take their limit. We will use right endpoints as sample points to make the arithmetic explicit. Since \(|x|\) is continuous, it is Riemann integrable by the earlier result that continuous functions are Riemann integrable. The tagged-sum characterization of the integral then lets us evaluate it by taking the limit of these sums.
Partitioning at Zero
Let \(a<0<b\). Write \(L=-a\) for the length of the interval to the left of zero, and \(R=b\) for the length to the right. Thus \(L>0\), \(R>0\), and the interval is \([-L,R]\).
Divide \([-L,0]\) into \(n\) equal subintervals, and divide \([0,R]\) into \(m\) equal subintervals, where \(n,m\in\mathbb{N}\). The two subinterval widths are
For the left side, use the right endpoint of each subinterval as its sample point. Those endpoints are
Their absolute values are \(L(1-i/n)\) for \(i=1,\ldots,n\). On the right side, the right endpoints are \(jR/m\), for \(j=1,\ldots,m\), and their absolute values are \(jR/m\). Combining the heights and widths gives a tagged Riemann sum \(S_{n,m}\).
The sum of the first \(n\) positive integers is \(n(n+1)/2\). Using this identity in each part gives
The left and right formulas differ slightly at finite \(n\) and \(m\), because the chosen endpoints include zero on the left and use the positive endpoint on the right. Both differences shrink as the subdivisions become finer.
Worked Examples
Worked Example: The Integral from \(-3\) to \(2\)
Here \(L=3\) and \(R=2\). Divide the left side into \(n\) equal pieces and the right side into \(2n\) equal pieces. Substituting \(L=3\), \(R=2\), \(m=2n\) into the sum formula gives
The mesh is the larger of \(3/n\) and \(2/(2n)=1/n\), so it tends to zero as \(n\to\infty\). Therefore the sums tend to \(13/2\). As a check, substituting \(n=1\) into the finite-sum formula gives \(S_{1,2}=3\), and the displayed expression also gives \(13/2-7/2=3\). The limiting value is \(\frac{13}{2}\).
Worked Example: A Symmetric Interval
Consider \([-2,2]\), with \(n\) equal subintervals on each side. Here \(L=R=2\) and \(m=n\). The left and right parts of the sum are
These sums are exactly \(4\) for every \(n\), so their limit is \(4\). For instance, with \(n=3\), the left contribution is \(2-2/3=4/3\), and the right contribution is \(2+2/3=8/3\); together they give \(4/3+8/3=4\). Thus
The exact cancellation here depends on using equal subdivisions on the two sides and the same endpoint convention. The general integral does not require the two subdivision counts to agree.
Worked Example: Unequal Subdivision Counts on \([-3,1]\)
Let \(L=3\), \(R=1\), \(n=4\), and \(m=2\). The left width is \(3/4\); the right width is \(1/2\). The right endpoints on the left are \(-9/4,-3/2,-3/4,0\), with function values \(9/4,3/2,3/4,0\). The left contribution is
The right endpoints are \(1/2\) and \(1\), with function values \(1/2\) and \(1\). The right contribution is
The full sum is \(27/8+6/8=33/8\). This finite sum is an approximation, not the integral itself. To find the integral, let both subdivision counts grow: with \(n\) pieces on each side, the general formula gives
Its limit is \(5\). As a check on the finite calculation, the formula at \(n=4\) gives \(5-4/4=4\), whereas the earlier sum used \(n=4,m=2\), not \(n=m=4\). This difference is expected: those were different partitions. The integral is
Why the Sum Limit Gives the Integral
The calculations above used particular sample points, so it is useful to check why the choice of tags does not affect the limit. For any real \(x,y\), the triangle inequality implies
In particular, within a subinterval of width \(\Delta x_i\), the function values at any two points differ by at most \(\Delta x_i\). If \(\xi_i\) is any tag in that subinterval and \(r_i\) is its right endpoint, then
Multiplying by the subinterval width and adding over the partition bounds the difference between the tagged sum and the right-endpoint sum:
Here \(\|P\|\) is the mesh, or largest subinterval width. The last inequality holds because every \(\Delta x_i\le\|P\|\), and the widths add to \(b-a\). As the mesh tends to zero, this bound tends to zero. Thus changing the tags cannot change the limit of the sums. This also follows from the earlier result that integrable functions have a tag-independent Riemann-sum limit.
Derivation of the General Formula
Set \(L=-a\) and \(R=b\), and use the partition with \(n\) equal pieces on the left and \(m\) equal pieces on the right. Its mesh is \(\max(L/n,R/m)\). If \(n\) and \(m\) both tend to infinity, this mesh tends to zero. The right-endpoint sum already calculated is
The final two terms tend to zero, so the sums converge to \((L^2+R^2)/2\). The tag estimate above shows that other tags on these partitions have the same limit; since \(|x|\) is integrable, this limit is its Riemann integral. Finally, \(L=-a\) and \(R=b\), so \(L^2=a^2\) and \(R^2=b^2\). Therefore
A Common Mistake
A tempting but incorrect shortcut is to apply the formula for the linear function \(x\) across the whole interval, ignoring the change in formula at zero. For example, on \([-3,2]\), that calculation would give
This is not the integral of \(|x|\): for negative \(x\), \(|x|=-x\), which is positive rather than negative. The correct partition includes zero, and the two contributions are \(9/2\) from the left and \(2\) from the right. Their sum is \(9/2+2=13/2\), matching the Riemann-sum limit. The correction is to use the appropriate formula on each side of the corner, not one linear formula across the entire interval.
What the Partition Reveals
Putting zero into the partition turns one calculation across a corner into two simpler calculations, each on a portion where \(|x|\) has a single linear formula. The Riemann sums show how the contributions from those portions combine, even when their lengths or subdivision counts differ. The key result is that for any \(a<0<b\), the integral is \((a^2+b^2)/2\), obtained from the tagged-sum limit rather than assumed from a picture.
Check Your Understanding
Use a partition that includes zero, and justify each limit you use.
- On \([-1,4]\), what are \(L\) and \(R\), and what value does the general formula give for the integral?
- Write the right-endpoint sum when \([-2,0]\) has \(n\) equal pieces and \([0,3]\) has \(m\) equal pieces.
- For \([-1,1]\), use \(n\) equal subintervals on each side to derive the right-endpoint sum and its limit.
- Why does the inequality \(\big||x|-|y|\big|\le|x-y|\) ensure that different tag choices have the same limit as the mesh tends to zero?
- What goes wrong if the function \(x\) is used instead of \(|x|\) on the negative part of an interval crossing zero?