Why Whole-Period Endpoints Help
Integrating a polynomial times a sine or cosine usually produces several terms, because integration by parts transfers derivatives onto the polynomial. If the polynomial has degree \(n\), this process eventually stops: its \((n+1)\)-st derivative is zero. In a definite integral, the resulting antiderivative is evaluated at both endpoints.
When the interval spans one or more whole periods, the sine and cosine have the same values at the two endpoints. This does not usually make the integral zero. Instead, it lets us combine matching trigonometric factors and express the answer through endpoint differences of the polynomial and its derivatives.
Set-Up and Notation
Let \(P\) be a polynomial of degree \(n\), let \(\omega>0\) be a frequency, and let \(\phi\) be a fixed phase. The functions \(\sin(\omega x+\phi)\) and \(\cos(\omega x+\phi)\) have period \(2\pi/\omega\). Thus an interval from \(a\) to \(b\) spans \(N\) whole periods, for a positive integer \(N\), when
In that case, \(\omega b+\phi=\omega a+\phi+2\pi N\). Consequently, the sine and cosine agree at \(a\) and \(b\). Write \(\theta=\omega x+\phi\), and define the endpoint difference of a function \(Q\) by \(\Delta Q=Q(b)-Q(a)\).
Finite Formulas from Integration by Parts
Repeated integration by parts gives antiderivatives with one term for each derivative of \(P\). The process ends after \(P^{(n)}\), since \(P^{(n+1)}=0\). For sine, one convenient form is
The terms continue according to the same four-sign pattern, with each derivative increasing the power of \(\omega\) in the denominator by one. For cosine, the corresponding pattern is
Each displayed sum stops at the last nonzero derivative of \(P\). Substituting the endpoints into these formulas and using the endpoint condition gives concise definite-integral formulas. Let \(\theta_a=\omega a+\phi\); all sine and cosine factors below are evaluated at \(\theta_a\).
In these endpoint formulas, a term involving \(P^{(k)}\) has the same sign and trigonometric factor as its corresponding antiderivative term. The differences \(\Delta P^{(k)}\) are essential: even though the trigonometric factors agree, the polynomial derivatives at \(a\) and \(b\) need not.
Why the Endpoint Formulas Work
The formulas follow directly from integration by parts. For the sine integral, choose an antiderivative of the sine factor and differentiate the polynomial. Since \(\frac{d}{dx}\cos(\omega x+\phi)=-\omega\sin(\omega x+\phi)\), the first integration by parts gives
Applying integration by parts to the remaining cosine integral yields \(P'\sin\theta/\omega^2-(1/\omega^2)\int P''\sin\theta\,dx\). Repeating this process moves one derivative at a time onto \(P\), producing the finite sine antiderivative above. The cosine formula follows in the same way, starting from the antiderivative \(\sin\theta/\omega\) of \(\cos\theta\).
To obtain the definite formulas, evaluate each finite antiderivative at \(b\) and subtract its value at \(a\). For example, the first sine term contributes
This equality uses \(\cos(\omega b+\phi)=\cos\theta_a\). The other terms simplify in exactly the same manner: each shared endpoint trigonometric value factors out, leaving the difference of the corresponding polynomial derivatives. This proves the endpoint formulas.
Worked Examples
Worked Example: A Linear Factor Times Sine
Evaluate \(\int_0^{2\pi}x\sin x\,dx\). The interval is one whole period, and the antiderivative from the sine formula is \(F(x)=-x\cos x+\sin x\). Check it by differentiating:
Now evaluate at the endpoints. Since \(\sin 0=\sin(2\pi)=0\) and \(\cos 0=\cos(2\pi)=1\),
Therefore, \(\int_0^{2\pi}x\sin x\,dx=F(2\pi)-F(0)=-2\pi\). The endpoint formula gives the same result: \(\Delta P=2\pi\), \(\Delta P'=0\), and the common endpoint cosine is \(1\), so the integral is \(-\Delta P=-2\pi\).
Worked Example: A Quadratic Factor Across Two Periods
Evaluate \(\int_0^{4\pi}x^2\cos x\,dx\). The interval covers two periods. An antiderivative is \(F(x)=x^2\sin x+2x\cos x-2\sin x\). Differentiating verifies it:
At \(x=4\pi\), \(\sin(4\pi)=0\) and \(\cos(4\pi)=1\), so \(F(4\pi)=0+8\pi-0=8\pi\). At \(x=0\), \(F(0)=0+0-0=0\). Hence
For an endpoint-formula check, \(P(x)=x^2\), so \(\Delta P=16\pi^2\), \(\Delta P'=8\pi\), and \(\Delta P''=0\). The common endpoint sine is zero and cosine is one. The cosine formula therefore gives \(0+8\pi+0=8\pi\), as required.
Worked Example: A Shifted Phase and Nonunit Frequency
Evaluate \(\int_0^\pi x\cos(2x+\pi/3)\,dx\). Since \(\omega=2\), the period is \(\pi\), so the interval is one whole period. An antiderivative is
Differentiate to check it:
At \(x=\pi\), the angle is \(7\pi/3\), whose sine and cosine are \(\sqrt{3}/2\) and \(1/2\). Thus \(F(\pi)=\pi\sqrt{3}/4+1/8\). At \(x=0\), the angle is \(\pi/3\), giving \(F(0)=0+1/8=1/8\). Subtraction gives
The endpoint formula confirms this: \(\Delta P=\pi\), \(\Delta P'=0\), and \(\sin(\pi/3)=\sqrt{3}/2\). Its cosine-integral value is \(\Delta P\sin(\pi/3)/2=\pi\sqrt{3}/4\).
A Common Mistake: Assuming the Integral Is Zero
A frequent error is to reason that sine or cosine averages to zero over a whole period, and therefore its product with any polynomial must also integrate to zero. That conclusion is not valid: the polynomial changes across the interval and weights different parts of the period differently.
For example, the incorrect argument \(\int_0^{2\pi}x\sin x\,dx=0\) treats \(x\) as though it were constant. The actual calculation is
The correction is to evaluate the full boundary expression, not just the integral of the trigonometric factor. A useful check is to compare the polynomial's endpoint values and derivatives: if they differ, the endpoint terms may contribute even when the trigonometric values match.
Using the Method Efficiently
For a polynomial of degree \(n\), the endpoint formula has at most \(n+1\) terms. Some terms may vanish immediately. For instance, a sine integral has a first boundary contribution involving \(\Delta P\cos\theta_a\); it vanishes if either \(\Delta P=0\) or \(\cos\theta_a=0\). Looking for such zeros can shorten the arithmetic, but it does not remove the need to check the remaining terms.
Verify that \(b-a=2\pi N/\omega\) for a positive integer \(N\).
Compute \(\sin(\omega a+\phi)\) and \(\cos(\omega a+\phi)\); these are also the values at \(b\).
Find its derivatives through the last nonzero one and calculate their endpoint differences.
Use the sine formula for a sine integrand and the cosine formula for a cosine integrand, retaining the frequency powers and signs.
The method is useful because it turns a potentially long definite-integration calculation into a finite list of boundary terms. Its key benefit is not that whole-period integrals disappear, but that the trigonometric factors at the two endpoints can be shared and the remaining work organized through polynomial derivatives.
Check Your Understanding
Use the whole-period endpoint condition and the polynomial derivatives to answer these questions.
- What condition on \(a\), \(b\), and \(\omega\) ensures that \(\sin(\omega x+\phi)\) has equal values at the two endpoints?
- For a sine integral, what are the first two boundary contributions in terms of \(\Delta P\) and \(\Delta P'\)?
- Why does a whole-period interval not guarantee that a polynomial-weighted sine or cosine integral is zero?
- What is the degree of the polynomial-weighted integration process at which its derivative terms stop?
- For \(\int_0^{2\pi}x\sin x\,dx\), identify the nonzero endpoint contribution and state the integral's value.