Tutorials › Calculus I › The Cubic Function and Sums of Cubes

Riemann Sums and the Integral · Tutorial 957 of 1495

The Cubic Function and Sums of Cubes

Learn to compute the integral of the cubic function directly from uniform-partition sums and the formula for the sum of cubes.

Intermediate 9 min read

What You'll Learn

  • Set up right-endpoint Riemann sums for the cubic function on a general interval
  • Expand the sums and use formulas for the first, second, and third power sums
  • Derive the sum-of-cubes identity and apply it to the integral limit
  • Obtain the cubic integral on any interval, including intervals containing negative values
  • Check the derivation with exact examples and identify a common indexing error

From Cubic Values to an Integral

The function \(f(x)=x^3\) changes across an interval, so its integral is not simply the function value at one point multiplied by the interval length. The Riemann-sum definition instead divides the interval into smaller pieces, samples the function on each piece, and takes a limit as the pieces become narrow.

For the cubic function, a uniform partition makes each sample point an integer multiple of a single step size, after accounting for the left endpoint. Expanding the cube then reduces the Riemann sum to familiar finite sums. The sum-of-cubes formula is especially useful: its exact expression makes the limiting value visible.

Goal: Starting from uniform right-endpoint Riemann sums, derive the value of \(\int_a^b x^3\,dx\) for real numbers \(a<b\), rather than assuming an antiderivative formula.

Uniform Right-Endpoint Sums

Fix real numbers \(a<b\), and let \(n\in\mathbb{N}\) be the number of subintervals. The common width of the subintervals is

$$ \Delta x=\frac{b-a}{n}. $$

The partition points are \(x_k=a+k\Delta x\), for \(k=0,1,\ldots,n\). On the \(k\)-th subinterval \([x_{k-1},x_k]\), choose the right endpoint \(x_k\) as the sample point. The corresponding Riemann sum for \(x^3\) is

$$ S_n=\sum_{k=1}^{n}x_k^3\Delta x =\frac{b-a}{n}\sum_{k=1}^{n}\left(a+\frac{k(b-a)}{n}\right)^3. $$

The mesh size, meaning the largest subinterval width, is \((b-a)/n\), which tends to zero as \(n\) increases. The function \(x^3\) is continuous on the closed bounded interval \([a,b]\), so it is Riemann integrable there. By the definition of the definite integral as a limit of tagged sums, these right-endpoint sums converge to the integral.

Definition: For a uniform partition of \([a,b]\) with \(n\) subintervals, the right-endpoint Riemann sum for \(f\) is \(\sum_{k=1}^{n}f(x_k)\Delta x\), where \(\Delta x=(b-a)/n\) and \(x_k=a+k\Delta x\). If \(f\) is Riemann integrable on \([a,b]\), these sums converge to the definite integral of \(f\) on \([a,b]\) as \(n\to\infty\).

The Finite-Sum Formulas We Need

Expanding \((a+k\Delta x)^3\) produces sums of \(1\), \(k\), \(k^2\), and \(k^3\). For every positive integer \(n\), the needed identities are

$$ \sum_{k=1}^{n}1=n,\qquad \sum_{k=1}^{n}k=\frac{n(n+1)}{2}, $$ $$ \sum_{k=1}^{n}k^2=\frac{n(n+1)(2n+1)}{6},\qquad \sum_{k=1}^{n}k^3=\left(\frac{n(n+1)}{2}\right)^2. $$

The sum-of-cubes identity can be justified directly by induction. For \(n=1\), the sum is \(1\), which equals \((1\cdot2/2)^2\). Suppose the identity holds for \(n\). Adding the next cube gives

$$ \sum_{k=1}^{n+1}k^3 =\left(\frac{n(n+1)}{2}\right)^2+(n+1)^3 $$ $$ =(n+1)^2\left(\frac{n^2}{4}+n+1\right) =(n+1)^2\frac{(n+2)^2}{4} =\left(\frac{(n+1)(n+2)}{2}\right)^2. $$

This is the required formula with \(n+1\) in place of \(n\), so induction proves it for every positive integer \(n\). The formulas for the first and second power sums are the standard finite-sum identities; we will use them alongside the cubic identity.

Deriving the Cubic Integral

Write \(h=b-a\), so \(\Delta x=h/n\) and \(x_k=a+kh/n\). Substitute this into the right-endpoint sum and expand the cube using \((u+v)^3=u^3+3u^2v+3uv^2+v^3\):

$$ S_n=\frac{h}{n}\sum_{k=1}^{n} \left(a^3+3a^2\frac{kh}{n}+3a\frac{k^2h^2}{n^2}+\frac{k^3h^3}{n^3}\right). $$

Now apply the four finite-sum formulas. Keeping each contribution separate makes the powers of \(n\) and the limit easier to check:

$$ S_n =a^3h +\frac{3a^2h^2}{n^2}\frac{n(n+1)}{2} +\frac{3ah^3}{n^3}\frac{n(n+1)(2n+1)}{6} +\frac{h^4}{n^4}\left(\frac{n(n+1)}{2}\right)^2. $$

Cancel the common factors in each term. For the term involving squares, use \((n+1)(2n+1)=2n^2+3n+1\). This gives an exact expression for every \(n\):

$$ S_n =a^3h +\frac{3}{2}a^2h^2\left(1+\frac{1}{n}\right) +\frac{1}{2}ah^3\left(2+\frac{3}{n}+\frac{1}{n^2}\right) +\frac{h^4}{4}\left(1+\frac{1}{n}\right)^2. $$

As \(n\to\infty\), both \(1/n\) and \(1/n^2\) tend to zero. Therefore the sums converge to

$$ a^3h+\frac{3}{2}a^2h^2+ah^3+\frac{h^4}{4}. $$

Since \(h=b-a\), the binomial expansion of \((a+h)^4\) shows that this expression is \(((a+h)^4-a^4)/4\). Also \(a+h=b\). Thus the integral is

Theorem: For any real numbers \(a<b\), the Riemann integral of the cubic function on \([a,b]\) is
$$ \int_a^b x^3\,dx=\frac{b^4-a^4}{4}. $$
The formula follows from the limit of the uniform right-endpoint sums; continuity of \(x^3\) on \([a,b]\) ensures that this limit is the definite integral.

This derivation does not depend on whether the interval lies above, below, or across zero. The endpoints enter through the partition points, and the same finite-sum calculation applies in all three situations.

Worked Examples

Worked Example: The Cubic Integral from 0 to 2

Take \(a=0\), \(b=2\), and \(h=2\). The partition width is \(2/n\), and the \(k\)-th right endpoint is \(2k/n\). Set up the sum:

$$ S_n=\frac{2}{n}\sum_{k=1}^{n}\left(\frac{2k}{n}\right)^3 =\frac{16}{n^4}\sum_{k=1}^{n}k^3. $$

Use the sum-of-cubes formula and simplify:

$$ S_n=\frac{16}{n^4}\left(\frac{n(n+1)}{2}\right)^2 =\frac{16}{n^4}\frac{n^2(n+1)^2}{4} =4\left(1+\frac{1}{n}\right)^2. $$

Taking the limit gives \(\lim_{n\to\infty}S_n=4\). The general formula gives the same value, since \((2^4-0^4)/4=16/4=4\). Thus \(\int_0^2 x^3\,dx=4\). The exact sum also checks the limit directly: its only extra factor, \((1+1/n)^2\), tends to \(1\).

Worked Example: The Cubic Integral from 1 to 3

Here \(a=1\), \(b=3\), and \(h=2\). Substitute these values into the exact expression for \(S_n\), retaining each term:

$$ S_n =1^3(2) +\frac{3}{2}(1^2)(2^2)\left(1+\frac{1}{n}\right) +\frac{1}{2}(1)(2^3)\left(2+\frac{3}{n}+\frac{1}{n^2}\right) +\frac{2^4}{4}\left(1+\frac{1}{n}\right)^2. $$

Evaluate the constant coefficients:

$$ S_n =2+6\left(1+\frac{1}{n}\right) +4\left(2+\frac{3}{n}+\frac{1}{n^2}\right) +4\left(1+\frac{1}{n}\right)^2. $$

As \(n\to\infty\), the four terms tend respectively to \(2\), \(6\), \(8\), and \(4\), so the Riemann sums tend to \(2+6+8+4=20\). Check with the endpoint formula: \((3^4-1^4)/4=(81-1)/4=80/4=20\). Therefore \(\int_1^3 x^3\,dx=20\).

Worked Example: The Cubic Integral from -1 to 1

This interval crosses zero, but the same sum formula applies. Here \(a=-1\), \(h=2\). Substitution into the exact expression gives

$$ S_n =-2+6\left(1+\frac{1}{n}\right) -4\left(2+\frac{3}{n}+\frac{1}{n^2}\right) +4\left(1+\frac{1}{n}\right)^2. $$

Expand the last factor and collect constant, \(1/n\), and \(1/n^2\) terms:

$$ S_n=(-2+6-8+4) +\frac{6-12+8}{n} +\frac{-4+4}{n^2} =\frac{2}{n}. $$

Thus \(\lim_{n\to\infty}S_n=0\). The general endpoint formula verifies the result: \((1^4-(-1)^4)/4=(1-1)/4=0\). Hence \(\int_{-1}^{1}x^3\,dx=0\), even though the individual right-endpoint sums are \(2/n\), not exactly zero for finite \(n\).

A Common Indexing and Scaling Mistake

A frequent error is to confuse the right endpoint \(x_k=a+kh/n\) with \(kh/n\), which is only correct when \(a=0\). On \([1,3]\), for instance, \(h=2\), so the right endpoint is \(1+2k/n\), not \(2k/n\). Omitting the \(1\) changes every sampled function value.

Another common error is to use the cube-sum identity without preserving its square. For example, the incorrect calculation \(\sum_{k=1}^n k^3=n(n+1)/2\) gives the first-power sum, not the sum of cubes. At \(n=2\), the actual sum is \(1^3+2^3=9\), while that incorrect expression gives \(2\cdot3/2=3\). The correct formula gives \((2\cdot3/2)^2=9\).

Check before taking the limit: Confirm the sample points include the left endpoint \(a\), verify that the factor \(\Delta x=h/n\) multiplies the entire sum, and keep the square in \(\sum_{k=1}^n k^3=(n(n+1)/2)^2\).

Why the Sum-of-Cubes Formula Matters

The cubic function is a simple example of a broader Riemann-sum strategy. The partition gives sample points in a regular pattern; algebra turns function values into powers of the index \(k\); finite-sum identities then produce an exact expression in \(n\). The integral is obtained only after examining the limit of that expression.

For this function, the terms containing \(1/n\) or \(1/n^2\) record finite-partition corrections. They affect the approximating sums but disappear as the mesh shrinks. The remaining terms combine into the difference of fourth powers of the endpoints. This is a direct demonstration of how an accumulation limit can produce a compact endpoint formula.

Check Your Understanding

Use the uniform-partition derivation and the endpoint formula to answer these questions.

  1. For an interval \([a,b]\), what are the uniform step size and the \(k\)-th right endpoint?
  2. State the formula for \(\sum_{k=1}^{n}k^3\), and explain why it is needed when the cubic is expanded.
  3. Compute \(\int_0^1x^3\,dx\) using the endpoint formula.
  4. Evaluate \(\int_{-2}^{0}x^3\,dx\), showing the endpoint powers and the final subtraction.
  5. For the interval \([1,3]\), identify the error in using \(2k/n\) as the right endpoint.

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