Tutorials › Calculus I › Linear Functions and Triangular Area

Riemann Sums and the Integral · Tutorial 955 of 1495

Linear Functions and Triangular Area

Use uniform-partition sums to calculate affine-function integrals and see why the result matches the signed area of a triangle or trapezoid.

Intermediate 10 min read

What You'll Learn

  • Write the right-endpoint Riemann sum for an affine function on a uniform partition.
  • Derive the sum formula using the arithmetic-series identity.
  • Obtain the integral from the endpoint values of the function.
  • Interpret the result as triangular or trapezoidal area when the graph lies above the horizontal axis.
  • Identify why omitting the partition width gives an incorrect Riemann sum.

From Uniform Sums to Area

A straight-line graph makes the relationship between a Riemann sum and geometric area especially visible. On each subinterval, a Riemann sum uses a rectangle whose height is a function value. As the subintervals become narrower, the sum approaches the integral. For an affine function, we can calculate that limit directly and compare it with the area of the triangle or trapezoid under the graph.

The calculation will use right endpoints on a uniform partition. The definite integral is defined through limits of tagged Riemann sums, and the earlier material on Riemann integrability establishes that continuous functions are integrable and that the limit does not depend on the tag choices. Since an affine function is continuous, a convenient choice of tags is enough to find its integral.

The Affine Function and Its Uniform Sum

Definition: An affine function has the form \(f(x)=mx+c\), where \(m\) and \(c\) are fixed real numbers. On an interval \([a,b]\), with \(a<b\), divide the interval into \(n\) equal subintervals. Their common width is \(\Delta x=(b-a)/n\), and the right endpoint of subinterval \(i\) is \(x_i=a+i\Delta x\), for \(i=1,\ldots,n\). The right-endpoint Riemann sum is \(R_n=\sum_{i=1}^{n} f(x_i)\Delta x\).

The factor \(\Delta x\) is the width of each rectangle. It is essential: the function value gives the rectangle's height, while the width times the height gives its contribution to the sum.

For the right endpoints, the function values form an arithmetic sequence. We will use the identity \(1+2+\cdots+n=n(n+1)/2\). To see why it holds, write the sum forward and backward: \(S=1+2+\cdots+n\) and \(S=n+(n-1)+\cdots+1\). Adding corresponding terms gives \(2S=n(n+1)\), so \(S=n(n+1)/2\).

Deriving the Integral Formula

For \(f(x)=mx+c\), the value at the right endpoint \(x_i=a+i\Delta x\) is \(f(x_i)=f(a)+mi\Delta x\). Substitute these values into the right-endpoint sum, use the arithmetic-series identity, and then let the number of subintervals tend to infinity.

$$ \begin{aligned} R_n &=\sum_{i=1}^{n}\bigl(f(a)+mi\Delta x\bigr)\Delta x\\ &=n f(a)\Delta x+m(\Delta x)^2\sum_{i=1}^{n}i\\ &=(b-a)f(a)+m\left(\frac{b-a}{n}\right)^2\frac{n(n+1)}{2}\\ &=(b-a)f(a)+\frac{m(b-a)^2}{2}\left(1+\frac{1}{n}\right). \end{aligned} $$

As \(n\) increases without bound, \(1/n\) tends to zero. Because the affine function is Riemann integrable, the limit of these sums is its definite integral. Also, \(f(b)=f(a)+m(b-a)\), so the limit can be written using the two endpoint values.

$$ \begin{aligned} \int_a^b f(x)\,dx &=(b-a)f(a)+\frac{m(b-a)^2}{2}\\ &=(b-a)\left(f(a)+\frac{m(b-a)}{2}\right)\\ &=\frac{b-a}{2}\bigl(f(a)+f(b)\bigr). \end{aligned} $$
Theorem: For an affine function \(f(x)=mx+c\) on an interval \([a,b]\), where \(a<b\), $$ \int_a^b f(x)\,dx=\frac{b-a}{2}\bigl(f(a)+f(b)\bigr). $$ The formula follows from uniform right-endpoint sums and holds whether the slope is positive, negative, or zero.

The expression on the right is the interval width multiplied by the average of the function's endpoint values. Geometrically, that is the area formula for a trapezoid whose parallel sides have lengths \(f(a)\) and \(f(b)\), provided the graph lies above the horizontal axis throughout the interval. If one endpoint value is zero and the other is positive, the trapezoid is a triangle.

Worked Examples

Worked Example: A Line That Forms a Triangle

Find the integral of \(f(x)=3x\) on \([0,2]\) directly from uniform right-endpoint sums, then compare it with the area under the graph.

With \(n\) equal subintervals, the width is \(\Delta x=2/n\), and the \(i\)-th right endpoint is \(x_i=2i/n\). Therefore \(f(x_i)=3(2i/n)=6i/n\). The Riemann sum is

$$ \begin{aligned} R_n &=\sum_{i=1}^{n}\frac{6i}{n}\frac{2}{n}\\ &=\frac{12}{n^2}\sum_{i=1}^{n}i\\ &=\frac{12}{n^2}\frac{n(n+1)}{2}\\ &=6\frac{n+1}{n} =6+\frac{6}{n}. \end{aligned} $$

Taking the limit gives \(\int_0^2 3x\,dx=6\). The endpoint heights are \(f(0)=0\) and \(f(2)=6\). The region under the graph is a triangle with base \(2\) and height \(6\), so its area is \(\frac12(2)(6)=6\). This agrees with the Riemann-sum limit and with the endpoint formula \(\frac{2}{2}(0+6)=6\).

Worked Example: A Line Above the Axis

Calculate the integral of \(f(x)=2x+1\) on \([0,3]\) using a uniform right-endpoint sum. Then check the result geometrically.

The common width is \(\Delta x=3/n\), and the right endpoints are \(x_i=3i/n\). Thus \(f(x_i)=6i/n+1\). Substitution into the sum gives

$$ \begin{aligned} R_n &=\frac{3}{n}\sum_{i=1}^{n}\left(\frac{6i}{n}+1\right)\\ &=\frac{3}{n}\left(\frac{6}{n}\frac{n(n+1)}{2}+n\right)\\ &=\frac{3}{n}\bigl(3(n+1)+n\bigr)\\ &=\frac{3}{n}(4n+3) =12+\frac{9}{n}. \end{aligned} $$

Therefore \(\int_0^3(2x+1)\,dx=12\). At the endpoints, \(f(0)=1\) and \(f(3)=7\). The graph stays above the axis, and the trapezoid under it has width \(3\) and parallel sides \(1\) and \(7\). Its area is \(\frac{3}{2}(1+7)=12\), confirming the limit and the endpoint formula.

Worked Example: A Decreasing Line Above the Axis

Find the integral of \(f(x)=5-2x\) on \([0,2]\) from right-endpoint sums, and interpret the result.

Here \(\Delta x=2/n\) and \(x_i=2i/n\), so \(f(x_i)=5-4i/n\). Hence

$$ \begin{aligned} R_n &=\frac{2}{n}\sum_{i=1}^{n}\left(5-\frac{4i}{n}\right)\\ &=\frac{2}{n}\left(5n-\frac{4}{n}\frac{n(n+1)}{2}\right)\\ &=\frac{2}{n}\bigl(5n-2(n+1)\bigr)\\ &=\frac{2}{n}(3n-2) =6-\frac{4}{n}. \end{aligned} $$

Thus \(\int_0^2(5-2x)\,dx=6\). The endpoint values are \(f(0)=5\) and \(f(2)=1\), so the graph remains above the axis. The trapezoid area is \(\frac{2}{2}(5+1)=6\), which checks the result. The fact that this line is decreasing does not change the formula; it changes which endpoint has the larger height.

Why the Geometric Check Works

On \([a,b]\), an affine graph is a straight segment joining \((a,f(a))\) to \((b,f(b))\). If both endpoint heights are nonnegative, the region under the graph and above the horizontal axis is a trapezoid, possibly with one side of length zero. Its area is the width times the average of the two parallel-side lengths:

$$ \text{area}=\frac{b-a}{2}\bigl(f(a)+f(b)\bigr). $$

This is exactly the value obtained from the Riemann-sum limit. When one endpoint height is zero and the other is positive, the trapezoid has a zero-length side and is a triangle. The integral therefore agrees with the familiar triangular-area calculation in that case.

The endpoint formula is an integral formula, even when a geometric area interpretation does not apply directly. For example, if the graph lies below the horizontal axis, the integral is negative rather than the positive geometric area. The formula still holds because it was derived from the Riemann sums. This tutorial's triangle and trapezoid comparisons use graphs that stay above the axis.

A Common Mistake: Forgetting the Width

For \(f(x)=x\) on \([0,2]\), the right endpoints are \(x_i=2i/n\). A common error is to add the function values but forget to multiply each one by the subinterval width. That incorrect calculation gives

$$ \sum_{i=1}^{n} f(x_i) =\sum_{i=1}^{n}\frac{2i}{n} =\frac{2}{n}\frac{n(n+1)}{2} =n+1. $$

This expression grows without bound, but it is not a Riemann sum: it omits the rectangle width \(\Delta x=2/n\). The correct sum is

$$ \sum_{i=1}^{n} f(x_i)\Delta x =\frac{2}{n}\sum_{i=1}^{n}\frac{2i}{n} =\frac{4}{n^2}\frac{n(n+1)}{2} =2+\frac{2}{n}. $$

Its limit is \(2\). The endpoint formula confirms the answer: \(\frac{2}{2}(f(0)+f(2))=0+2=2\). Always include the subinterval width in every term of a Riemann sum.

Check Your Understanding

Use the uniform-partition method and endpoint formula from this tutorial to answer the following.

  1. For \(f(x)=4x\) on \([0,1]\), what are the uniform right endpoints and the width when the interval is divided into \(n\) pieces?
  2. What identity for \(1+2+\cdots+n\) is used to simplify the right-endpoint sum?
  3. For an affine function on \([a,b]\), explain why the integral formula can be written using \(f(a)\) and \(f(b)\).
  4. If an affine graph stays above the horizontal axis and has endpoint heights \(0\) and \(8\), what kind of region lies under it, and what is its area when the interval width is \(3\)?
  5. Why does adding only the function values at the right endpoints fail to give the Riemann sum?

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon