Integrate products, powers of trigonometric functions, square roots of quadratics and rational functions, by parts, with identities, with trigonometric substitutions and with partial fractions. You will also learn to choose a method, to check a computer’s answer, to recognise integrands with no elementary antiderivative, and to bound the error of a numerical approximation when the integrand has the required derivatives.
⏱ 270 minYou need: Modules 1 to 10, especially the product and chain rules (Module 5), the derivatives of Modules 5 and 6, and antiderivatives and substitution (Module 10)
In this module you will
Integrate by parts, choosing u and dv, repeatedly or in a table, in definite integrals and to derive reduction formulas
Integrate powers of sines, cosines, tangents and secants with identities and substitutions
Evaluate integrals containing a2−x2,a2+x2 or x2−a2 by trigonometric substitution, and return to x with a triangle
Integrate rational functions by long division and partial fractions
Choose a method, check a computer’s answer by differentiating it, and recognise integrands with no elementary antiderivative
Approximate integrals with the midpoint, trapezoidal and Simpson’s rules, and bound their errors
1
Integration by parts
Module 10 turned the chain rule round and got the substitution rule. This section turns the product rule round. Products are everywhere in integrals, xcosx,xe−x,x2lnx,exsinx, and Module 10 warned that there is no product rule for antiderivatives: an antiderivative of xcosx is not 21x2sinx (Section 10.1).
Start from the product rule of Module 5, (fg)′=f′g+fg′. Read backwards, it says that fg is an antiderivative of f′g+fg′. So if you can integrate one of the two terms, you can integrate the other. Try it on xcosx, with f(x)=x and g(x)=sinx, so that fg′=xcosx is the integrand and f′g=sinx is easy:
dxd(xsinx)=sinx+xcosx.
So xcosx=(xsinx)′−sinx, and an antiderivative of the right side is xsinx−(−cosx):
∫xcosxdx=xsinx+cosx+C.
Check: dxd(xsinx+cosx)=sinx+xcosx−sinx=xcosx.
Theorem 11.1Integration by parts
Let f and g have continuous derivatives on an interval I. Then, on I,
∫f(x)g′(x)dx=f(x)g(x)−∫f′(x)g(x)dx.
That is: if G is an antiderivative of f′g on I, then fg−G is an antiderivative of fg′.
Proof
The function f′g is continuous on I, so it has an antiderivative G there, by Part 1 of the Fundamental Theorem (Section 10.4). By the product rule,
(fg−G)′=f′g+fg′−f′g=fg′
on I. So fg−G is an antiderivative of fg′.
∎
In Leibniz’s notation, put u=f(x) and v=g(x), so that du=f′(x)dx and dv=g′(x)dx are their differentials. The formula becomes
∫udv=uv−∫vdu,
read “the integral of u d v is u v minus the integral of v d u”. To use it, split the integrand into two factors: u, which you will differentiate, and dv, which includes dx and which you must be able to integrate. The formula trades ∫udv for ∫vdu, and it helps when the new integral is simpler than the old.
Example 11.1Three integrals by parts✓ Checked
Find (a) ∫xe−xdx, (b) ∫lnxdx, for x>0, and (c) ∫arctanxdx.
(a) Let u=x and dv=e−xdx. Then du=dx and v=−e−x; any antiderivative of e−x will do, so take the simplest. So
the last integral by the substitution w=1+x2,dw=2xdx (Module 10), with no absolute value bars because 1+x2>0.
Choosing u and dv
The choice matters. In ∫xcosxdx, take the opposite roles, u=cosx and dv=xdx. Then du=−sinxdx and v=21x2, and
∫xcosxdx=21x2cosx+21∫x2sinxdx.
That is true, but the new integral is harder than the old one: the power of x went up instead of down. Integration by parts pays off when differentiating u makes it simpler, and integrating dv does not make it much worse.
Key idea
A rough guide to the choice of u is the word LIATE. Take for u the factor whose kind comes first in the list
Logarithmic: lnx
Inverse trigonometric: arctanx,arcsinx
Algebraic: powers and polynomials, such as x,x3,x
Trigonometric: sinx,cosx
Exponential: ex,e−2x,2x
and let dv be the rest, with dx. The kinds early in the list get simpler when they are differentiated (lnx becomes 1/x,arctanx becomes 1/(1+x2),x3 becomes 3x2); the kinds late in the list are easy to integrate and stay the same kind.
In ∫xe−xdx, algebraic comes before exponential, so u=x; in ∫lnxdx and ∫arctanxdx, the logarithm and the inverse tangent come first, and dv=dx. But LIATE is a rule of thumb, not a theorem, and the requirement that you can integrate dv comes first.
Example 11.2When the guide misleads✓ Checked
Find ∫x3ex2dx.
LIATE suggests u=x3 and dv=ex2dx. But then v would be an antiderivative of ex2, and no formula built from the functions of Module 1’s catalogue is one (Section 11.6). Split the integrand differently. The factor ex2 can be integrated only together with a factor x, by the substitution w=x2,dw=2xdx:∫xex2dx=21ex2+C. So take
the middle integral by the same substitution. Check: dxd(21(x2−1)ex2)=xex2+21(x2−1)2xex2=x3ex2.
Watch out
Three slips with parts. (1) The sign: ∫udv is uvminus∫vdu.(2) Integrating dv carelessly. In ∫xe3xdx, with u=x and dv=e3xdx,v is 31e3x, not e3x, and the answer is 31xe3x−91e3x+C; with v=e3x you would get xe3x−e3x, whose derivative is 3xe3x−2e3x.(3) A choice that cannot work: a dv you cannot integrate, as in Example 11.2, or a u that does not get simpler. Differentiate the answer to catch all three.
Repeated parts and the tabular method
Sometimes the new integral is simpler but still a product, and a second round of parts finishes the job.
Example 11.3Twice by parts✓ Checked
Find ∫x2sinxdx.
By LIATE, u=x2 and dv=sinxdx, so du=2xdx and v=−cosx:
∫x2sinxdx=−x2cosx+∫2xcosxdx.
The new integrand is again a product, with a lower power of x. It is twice the integral found at the start of this section (by parts with u=x and dv=cosxdx), that is, 2(xsinx+cosx)+C. So
∫x2sinxdx=−x2cosx+2xsinx+2cosx+C.
Each round lowers the power of x by one, so xn needs n rounds.
When u is a polynomial, the rounds follow a pattern that a table organises: the tabular method. Write u and its successive derivatives in one column, down to 0, and the function in dv and its successive antiderivatives in the other. Multiply each entry of the left column by the entry one row lower in the right column, give the products the signs +,−,+,−,… in turn, and add them up.
Example 11.4The tabular method✓ Checked
Find ∫x3e2xdx.
Differentiate x3 until it becomes 0, and integrate e2x as many times:
Sign
Differentiate
Integrate
+
x3
e2x
−
3x2
21e2x
+
6x
41e2x
−
6
81e2x
0
161e2x
Multiplying along the diagonals, with the signs of the first column,
Each diagonal is one round of parts. The first round gives x3⋅21e2x−∫3x2⋅21e2xdx: the first product, minus the integral of the next row’s two entries. That integral is treated the same way, with every sign reversed, and so on. The process stops when the left column reaches 0, because then the leftover integral is 0.
Definite integrals by parts
For a definite integral, evaluate uv between the limits.
Theorem 11.2Integration by parts in definite integrals
If f and g have continuous derivatives on [a,b], then
∫abf(x)g′(x)dx=[f(x)g(x)]ab−∫abf′(x)g(x)dx.
Proof
The functions fg′ and f′g are continuous on [a,b], so both integrals exist. Let G be an antiderivative of f′g on [a,b]. By Theorem 11.1, fg−G is an antiderivative of fg′, so by Part 2 of the Fundamental Theorem (Section 10.5) the left side is [fg−G]ab=[fg]ab−[G]ab, and [G]ab=∫abf′gdx, by Part 2 again.
∎
When u=f(x) and v=g(x) are never negative and both increase with x, the theorem has a picture (Figure 11.1). As x runs from a to b, the point (u,v) traces a curve from (u1,v1) to (u2,v2), where u1=f(a),v1=g(a),u2=f(b) and v2=g(b). The integral ∫vdu=∫abg(x)f′(x)dx is the area between this curve and the u-axis, and ∫udv=∫abf(x)g′(x)dx is the area between the curve and the v-axis. Together the two regions fill the rectangle u2v2 except for the rectangle u1v1:
∫udv+∫vdu=u2v2−u1v1=[uv]ab,
which is Theorem 11.2.
Figure 11.1
Integration by parts as areas. Left: the curve traced by (u,v) from (u1,v1) to (u2,v2). The blue region, between the curve and the u-axis, has area ∫vdu; the orange region, between the curve and the v-axis, has area ∫udv. Together they make the large rectangle u2v2 minus the small rectangle u1v1. Right: the case u=x,v=lnx for 1≤x≤e (Example 11.5(a)). The blue area ∫1elnxdx and the orange area ∫01evdv=e−1 add up to the rectangle e×1, so the blue area is 1.
In some integrals neither factor gets simpler when differentiated. Then two rounds of parts may bring back the integral you started with, and you can solve for it.
Example 11.6An integral that comes back✓ Checked
Find ∫exsinxdx.
Call the integral I. Take u=sinx and dv=exdx, so du=cosxdx and v=ex:
I=exsinx−∫excosxdx.
The new integral is of the same kind. Integrate by parts again, with the factors in the same roles, u=cosx and dv=exdx, so du=−sinxdx:
∫excosxdx=excosx+∫exsinxdx=excosx+I.
Put this into the first equation:
I=exsinx−excosx−I.
The unknown integral appears on both sides, so solve for it as in an equation: 2I=ex(sinx−cosx), and
∫exsinxdx=21ex(sinx−cosx)+C.
Each indefinite integral stands for a family of functions that differ by constants, so these equations hold up to constants; the +C at the end collects them. Check: dxd(21ex(sinx−cosx))=21ex(sinx−cosx)+21ex(cosx+sinx)=exsinx.
Watch out
In the second round, keep the roles of the first. With u=ex and dv=cosxdx instead, the second round undoes the first: ∫excosxdx=exsinx−I, and the first equation becomes I=exsinx−exsinx+I, that is, I=I. True, but no help.
Reduction formulas
Some integrals depend on a whole number n, such as ∫sinnxdx or ∫xnexdx. Integration by parts can lower n. A reduction formula expresses such an integral in terms of the same integral with a smaller n; applied again and again, it brings n down to 0 or 1.
Theorem 11.3A reduction formula for powers of sine
For every whole number n≥2,
∫sinnxdx=−nsinn−1xcosx+nn−1∫sinn−2xdx.
Proof
Write sinnx=sinn−1x⋅sinx and integrate by parts with u=sinn−1x and dv=sinxdx. By the chain rule du=(n−1)sinn−2xcosxdx, and v=−cosx:
(c) In a definite integral, the reduction formula holds with its first term evaluated between the limits (use Theorem 11.2 in the proof). On [0,π/2] that term vanishes at both ends, since sin0=0,cos2π=0 and the power n−1 is at least 1. So, applying the formula twice,
The second line says that ∫0π/2sin2xdx=21⋅2π=4π, as Exercise 10.12 found by symmetry.
2
Trigonometric integrals
Example 11.7 integrated powers of the sine with a reduction formula. Most products of powers of sines and cosines give way faster, to an identity and a substitution. Three identities do the work. The first is the Pythagorean identity sin2x+cos2x=1 of Module 1; dividing it by cos2x gives the second, tan2x+1=sec2x. The third comes from the addition formula cos(x+y)=cosxcosy−sinxsiny of Module 1, with y=x:
cos2x=cos2x−sin2x.
Replacing cos2x by 1−sin2x, or sin2x by 1−cos2x, and solving gives the half-angle identities
sin2xcos2x=21−cos2x,=21+cos2x.
They trade a square for a cosine of twice the angle, which is easy to integrate. In the same way the addition formula for the sine gives sin2x=2sinxcosx.
Powers of sine and cosine
Key idea
To integrate sinmxcosnx, where m and n are whole numbers:
If the power n of the cosine is odd, save one factor cosx, write the remaining even power of the cosine in terms of the sine with cos2x=1−sin2x, and substitute u=sinx,du=cosxdx.
If the power m of the sine is odd, save one factor sinx, use sin2x=1−cos2x, and substitute u=cosx,du=−sinxdx.
If both powers are even, use the half-angle identities, again and again if needed, or the reduction formula of Theorem 11.3.
Example 11.8Odd powers✓ Checked
Find (a) ∫sin3xdx and (b) ∫sin2xcos3xdx.
(a) The power of the sine is odd. Save one sinx:sin3x=sin2x⋅sinx=(1−cos2x)sinx. With u=cosx and du=−sinxdx,
∫sin3xdx=−∫(1−u2)du=−u+3u3+C=−cosx+31cos3x+C.
(b) The power of the cosine is odd. Save one cosx:sin2xcos3x=sin2x(1−sin2x)cosx. With u=sinx and du=cosxdx,
∫sin2xcos3xdx=∫(u2−u4)du=31sin3x−51sin5x+C.
Example 11.9Even powers✓ Checked
Find (a) ∫cos2xdx and (b) ∫0πsin4xdx.
(a) By the half-angle identity, and with ∫cos2xdx=21sin2x+C from Module 10’s table,
∫cos2xdx=21∫(1+cos2x)dx=2x+4sin2x+C.
(b) Square the half-angle identity for sin2x, then use the one for cos2 again, with 2x in place of x:
since all the sines vanish at 0 and at π. This is twice the value 163π found on [0,π/2] in Example 11.7, as it should be: the graph of sin4x is symmetric about x=π/2, because sin(π−x)=sinx.
Watch out
Three slips. (1)sin2x is (sinx)2, not sin(x2).(2) The power rule does not apply to sin2x as if sinx were x:∫sin2xdx is not 31sin3x+C, whose derivative is sin2xcosx by the chain rule. (3)∫cos2xdx=21sin2x+C, not sin2x+C; and cos2x is not 2cosx.
Powers of tangent and secant
For tangents and secants the derivatives (tanx)′=sec2x and (secx)′=secxtanx of Module 5 play the parts of cosx and sinx, and sec2x=1+tan2x plays the part of the Pythagorean identity.
Key idea
To integrate tanmxsecnx, where m and n are whole numbers:
If the power n of the secant is even and at least 2, save sec2x, write the other secants in terms of the tangent with sec2x=1+tan2x, and substitute u=tanx,du=sec2xdx.
If the power m of the tangent is odd and n≥1, save secxtanx, write the other tangents in terms of the secant with tan2x=sec2x−1, and substitute u=secx,du=secxtanxdx.
Otherwise use identities, the integrals of tanx (Example 10.11) and secx (Theorem 11.4), or parts (Example 11.11).
Example 11.10Tangents and secants✓ Checked
Find (a) ∫tan2xsec4xdx, (b) ∫tan3xsecxdx and (c) ∫tan2xdx, on an interval where cosx=0.
(a) The power of the secant is even: tan2xsec4x=tan2x(1+tan2x)sec2x. With u=tanx,
∫(u2+u4)du=31tan3x+51tan5x+C.
(b) The power of the tangent is odd: tan3xsecx=(sec2x−1)secxtanx. With u=secx,
∫(u2−1)du=31sec3x−secx+C.
(c) There is no secant, but the identity still helps:
∫tan2xdx=∫(sec2x−1)dx=tanx−x+C.
The integral of secx itself needs a trick.
Theorem 11.4The integral of the secant
On every interval on which cosx=0,
∫secxdx=ln∣secx+tanx∣+C.
Proof
Where cosx=0,secx+tanx=cosx1+sinx is never 0: 1+sinx=0 would mean sinx=−1, and then cosx=0. So ln∣secx+tanx∣ is differentiable there, and by the chain rule, with dxdln∣w∣=ww′ (Module 6),
The proof checks the formula; it does not show how anyone could find it. Here is one way, with a trick: multiply the integrand by 1, in the form secx+tanxsecx+tanx. Then
∫secxdx=∫secx+tanxsec2x+secxtanxdx,
and the numerator is the derivative of the denominator, so the substitution w=secx+tanx gives ∫wdw=ln∣w∣+C. Tricks like this one come from experience, which is one reason to check every antiderivative by differentiating it. The same trick with cscx−cotx, whose derivative is csc2x−cscxcotx, gives ∫cscxdx=ln∣cscx−cotx∣+C on every interval on which sinx=0.
Example 11.11The secant cubed✓ Checked
Find ∫sec3xdx on an interval where cosx=0.
The power of the secant is odd and there is no tangent, so neither substitution applies. Integrate by parts with u=secx and dv=sec2xdx, so du=secxtanxdx and v=tanx:
The integral has come back, as in Example 11.6. Solve for it, and use Theorem 11.4:
∫sec3xdx=21secxtanx+21ln∣secx+tanx∣+C.
3
Trigonometric substitution
The area of a disc of radius r is πr2, and Module 9 used that formula to evaluate integrals such as ∫039−x2dx (Exercise 9.4). Now integration can find such areas itself. The upper half of the circle x2+y2=r2 is the graph of y=r2−x2, but no substitution u=g(x) of Module 10 helps with this integrand: there is no factor g′(x) to go with dx. Instead, go the other way, and replace x by a function of a new variable. Since 1−sin2θ=cos2θ, the substitution x=rsinθ turns r2−x2 into r2cos2θ, a square root that goes away.
The substitution rule of Module 10 justifies this, read from right to left.
Theorem 11.5Substitution in reverse
Let g have a continuous derivative on an interval J.
(a) If f is continuous on an interval that contains every value of g on J, then for all α and β in J
∫g(α)g(β)f(x)dx=∫αβf(g(θ))g′(θ)dθ.
(b) Suppose that J is open, that g is one-to-one on J, that f is continuous on the interval I of the values of g on J, and that G is an antiderivative of f(g(θ))g′(θ) on J. Then G(g−1(x)) is an antiderivative of f on I.
Proof
(a) is the substitution rule for definite integrals (Theorem 10.7), with x=g(θ), read from right to left. For (b): I is an open interval, because g is continuous and one-to-one on the open interval J. By Part 1 of the Fundamental Theorem, f has an antiderivative F on I, and by the substitution rule (Theorem 10.6), F(g(θ)) is an antiderivative of f(g(θ))g′(θ) on J. So G(θ)=F(g(θ))+C0 for a constant C0 (Theorem 10.1). For x in I, put θ=g−1(x): then G(g−1(x))=F(x)+C0, which is an antiderivative of f.
∎
Three substitutions cover the three square roots of the form ±x2±a2 that can be real. In each row a>0:
Integrand contains
Substitute
Identity used
a2−x2
x=asinθ,−2π≤θ≤2π
1−sin2θ=cos2θ
a2+x2
x=atanθ,−2π<θ<2π
1+tan2θ=sec2θ
x2−a2
x=asecθ,0≤θ<2π
sec2θ−1=tan2θ
The ranges of θ do two jobs. On them cosθ≥0,secθ>0 and tanθ≥0 respectively, so the square roots are a2−x2=acosθ,a2+x2=asecθ and x2−a2=atanθ, with no absolute value signs. And on them each substitution is one-to-one, so θ can be recovered from x:θ=arcsinax,θ=arctanax and, for x≥a,θ=arccosxa (since secθ=x/a means cosθ=a/x).
The secant row covers only x≥a. For x≤−a, take 2π<θ≤π instead, where secθ≤−1. There tanθ≤0, so x2−a2=∣atanθ∣=−atanθ, and the minus sign must be carried through the calculation. In both cases θ=arccosxa, which is arcsecax in the convention of Module 6. Often it is simpler to put x=−t first, so that t≥a.
Example 11.12The area of a circle and of an ellipse✓ Checked
Find the area enclosed by the circle x2+y2=r2, and by the ellipse a2x2+b2y2=1, where r,a and b are positive.
The circle. The upper half of the disc is the region under the graph of y=r2−x2, for −r≤x≤r, and the lower half is its mirror image in the x-axis. So the area of the disc is ∫−rr2r2−x2dx. Substitute x=rsinθ with −2π≤θ≤2π. Then dx=rcosθdθ, and r2−r2sin2θ=r2cos2θ=rcosθ, because cosθ≥0 on this range. The limits x=−r and x=r correspond to θ=−2π and θ=2π. By Theorem 11.5(a) and Example 11.9(a),
The ellipse. Solving its equation for y gives y=±aba2−x2, for −a≤x≤a. In the same way, the upper half of the region inside the ellipse lies under the graph of y=aba2−x2, and the lower half is its mirror image. So the area is ab times that of the disc of radius a:
ab∫−aa2a2−x2dx=ab⋅πa2=πab.
For a=b=r the ellipse is the circle, and πab=πr2, as it should be.
Good to know
Example 11.12 does not prove from nothing that a disc has area πr2. It uses the derivatives of the sine and cosine (Module 5). They rest on the limit sinθ/θ→1, and Module 2 proved that limit with the area π of the disc of radius 1, taken from geometry. What the example proves is that this one fact gives the area of every disc and of every ellipse.
Back to x with a triangle
In an indefinite integral the answer comes out in terms of θ and must be written in terms of x again. A right triangle does it. Draw one with an angle θ whose sides make the substitution true; Pythagoras’ theorem gives the third side, and the other trigonometric functions of θ can be read off (Figure 11.2).
Figure 11.2
The reference triangles of the three substitutions. Left: x=asinθ means sinθ=x/a, opposite side over hypotenuse; the third side is a2−x2, so, for example, cosθ=a2−x2/a and cotθ=a2−x2/x. Middle: x=atanθ, with hypotenuse a2+x2. Right: x=asecθ, that is, cosθ=a/x, with opposite side x2−a2. The triangles show 0<θ<π/2; the formulas read from them hold on the whole ranges in the table.
Example 11.13Back to x✓ Checked
Find ∫x29−x2dx for 0<x<3.
Substitute x=3sinθ with 0<θ<2π, one-to-one onto (0,3). Then dx=3cosθdθ and 9−x2=3cosθ, so
where cot2θ=csc2θ−1 comes from dividing cos2θ+sin2θ=1 by sin2θ, and −cotθ is an antiderivative of csc2θ (Module 10’s table). Now back to x, with the left triangle of Figure 11.2 and a=3:cotθ=x9−x2 and θ=arcsin3x. By Theorem 11.5(b),
∫x29−x2dx=−x9−x2−arcsin3x+C.
The same steps, with −2π<θ<0, give the same formula on (−3,0). Check by differentiating: the derivative of −9−x2/x is x29−x29 (quotient rule, then a common denominator), that of −arcsin3x is −9−x21, and their sum is x29−x29−x2=x29−x2.
Example 11.14Tangent and secant substitutions✓ Checked
Find (a) ∫x2+4dx and (b) ∫xx2−4dx for x>2.
(a) Substitute x=2tanθ with −2π<θ<2π. Then dx=2sec2θdθ and x2+4=4tan2θ+4=2secθ, so, by Theorem 11.4,
The right triangle of Figure 11.2 gives tanθ=2x2−4, and cosθ=x2 gives θ=arccosx2. So, for x>2,
∫xx2−4dx=x2−4−2arccosx2+C.
Watch out
Four slips with trigonometric substitution. (1) Forgetting that dx changes too: with x=asinθ,dx=acosθdθ, not dθ.(2)cos2θ=∣cosθ∣; it is cosθ only because the range of θ keeps cosθ≥0.(3) In a definite integral, change the limits to values of θ, as in Example 11.12, or return to x before using the old limits. (4) A quadratic with a term in x needs completing the square first: 5−4x−x2=9−(x+2)2, and then x+2=3sinθ.
The left side is easy to integrate, to 2ln∣x−2∣+3ln∣x+1∣+C. So the right side is easy to integrate too, once you can run the addition backwards. Writing a rational function as a sum of simpler fractions of this kind is called decomposing it into partial fractions. Every rational function can be decomposed, with a polynomial added in front when it is improper (below).
Definition 11.1Proper and improper rational functions
A rational function Q(x)P(x) (Module 1) is proper if the degree of the polynomial P is less than the degree of Q, and improper otherwise.
Long division of polynomials turns an improper rational function into a polynomial plus a proper one: dividing P by Q gives a quotient S and a remainder R, polynomials with P=SQ+R and degR<degQ, so that
Q(x)P(x)=S(x)+Q(x)R(x).
The polynomial S is integrated term by term; partial fractions are for the proper part.
Distinct linear factors
Start with a denominator that is a product of different linear factors, such as x2−x−2=(x−2)(x+1), and suppose you did not know the answer above. Look for constants A and B with
(x−2)(x+1)5x−4=x−2A+x+1B.
Multiply both sides by (x−2)(x+1):
5x−4=A(x+1)+B(x−2).
This must hold for every x except 2 and −1, and so for every x, since both sides are straight lines and two lines that share more than one point are the same line. Put x=2:6=3A, so A=2. Put x=−1:−9=−3B, so B=3. (Comparing coefficients works too: A+B=5 and A−2B=−4.)
There is a shortcut. To find A, the coefficient of x−21, cover up the factor x−2 in the denominator of the left side and put x=2 in what is left: 2+15⋅2−4=2. For B, cover up x+1 and put x=−1:−1−25(−1)−4=3. This is the cover-up method. It works because multiplying the decomposition by x−2 gives
x+15x−4=A+Bx+1x−2
for x near 2; as x→2, the left side tends to its value at 2 and the last term tends to 0, which leaves A.
Key idea
The cover-up method. If x−r is a factor of the denominator Q(x) that appears only once, the coefficient of x−r1 in the decomposition of Q(x)P(x) is the value at x=r of the fraction with the factor x−r covered up.
Example 11.15Two logarithms✓ Checked
Find (a) ∫x2−x−25x−4dx and (b) ∫x2−a2dx, where a=0 is a constant.
(a) By the decomposition above, on each interval that avoids 2 and −1,
∫x2−x−25x−4dx=2ln∣x−2∣+3ln∣x+1∣+C.
(b)x2−a2=(x−a)(x+a), two different factors since a=0. Cover up x−a and put x=a: the coefficient of x−a1 is a+a1=2a1. Cover up x+a and put x=−a: the coefficient of x+a1 is −a−a1=−2a1. So
The method works whenever the denominator is a product of different linear factors.
Theorem 11.6Partial fractions with distinct linear factors
Let Q(x)=(x−r1)(x−r2)⋯(x−rn), where the numbers r1,…,rn are all different, and let P be a polynomial of degree less than n. Then there are unique constants A1,…,An with
Q(x)P(x)=x−r1A1+x−r2A2+⋯+x−rnAn
for every x other than r1,…,rn. Each Ak is given by the cover-up method:
AkQk(x)=Qk(rk)P(rk),where=x−rkQ(x).
Proof
Existence.Qk is the product of the n−1 factors other than x−rk, a polynomial of degree n−1, and Qk(rk)=0 because the numbers rj are all different. Define Ak by the formula, and consider the polynomial
D(x)=P(x)−A1Q1(x)−A2Q2(x)−⋯−AnQn(x).
Its degree is less than n. At x=rk, every Qj with j=k contains the factor x−rk and so vanishes, and D(rk)=P(rk)−AkQk(rk)=0 by the choice of Ak. So D has the n different zeros r1,…,rn. But a polynomial of degree less than n that is not the zero polynomial has fewer than n zeros (by school algebra, each zero r gives a factor x−r, and n such factors would make the degree at least n). So D is the zero polynomial: P=A1Q1+⋯+AnQn. Divide by Q, using Q(x)Qk(x)=x−rk1.
Uniqueness. Suppose the constants Ak satisfy the equation. Multiply it by x−rk: for x near rk,x=rk,
Qk(x)P(x)=Ak+(x−rk)j=k∑x−rjAj.
Let x→rk. Both sides are continuous at rk, and the right side tends to Ak, so Ak=P(rk)/Qk(rk): the constants can only be those of the formula.
∎
Example 11.16Long division first✓ Checked
Find ∫x2+x−2x3+2x2+2x−2dx.
The fraction is improper, degree 3 over degree 2, so divide first. x3 divided by x2 is x; subtract x(x2+x−2)=x3+x2−2x from the numerator, which leaves x2+4x−2. Then x2 divided by x2 is 1; subtract x2+x−2, which leaves 3x. The remainder 3x has degree less than 2, so stop: the quotient is x+1 and the remainder 3x,
x2+x−2x3+2x2+2x−2=x+1+x2+x−23x.
Now x2+x−2=(x−1)(x+2), and the cover-up method gives the coefficients 1+23⋅1=1 and −2−13(−2)=2:
Two things can complicate a denominator. A factor may be repeated, as in (x−1)2(x+1). And a quadratic factor such as x2+1 may have no real zeros, so that it does not split into real linear factors. A quadratic x2+px+q with p2<4q (a negative discriminant) is called irreducible. A theorem of algebra, which this series uses without proof, says that every polynomial with real coefficients is a product of a constant, linear factors and irreducible quadratic factors. (It follows from the fundamental theorem of algebra.) So the next theorem covers every proper rational function, at least in principle: finding the factors of Q can be the hard part.
Theorem 11.7Partial fraction decomposition
Let Q(x)P(x) be a proper rational function, and let Q be factored as a constant times powers of different linear factors x−r and of different irreducible quadratic factors x2+px+q. Then Q(x)P(x) is a sum of the following terms, with unique constants:
for each factor (x−r)k of Q, the k terms x−rA1+(x−r)2A2+⋯+(x−r)kAk;
for each factor (x2+px+q)m of Q, the m terms x2+px+qB1x+C1+⋯+(x2+px+q)mBmx+Cm.
Theorem 11.6 is the case in which every power is 1 and there are no quadratic factors; the general case is proved in algebra courses, and this series uses it without proof. To find the constants, multiply by Q(x) and compare coefficients, or put convenient values of x; the cover-up method still gives the coefficient of the highest power of each linear factor. Each term then integrates with the methods you know: a power of x−r by the power rule or to a logarithm, and a quadratic term by completing the square, a logarithm and an arctangent. (A power m≥2 of an irreducible quadratic needs a trigonometric substitution as well.)
Example 11.17Repeated and quadratic factors✓ Checked
Find (a) ∫(x−1)2(x+1)4xdx and (b) ∫(x+1)(x2+1)2x2+4x+4dx.
(a) By Theorem 11.7, with constants A,B and D,
(x−1)2(x+1)4x=x−1A+(x−1)2B+x+1D.
The cover-up method gives the coefficient of the highest power of x−1,B=1+14⋅1=2, and D=(−1−1)24(−1)=−1. For A, multiply by the denominator,
4x=A(x−1)(x+1)+B(x+1)+D(x−1)2,
and compare the coefficients of x2:0=A+D, so A=1. Then
The cover-up method gives A=(−1)2+12−4+4=1. Multiply by the denominator: 2x2+4x+4=(x2+1)+(Bx+D)(x+1). Comparing the coefficients of x2 gives 2=1+B, so B=1, and the constant terms give 4=1+D, so D=3; the coefficients of x agree, 4=B+D. So the integrand is
x+11+x2+1x+x2+13,
and, with the substitution w=x2+1 for the middle term,
Four slips with partial fractions. (1) Not dividing first. x2−1x3 is improper; it is x+x2−1x, and only the second part has the form x−1A+x+1B.(2) Leaving out a power of a repeated factor. In Example 11.17(a), the form (x−1)2B+x+1D without x−1A has no solution: in 4x=B(x+1)+D(x−1)2, the terms in x2 give D=0, then the terms in x give B=4, and then the constant terms say 0=B+D=4.(3) A constant numerator over an irreducible quadratic: it must be Bx+C.(4) Missing a substitution: ∫x3+3xx2+1dx=31lnx3+3x+C with u=x3+3x, no partial fractions needed.
Compute itPartial fractions with SymPy
SymPy’s factor finds the factors, div divides polynomials, and apart decomposes a rational function into partial fractions:
Python
import sympy as sp
x = sp.symbols('x')
P = x**3 + 2*x**2 + 2*x - 2
Q = x**2 + x - 2print(sp.factor(Q))
print(sp.div(P, Q, x)) # (quotient, remainder)print(sp.apart(P/Q, x)) # Example 11.16print(sp.apart((2*x**2 + 4*x + 4)/((x + 1)*(x**2 + 1)), x))
These are Example 11.16, in SymPy’s order of terms, and Example 11.17(b) before its last split. SymPy factors over the rational numbers, so a denominator such as x2−2, whose zeros ±2 are irrational, stays whole unless you say which numbers to allow:
The second answer is Example 11.15(b) with a=2, since 221=42.
5
A strategy for integration
Differentiation is mechanical: the rules of Modules 4 to 6 differentiate every formula built from the catalogue of Module 1. Integration is not. No set of rules always works, the same integrand may give way to several methods, and some integrands give way to none (Section 11.6). What you have is a toolbox and a checklist.
Key idea
A strategy for integration.
Simplify the integrand if you can: expand, cancel, split a fraction, use an identity such as sinxcosx=21sin2x or tan2x=sec2x−1. Then look in the table of Section 10.1.
Substitute if the integrand contains a function together with its derivative, perhaps up to a constant factor (Section 10.7).
Classify the integrand by its form:
a product of a power of x with ekx,sinkx or coskx, or with lnx or an inverse trigonometric function: by parts (Section 11.1);
powers of trigonometric functions: identities and substitutions (Section 11.2);
a2−x2,a2+x2 or x2−a2, perhaps after completing the square: a trigonometric substitution (Section 11.3);
a rational function: long division if it is improper, then partial fractions (Section 11.4);
a root ng(x): try u=ng(x).
Try again: combine methods (a substitution, then parts), multiply by a clever form of 1 (as for secx), or relate the integral to one you have done. If nothing works, the integrand may have no elementary antiderivative (Section 11.6): compute the integral numerically (Section 11.7).
Example 11.18Choosing a method✓ Checked
Choose a method for each integral, and evaluate it.
(a) ∫x2+4xdx
(b) ∫exdx, for x>0
(c) ∫x2−4x+13dx
(d) ∫1+xxdx, for x>0
(a) A rational function, but step 2 comes first: the numerator is half the derivative of the denominator. With u=x2+4,du=2xdx:
∫x2+4xdx=21∫udu=21ln(x2+4)+C.
(b) A root: let w=x, so that x=w2 and dx=2wdw (Theorem 11.5(b), with the one-to-one substitution x=w2,w>0). The integral becomes 2∫wewdw, a product for parts: with u=w and dv=ewdw,
2∫wewdw=2(wew−ew)+C=2(x−1)ex+C.
(c) A rational function whose denominator has no real zeros, since (−4)2−4⋅13=−36<0. Complete the square, x2−4x+13=(x−2)2+9, and use ∫u2+a2du=a1arctanau+C (Example 10.11) with u=x−2 and a=3:
∫x2−4x+13dx=31arctan3x−2+C.
(d) A root again: w=x,dx=2wdw, gives 2∫1+w2w2dw, an improper rational function. Divide, or write w2=(1+w2)−1:
Reaching for a heavy method when a light one works. ∫x2+4xdx needs no partial fractions, and ∫xx2+1dx needs no trigonometric substitution: u=x2+1 gives 31(x2+1)3/2+C in one line. Look for a substitution before anything else.
6
Integration by computer
Computer algebra systems such as SymPy integrate with the methods of this module and with algorithms that handle whole families of integrands at once. Module 10 introduced sp.integrate (Section 10.8); here it is on integrals of this module, with the lesson of Module 10 in mind: an answer that looks different is not necessarily wrong.
Compute itIntegrals of this module by computer
Python
import sympy as sp
x = sp.symbols('x')
print(sp.integrate(x**2*sp.sin(x), x)) # Example 11.3print(sp.integrate(sp.exp(x)*sp.sin(x), x)) # Example 11.6print(sp.integrate((5*x - 4)/(x**2 - x - 2), x)) # Example 11.15(a)print(sp.integrate(1/sp.sqrt(x**2 + 4), x)) # Example 11.14(a)print(sp.integrate(sp.sec(x), x)) # Theorem 11.4
The first two are the answers of Examples 11.3 and 11.6, in SymPy’s order of terms. The third writes ln(x−2) for ln∣x−2∣, as Module 10 explained: SymPy’s log works with complex numbers, and its answer is right where x>2. The fourth is arsinh2x=ln(2x+4x2+1)=ln(x+x2+4)−ln2, by Exercise 6.10: Example 11.14’s answer minus the constant ln2. The fifth looks nothing like ln∣secx+tanx∣. Where cosx=0,sinx−1<0, so SymPy’s ln(sinx−1) is a complex number, ln(1−sinx) plus the constant πi. Up to a constant, then, SymPy’s answer is
Both differences of derivatives are 0, and the difference between Example 11.14’s answer and SymPy’s, at x=3 or anywhere else, is ln2. Finally, an integral that defeats SymPy, the length of an arch of the sine curve in Module 12:
Python
print(sp.integrate(sp.sqrt(1 + sp.cos(x)**2), x))
Output
Integral(sqrt(cos(x)**2 + 1), x)
SymPy returns the integral unevaluated: it has found no antiderivative.
Watch out
Three things to remember about a computer’s antiderivative. (1) It leaves out “+C” and usually the absolute value bars, and it may use complex logarithms. (2) A different-looking answer may well be right: differentiate it, or compare it with yours at a few points of one interval, where the difference must be the same constant. (3) An unevaluated Integral(...) means that SymPy found no antiderivative, not that none exists; and a correct answer can be so long that a numerical value (Section 11.7) is more useful.
Functions with no elementary antiderivative
The integral of the last Compute it box is not unusual. Most of the functions in this module’s examples were chosen because their antiderivatives can be written down; many functions that turn up in practice cannot be integrated that way.
Definition 11.2Elementary function
An elementary function is a function that can be built from constants and x with finitely many additions, subtractions, multiplications, divisions, powers, roots, exponentials, logarithms, trigonometric and inverse trigonometric functions, and compositions of these.
Every function of Module 1’s catalogue is elementary, and so are combinations such as e−x2,1+cos2x,sinhx=21(ex−e−x) and ln(x+x2+1). The derivative of an elementary function is elementary: the rules of Modules 4 to 6 produce it. The antiderivative of an elementary function need not be. Liouville’s theorem describes what an elementary antiderivative must look like, if there is one; from it one can prove that none of
e−x2,xsinx,lnx1,xex,sin(x2)
has an elementary antiderivative; nor has ex2, which Example 11.2 met. This series proves neither Liouville’s theorem nor these consequences of it: the proofs need algebra beyond the series. What they mean is not beyond it: no cleverness with the methods of this module will find such an antiderivative, because none exists.
These functions do have antiderivatives, all the same. Each is continuous on every interval inside its domain, so by Part 1 of the Fundamental Theorem (Section 10.4) an area function ∫axf(t)dt, with a in such an interval, is an antiderivative there. The most useful of them have names, and their values are computed numerically, in the same way as calculators compute sinx and lnx.
Definition 11.3Three functions defined by integrals
The error function is erfx=π2∫0xe−t2dt, for every real x (Module 10).
The sine integral is Six=∫0xtsintdt, for every real x, where the integrand is given the value 1 at t=0, its limit there (Module 2), so that it is continuous.
The logarithmic integral is Lix=∫2xlntdt, for x>1.
By Part 1 of the Fundamental Theorem, (erfx)′=π2e−x2,(Six)′=xsinx for x=0, and (Lix)′=lnx1. Figure 11.3 shows the three, and here are a few values of the first two:
x
erfx
Six
0.5
0.520500
0.493107
1
0.842701
0.946083
2
0.995322
1.60541
3
0.999978
1.84865
The error function is the workhorse of probability, where e−x2 is the shape of the normal distribution (Module 12). The sine integral turns up in signal processing and optics. The logarithmic integral counts primes: the number of prime numbers up to x is close to Lix when x is large, in the sense that their ratio tends to 1 as x→∞. That is the prime number theorem, and the Compute it box below compares the two at a million.
Figure 11.3
Three integrands with no elementary antiderivative (blue) and the antiderivatives defined by their integrals (orange). Left: e−x2 and ∫0xe−t2dt=2πerfx, which levels off at 2π≈0.886. Middle: xsinx and Six, which rises while the integrand is positive and falls while it is negative, and settles towards 2π≈1.571. Right: lnx1 and Lix, for x≥2;Lix keeps growing, because lnx1 stays positive.
Compute itSpecial functions in SymPy
Asked for these antiderivatives, SymPy names them:
Python
import sympy as sp
x = sp.symbols('x')
for f in [sp.exp(-x**2), sp.sin(x)/x, 1/sp.log(x), sp.exp(x)/x]:
print(sp.integrate(f, x))
Output
sqrt(pi)*erf(x)/2
Si(x)
li(x)
Ei(x)
Ei is the exponential integral, another named antiderivative. SymPy’s li is another antiderivative of lnx1, defined by an integral from 0 that needs special care at t=1, where lnt1 is undefined; it differs from Li by the constant li2. The prime numbers up to a million, counted by primepi, against Li of a million:
There are 78,498 primes below a million, and Li106≈78,627: a difference of less than 0.2%. The last line is ∫01e−x2dx, which evalf computes numerically, the value that Module 9 estimated with midpoint sums.
Watch out
“No elementary antiderivative” does not mean “no antiderivative”, and it does not stop you from evaluating definite integrals: ∫01e−x2dx≈0.746824 is a perfectly good number. And small changes matter. ∫xe−x2dx=−21e−x2+C and ∫xsin(x2)dx=−21cos(x2)+C, by substitution; without the factor x, neither has an elementary antiderivative.
7
Numerical integration
Two kinds of integral call for numbers rather than formulas: integrals of functions with no elementary antiderivative, such as ∫01e−x2dx, and integrals of functions known only through measurements, such as a speed or a power read every few seconds. A numerical integration rule computes an integral from values of the integrand. The midpoint sum of Module 9 is one, the midpoint rule
Mn=Δx[f(xˉ1)+f(xˉ2)+⋯+f(xˉn)],
where Δx=nb−a,xi=a+iΔx, and xˉi=21(xi−1+xi) is the midpoint of the ith subinterval (read “x bar i”; Module 9 wrote mi). Its error shrank like n21 (Section 9.3). This section adds two rules, explains why the errors behave as they do, and bounds them.
The trapezoidal rule
In Example 9.2 a car’s speed was read every 2 seconds. The left and right sums gave 100 m and 140 m, and their average, 120 m, was a better single estimate. Averaging Ln and Rn term by term gives
2Ln+Rn=i=1∑n2f(xi−1)+f(xi)Δx,
and each term is the area of a trapezoid: when f is positive, the region under the chord that joins the points (xi−1,f(xi−1)) and (xi,f(xi)) of the graph (Figure 11.4, left). Every value of f except the first and the last belongs to two neighbouring trapezoids, so collecting terms gives the following rule.
Definition 11.4The trapezoidal rule
Let f be defined on [a,b], let n≥1 be a whole number, Δx=nb−a and xi=a+iΔx. The trapezoidal rule with n subintervals is
It is the average 21(Ln+Rn) of the left and right sums.
The error of a rule is the integral minus the approximation: ET=∫abf(x)dx−Tn and EM=∫abf(x)dx−Mn. A positive error means that the rule underestimates.
Example 11.19The trapezoidal and midpoint rules for ln 2✓ Checked
Compute T4 for ∫12xdx=ln2, and compare the errors of T4 and M4.
Here Δx=0.25, and x1 takes the values 1,54,32,74 and 21 at x=1, 1.25, 1.5, 1.75 and 2 (Example 9.4). So
which is the average of L4=420319 and R4=840533 from Example 9.4. That example also found M4≈0.6912, or 0.69122 to five decimal places. With ln2≈0.693147,
ETEM=ln2−T4≈−0.00388,=ln2−M4≈0.00193.
The trapezoidal rule overestimates, the midpoint rule underestimates, and the midpoint error is about half the size of the trapezoidal one.
Here is the same comparison for more subintervals:
n
ET
EM
4
−0.0038766
0.0019273
8
−0.0009747
0.0004866
16
−0.0002440
0.0001220
32
−0.0000610
0.0000305
Two patterns stand out. Each time n doubles, both errors are divided by about 4, as Module 9 found for midpoint sums. And at every n,ET≈−2EM.
The signs come from the shape of the graph. The second derivative of x1 is x32, positive for every x>0, so the graph is concave up on (0,∞), an open interval that contains [1,2] (Section 8.4). It sags below each chord, and each trapezoid covers more than the region under the graph. So Tn overestimates (Figure 11.4, left). For the midpoint rule, draw the tangent line at the midpoint of a subinterval. It passes through the middle of the top of the midpoint rectangle and cuts off two triangles of equal area, one above the top on one side and one below it on the other. So the rectangle has the same area as the trapezoid under the tangent line (Figure 11.4, right). A concave-up graph lies above its tangent lines (Theorem 8.11), so that trapezoid lies below the graph, and Mn underestimates. For a graph that is concave down, both conclusions turn round, as Module 9 saw in Exercise 9.2, where M4 overestimated ∫02(4−x2)dx.
Figure 11.4
One subinterval of the two rules for ∫12xdx, with n=1 so that the errors are visible. Left: the trapezoid under the chord has area 0.75, more than the area ln2≈0.693 under the graph: the graph, concave up, sags below the chord, and the orange sliver is the excess. Right: the midpoint rectangle (dashed) has area 32≈0.667, the same as the trapezoid under the tangent line at the midpoint, because the two small triangles between them are equal; the graph lies above the tangent, so the rectangle is too small by the green sliver.
Error bounds
Theorem 11.8Error bounds for the midpoint and trapezoidal rules
Let f′′ be continuous on [a,b], and let K be a number with ∣f′′(x)∣≤K for every x in [a,b]. Then, for every n≥1,
∣ET∣∣EM∣≤12n2K(b−a)3and≤24n2K(b−a)3.
If f′′(x)≥0 for every x in [a,b], then Mn≤∫abf(x)dx≤Tn; if f′′(x)≤0 for every x in [a,b], then Tn≤∫abf(x)dx≤Mn.
Such a K exists: ∣f′′∣ is continuous on the closed interval [a,b], so it has a largest value there, by the Extreme Value Theorem (Module 3). The bounds shrink like n21, and the bound for Mn is half the bound for Tn. A bound only limits the size of an error, but the errors themselves usually follow the same pattern: the Going deeper box shows why doubling n divides them by about 4, and why ET≈−2EM. It also proves the trapezoidal half of the theorem; Exercise 11.12 proves the midpoint half in the same way.
Going deeperWhy the theorem is true, and the factors 4 and −2
Take one subinterval [p,q], of width w=q−p, and the function k(x)=21(x−p)(q−x). It is at least 0 on [p,q] and 0 at both ends; k′(x)=2p+q−x, so k′(p)=2w and k′(q)=−2w; and k′′(x)=−1. Integrate ∫pqkf′′dx by parts twice (Theorem 11.2), first with u=k and dv=f′′(x)dx, then with u=k′ and dv=f′(x)dx:
The bound. Since k≥0 and −K≤f′′≤K, the comparison theorem (Theorem 9.7) puts the right side between −K∫pqkdx and K∫pqkdx, and ∫pqk(x)dx=12w3. So each trapezoid is in error by at most 12Kw3. There are n trapezoids, each of width w=nb−a, so
∣ET∣≤n⋅12K(nb−a)3=12n2K(b−a)3.
The sign. If f′′≥0, each −∫pqkf′′dx is at most 0, so ET≤0:Tn overestimates.
The factors 4 and −2. If f′′ hardly changes across [p,q], the error of one trapezoid is close to −f′′(p)∫pqkdx=−f′′(p)12w3. Adding up over the subintervals, with w=Δx,
because the sum is a Riemann sum of f′′. In the same way, the formula of Exercise 11.12(b) gives EM≈24Δx2(f′(b)−f′(a)). Halving Δx divides both by 4, and ET≈−2EM. For ln2 with n=4,f′(x)=−x21 gives f′(2)−f′(1)=43, and the two formulas predict ET≈−0.00391 and EM≈0.00195, close to the true −0.00388 and 0.00193 of Example 11.19.
Example 11.20How many subintervals?✓ Checked
How large must n be for Tn, and for Mn, to approximate ln2=∫12xdx with an error of at most 10−6?
f(x)=x1 has f′′(x)=x32, which on [1,2] is positive and largest at x=1, so take K=2. With b−a=1, Theorem 11.8 guarantees
∣ET∣≤12n22=6n21.
This is at most 10−6 when n2≥6106≈166,667. Since 4082=166,464 is too small and 4092=167,281 is enough, n=409 subintervals suffice. For the midpoint rule, 12n21≤10−6 needs n2≥83,334, and n=289 suffices (2882=82,944,2892=83,521). These values of n are guaranteed to be enough; they may be more than necessary, because over most of [1,2] the second derivative is much smaller than K.
Watch out
K must bound ∣f′′∣ on the whole interval: take its largest value, not its value at a convenient point. With K=f′′(2)=41 for x1 on [1,2], the “bound” for T4 would be 7681≈0.0013, less than the actual error, 0.0039. And a bound is a guarantee, not an estimate: the true error may be much smaller.
Simpson’s rule
The trapezoidal rule replaces the graph by chords, straight lines through two points. A parabola through three points can follow a curve much more closely, and the area under one is easy to find. Let y=Ax2+Bx+C pass through the points (−h,y0),(0,y1) and (h,y2), where h>0. Then, since the odd term Bx contributes 0,
∫−hh(Ax2+Bx+C)dx=32Ah3+2Ch=3h(2Ah2+6C).
The three points give y0=Ah2−Bh+C,y1=C and y2=Ah2+Bh+C, so y0+4y1+y2=2Ah2+6C, and the area is
3h(y0+4y1+y2).
Such a parabola always exists: C=y1,B=2hy2−y0 and A=2h2y0−2y1+y2 (a straight line if A=0). The area depends only on the three heights and the spacing h, so it is the same for any three equally spaced points, wherever they are on the x-axis: sliding the picture sideways does not change it. Now cut [a,b] into an even number n of subintervals, pass a parabola through the points of the graph above x0,x1 and x2, another through those above x2,x3 and x4, and so on, and add up the areas under them (Figure 11.5, left).
Definition 11.5Simpson’s rule
Let n be even, Δx=nb−a and xi=a+iΔx.Simpson’s rule with n subintervals is
The coefficients follow the pattern 1,4,2,4,2,…,4,1: each point with an odd index is the middle of a pair of subintervals, with weight 4, and each interior point with an even index is shared by two pairs, with weight 1+1=2. The error is ES=∫abf(x)dx−Sn.
Example 11.21Simpson’s rule for ln 2✓ Checked
Compute S4 for ∫12xdx.
With Δx=0.25 and the values of x1 used in Example 11.19,
Its error is ES=ln2−S4≈−0.000107, about 36 times smaller than the error of T4, from the same five values of f.
Simpson’s rule is in fact a weighted average of the other two. The points of S2n are those of Tn together with the midpoints used by Mn, and grouping the terms shows that
S2n=3Tn+2Mn.
Here, with T2=2417 and M2=3524,31(2417+3548)=25201747=S4. Since ET≈−2EM, the weights 1 and 2 make the two errors nearly cancel.
A rule built to be exact for parabolas turns out to be exact for more.
Theorem 11.9Simpson’s rule is exact for cubics
If f is a polynomial of degree at most 3, then Sn=∫abf(x)dx for every even n.
Proof
Sn adds up the rule over pairs of subintervals, and the integral adds up over them too, so it is enough to show that the rule is exact on one pair, [m−h,m+h]. Substituting x=m+s and expanding the powers (m+s)k writes f as c0+c1(x−m)+c2(x−m)2+c3(x−m)3, with constants cj. The part c0+c1(x−m)+c2(x−m)2 is a parabola or a line, so the rule gives its integral exactly, by construction. For (x−m)3, the integral over [m−h,m+h] is 0, because the function is odd about m; and the rule gives 3h((−h)3+4⋅0+h3)=0 too. Both the integral and the rule are linear (the value for a sum of functions is the sum of the values, and constant factors come out), so the rule is exact for f.
∎
The error bound for Simpson’s rule involves the fourth derivative f(4).
Theorem 11.10Error bound for Simpson’s rule
Let f(4) be continuous on [a,b], and let K be a number with f(4)(x)≤K for every x in [a,b]. Then, for every even n,
∣ES∣≤180n4K(b−a)5.
The proof uses the idea of the Going deeper box with a longer calculation, and this series omits it. The bound agrees with Theorem 11.9: for a cubic, f(4)=0, so K=0 and the error is 0. It shrinks like n41: doubling n divides it by 24=16, and for a smooth f the error itself usually falls by about the same factor, as the Compute it box below shows. For ln2,f(4)(x)=x524≤24 on [1,2], and 180n424≤10−6 needs n4≥133,334, that is, n≥19.11. With n even, n=20 suffices: twenty subintervals, where the trapezoidal rule needed 409.
Compute itThe three rules side by side
Each rule is a few lines of Python. The test integral ∫01e−x2dx has no elementary antiderivative, but Python’s math.erf gives its value, 2πerf1, to about 16 significant digits:
Python
import math
defmidpoint(f, a, b, n):
dx = (b - a)/n
return dx*sum(f(a + (i + 0.5)*dx) for i inrange(n))
deftrapezoid(f, a, b, n):
dx = (b - a)/n
return dx*(f(a)/2 + sum(f(a + i*dx) for i inrange(1, n)) + f(b)/2)
defsimpson(f, a, b, n): # n must be even
dx = (b - a)/n
inner = sum((4if i % 2else2)*f(a + i*dx) for i inrange(1, n))
return dx/3*(f(a) + inner + f(b))
Now the errors as n doubles, and the ratio of each error to the next:
Python
f = lambda x: math.exp(-x**2)
exact = math.sqrt(math.pi)/2*math.erf(1) # the integral from 0 to 1
ns = [4, 8, 16, 32, 64]
rules = {'M': midpoint, 'T': trapezoid, 'S': simpson}
err = {r: [exact - rule(f, 0, 1, n) for n in ns] for r, rule in rules.items()}
print(' n E_M E_T E_S')
for k, n inenumerate(ns):
print(f'{n:3d}' + ''.join(f'{err[r][k]:11.2e}'for r in rules))
for r in rules:
print(r, [round(err[r][k - 1]/err[r][k], 2) for k inrange(1, len(ns))])
Output
n E_M E_T E_S
4 -1.92e-03 3.84e-03 -3.12e-05
8 -4.79e-04 9.59e-04 -1.99e-06
16 -1.20e-04 2.40e-04 -1.25e-07
32 -2.99e-05 5.99e-05 -7.79e-09
64 -7.48e-06 1.50e-05 -4.87e-10
M [4.01, 4.0, 4.0, 4.0]
T [4.01, 4.0, 4.0, 4.0]
S [15.72, 15.95, 15.99, 16.0]
The midpoint and trapezoidal errors fall by a factor of 4 at each doubling, and Simpson’s by a factor close to 16, as their bounds in Theorems 11.8 and 11.10 do. With 16 subintervals Simpson’s rule is already within 2×10−7 of the integral, closer than the trapezoidal rule with 64. The midpoint rule overestimates here, because the graph of e−x2 is concave down on (−21,21), an interval that covers most of [0,1] (more precisely, because f′(1)−f′(0)=−e2 is negative, in the estimate of the Going deeper box); and ET≈−2EM once more.
Figure 11.5
Simpson’s rule. Left: with n=4, two parabolas (purple, dashed), each through three points of the graph of f(x)=1+21sin2x+4x (blue), replace the graph on [0,4]; the shaded areas under them add up to S4. Right: the size of the errors of the three rules for ∫01e−x2dx against n, on logarithmic scales, on which a power C/np is a straight line of slope −p. The midpoint and trapezoidal errors fall along lines of slope −2, the errors of Simpson’s rule along a line of slope −4.
Try it
Choose ex on [0,1], the trapezoid rule and n=4: the shaded trapezoids hug the curve, and T4≈1.72722 is a little more than the integral e−1≈1.71828. Press Double n three times. The table keeps the error at each n and the ratio of each error to the next: close to 4 every time. Switch to the midpoint rule, move n back to 4 and do the same: at each n the error is about half the trapezoidal one, with the opposite sign, and the ratios are again close to 4. Then do the same with Simpson’s rule: the purple curves are the parabolas, and the ratios are close to 16. Two experiments to finish. Choose type your own, keep x3−x on [0,2] and choose Simpson’s rule: the error is 0, to within rounding error, for every even n (Theorem 11.9). And choose x on [0,1] with Simpson’s rule, and double n again: the ratios are only about 2.8, because the derivatives of x are unbounded near 0, and Theorem 11.10 does not apply.
Which rule to use
A smooth function given by a formula. Simpson’s rule, or a library routine. Doubling n is a practical check: for Simpson’s rule the error of S2n is about 151(S2n−Sn), since S2n−Sn=ES(n)−ES(2n)≈16ES(2n)−ES(2n). Library routines go further: they use adaptive rules, which keep halving the subintervals only where the integrand changes fast. The widget computes its accurate value of the integral that way, with Simpson’s rule.
Measurements. Readings at equally spaced times suit the trapezoidal rule, or Simpson’s rule when the number of intervals is even; the midpoint rule needs values at the midpoints, which you usually do not have. Readings at unequal spacing are added up as trapezoids, one interval at a time.
A kink or an infinite slope. The error bounds need a bounded f′′ or f(4). For x on [0,1],(x)′′=−41x−3/2 is unbounded near 0, and doubling n divides the error of Simpson’s rule by only about 2.8, not 16. Split the interval at a kink, or remove the trouble with a substitution: x=t2 turns ∫01xdx into ∫012t2dt, which Simpson’s rule integrates exactly.
Very many subintervals. Every value of f carries a rounding error of about 10−16 of its size (Module 2), and adding up millions of them can add those errors up. A good rule with a moderate n is both faster and more accurate.
Watch out
Three slips with Simpson’s rule. (1) It needs an even number of subintervals: five readings give four intervals and can be used, six readings give five intervals and cannot (use the trapezoidal rule, or Simpson’s rule on four of the intervals and a trapezoid for the last). (2) The weights are 1,4,2,4,…,2,4,1, starting and ending with 1 and with 4 next to each end. (3) The factor in front is 3Δx, not 2Δx as in the trapezoidal rule.
8
What you learned
Integration by parts reverses the product rule: ∫udv=uv−∫vdu, and ∫abfg′dx=[fg]ab−∫abf′gdx for definite integrals. Choose u to get simpler when differentiated (LIATE is a rough guide) and dv to be integrable. Repeat it, organise the rounds in a table, solve for an integral that comes back (∫exsinxdx), or derive a reduction formula (∫sinnxdx).
Trigonometric integrals: for sinmxcosnx, save one factor of an odd power and substitute, or use the half-angle identities sin2x=21(1−cos2x) and cos2x=21(1+cos2x); for tanmxsecnx, save sec2x or secxtanx.∫secxdx=ln∣secx+tanx∣+C.
Trigonometric substitution: x=asinθ,atanθ or asecθ removes a2−x2,a2+x2 or x2−a2; on the ranges of θ in the table the square roots need no absolute value signs (the secant row is for x≥a), and a right triangle takes the answer back to x. It gives the areas πr2 of a disc and πab of an ellipse.
Partial fractions: divide first if the rational function is improper; then write it as a sum of terms (x−r)jA and (x2+px+q)jBx+C. The cover-up method finds the coefficients of distinct linear factors, because multiplying by x−r and letting x→r isolates them.
Strategy: simplify, substitute, classify (parts, trigonometric, substitution, partial fractions, roots), try again. Check every antiderivative by differentiating it.
By computer: SymPy’s antiderivatives may differ from yours by a constant, drop absolute values or use complex logarithms; differentiate to check. Elementary functions need not have elementary antiderivatives: by Liouville’s theorem (quoted here, not proved) e−x2,xsinx and lnx1 have none, and their antiderivatives are named by integrals: erf,Si,Li.
Numerical integration: the midpoint rule Mn, the trapezoidal rule Tn=21(Ln+Rn) and Simpson’s rule Sn (n even, weights 1,4,2,…,4,1). With ∣f′′∣≤K,∣ET∣≤12n2K(b−a)3 and ∣EM∣≤24n2K(b−a)3; with f(4)≤K,∣ES∣≤180n4K(b−a)5. Doubling n divides the errors by about 4, 4 and 16; Simpson’s rule is exact for cubics; concavity gives the signs of ET and EM.
9
Exercises
Exercise 11.1★Integration by parts
Find:
(a) ∫xsin2xdx
(b) ∫x2lnxdx, for x>0
(c) ∫01xe−xdx, exactly and to four decimal places
(b) By LIATE, u=lnx and dv=x2dx, so du=xdx and v=3x3:
∫x2lnxdx=3x3lnx−∫3x3⋅x1dx=3x3lnx−9x3+C.
The other choice, u=x2 and dv=lnxdx, needs v=xlnx−x (Example 11.1(b)), and the new integral, ∫2x(xlnx−x)dx=2∫x2lnxdx−2∫x2dx, contains the original one again. Solving for it, as in Example 11.6, gives the same answer, with more work.
(c) Example 11.1(a) gives the antiderivative −xe−x−e−x=−(x+1)e−x, so
∫01xe−xdx=[−(x+1)e−x]01=−2e−1+1=1−e2≈0.2642.
Exercise 11.2★Trigonometric integrals
Find:
(a) ∫cos3xdx
(b) ∫sin2xcos2xdx
(c) ∫0π/4sec4xdx
Show solution✓ Checked
(a) The power of the cosine is odd: cos3x=(1−sin2x)cosx. With u=sinx,
∫(1−u2)du=sinx−31sin3x+C.
(b) Both powers are even. Use sinxcosx=21sin2x, then the half-angle identity with 2x in place of x:
sin2xcos2x=41sin22x=81(1−cos4x),
so
∫sin2xcos2xdx=8x−32sin4x+C.
(c) The power of the secant is even: sec4x=(1+tan2x)sec2x. With u=tanx, the limits become tan0=0 and tan4π=1:
∫0π/4sec4xdx=∫01(1+u2)du=1+31=34.
Exercise 11.3★Partial fractions
(a) Find ∫x2−x−6x+7dx.
(b) Evaluate ∫01(x+1)(x+2)dx, exactly and to four decimal places.
(c) Explain why ∫x2−1x2+1dx needs long division first, and find it.
Show solution✓ Checked
(a)x2−x−6=(x−3)(x+2). Cover-up: the coefficient of x−31 is 3+23+7=2, and that of x+21 is −2−3−2+7=−1. So
∫x2−x−6x+7dx=2ln∣x−3∣−ln∣x+2∣+C.
(b) Cover-up: (x+1)(x+2)1=x+11−x+21. On [0,1] both factors are positive, so
(c) The numerator and the denominator have the same degree, 2, so the fraction is improper, and Theorem 11.7 does not apply to it. Divide: x2+1=1⋅(x2−1)+2, so the integrand is 1+x2−12, and by Example 11.15(b) with a=1,
∫x2−1x2+1dx=x+lnx+1x−1+C.
Trying x−1A+x+1B directly fails: that sum is always a proper fraction.
Exercise 11.4★A power log, revisited
In Exercise 9.9, a program logged a GPU’s power draw every 10 seconds during a one-minute job. The made-up readings were 120, 180, 250, 260, 240, 200 and 150 W at t=0,10,…,60 s.
(a) Estimate the energy E=∫060P(t)dt with the trapezoidal rule and with Simpson’s rule.
(b) Compare the trapezoidal estimate with the left and right sums of Exercise 9.9, 12,500 J and 12,800 J.
(c) Why can you not use the midpoint rule with 6 subintervals here? Which midpoint estimate can you make, and how is it related to the others?
Show solution✓ Checked
(a) There are n=6 intervals of Δt=10 s, an even number, so both rules apply:
(b)T6=12,650 J is the average of 12,500 J and 12,800 J, as Definition 11.4 says it must be.
(c)M6 needs the power at the midpoints 5, 15, …, 55 s, which were not measured. With 3 subintervals of 20 s, though, the midpoints are 10, 30 and 50 s, which were: M3=20(180+260+200)=12,800 J. With T3=220(120+2⋅250+2⋅240+150)=12,500 J, the relation of Example 11.21 gives back Simpson’s estimate: 31(T3+2M3)=31(12,500+25,600)=12,700 J =S6. None of these estimates comes with a guarantee: ten-second readings say nothing about the power between them.
Exercise 11.5★★Repeated parts
Find:
(a) ∫x3e−xdx, with the tabular method
(b) ∫e2xcosxdx
(c) ∫(lnx)2dx, for x>0
Show solution✓ Checked
(a) Differentiate x3 in column D and integrate e−x in column I:
(b) Call it I. With u=cosx and dv=e2xdx, so v=21e2x:
I=21e2xcosx+21∫e2xsinxdx.
Again, keeping the roles, with u=sinx:∫e2xsinxdx=21e2xsinx−21I. So
I=21e2xcosx+41e2xsinx−41I,
and solving, 45I=41e2x(2cosx+sinx):
∫e2xcosxdx=51e2x(2cosx+sinx)+C.
(c)u=(lnx)2 and dv=dx, so du=x2lnxdx and v=x. Then, with Example 11.1(b),
∫(lnx)2dx=x(lnx)2−2∫lnxdx=x(lnx)2−2xlnx+2x+C.
Exercise 11.6★★Trigonometric substitutions
(a) Find ∫9−x2x2dx, for −3<x<3.
(b) Find ∫(x2+9)3/2dx.
(c) Evaluate ∫011+x2dx, exactly and to four decimal places. (By the arc length formula of Module 12, it is the length of the parabola y=21x2 from x=0 to x=1.)
Show solution✓ Checked
(a)x=3sinθ with −2π<θ<2π, so dx=3cosθdθ and 9−x2=3cosθ:
since sec4π=2,tan4π=1, and the bracket is 0 at θ=0.
Exercise 11.7★★More partial fractions
(a) Find ∫x(x+1)2x2+2dx.
(b) Find ∫x3+x3x+1dx.
(c) In a model of a population y that cannot exceed a size K>0 (Module 13), the integral ∫y(K−y)dy appears, for 0<y<K. Find it.
Show solution✓ Checked
(a) By Theorem 11.7, x(x+1)2x2+2=xA+x+1B+(x+1)2D. Cover-up: A=(0+1)20+2=2, and for the highest power of x+1,D=−11+2=−3. Multiplying by the denominator, x2+2=A(x+1)2+Bx(x+1)+Dx, and the coefficients of x2 give 1=A+B, so B=−1. So
(b)x3+x=x(x2+1), with x2+1 irreducible: x(x2+1)3x+1=xA+x2+1Bx+D. Cover-up: A=11=1. Then 3x+1=(x2+1)+(Bx+D)x; the coefficients of x2 give 0=1+B, so B=−1, and those of x give D=3. So
(c) The two factors y and K−y=−(y−K) are distinct linear factors. Cover-up: at y=0 the coefficient of y1 is K1, and covering up K−y and putting y=K gives the coefficient K1 of K−y1. So
y(K−y)1=K1(y1+K−y1),
and, since y>0 and K−y>0, and ∫K−ydy=−ln(K−y)+C (substitute w=K−y),
∫y(K−y)dy=Klny−ln(K−y)+C=K1lnK−yy+C.
Exercise 11.8★★Choosing a method
Choose a method for each integral, and evaluate it.
(a) ∫xcos(x2)dx
(b) ∫x2cosxdx
(c) ∫x2+2x+2dx
(d) ∫1−x4xdx, for −1<x<1
(e) SymPy answers ∫x2ex2dx with 21xex2−4πerfix, where erfi is a function defined by an integral, like erf, with derivative π2ex2. Check the answer by differentiating it. Then integrate by parts with u=x to explain why no elementary formula would do.
Show solution✓ Checked
(a) A function of x2 times x, half the derivative of x2: substitute u=x2,du=2xdx, to get 21∫cosudu=21sin(x2)+C. Parts would only make it worse.
(b) A power times a cosine: parts, twice (tabular). With the signs +,−,+ and the antiderivatives sinx,−cosx,−sinx of cosx,
∫x2cosxdx=x2sinx+2xcosx−2sinx+C.
(c) A rational function with an irreducible denominator: 22−4⋅2=−4<0. Complete the square, x2+2x+2=(x+1)2+1, and substitute u=x+1:
∫x2+2x+2dx=∫u2+1du=arctan(x+1)+C.
(d) It looks like a trigonometric substitution, but a substitution comes first: x4=(x2)2, and x is half the derivative of x2. With u=x2,du=2xdx, and 0≤u<1,
∫1−x4xdx=21∫1−u2du=21arcsin(x2)+C.
(e) By the product and chain rules, dxd(21xex2)=21ex2+x2ex2, and dxd(4πerfix)=4π⋅π2ex2=21ex2. The difference is x2ex2, so SymPy’s answer is right. By parts, with u=x and dv=xex2dx, so that du=dx and v=21ex2:
∫x2ex2dx=21xex2−21∫ex2dx.
If x2ex2 had an elementary antiderivative F, then xex2−2F would be an elementary antiderivative of ex2: its derivative is ex2+2x2ex2−2x2ex2=ex2. Section 11.6 says that there is none. So the answer needs a function such as erfi, as SymPy’s does. The odd powers are different: ∫xex2dx=21ex2+C, and Example 11.2 found ∫x3ex2dx.
Exercise 11.9★★How many subintervals?
Let f(x)=e−x2.
(a) Find f′′(x) and f(4)(x), and show that ∣f′′(x)∣≤2 and f(4)(x)≤20 for 0≤x≤1.
(b) How large must n be to guarantee that Tn, and that Sn, approximates ∫01e−x2dx with an error of at most 10−6?
(c) Compare with the errors printed in the Compute it box of Section 11.7.
Show solution✓ Checked
(a) By the chain and product rules, f′(x)=−2xe−x2 and f′′(x)=(4x2−2)e−x2; differentiating twice more, f′′′(x)=(12x−8x3)e−x2 and f(4)(x)=(16x4−48x2+12)e−x2. For 0≤x≤1,0<e−x2≤1. And 4x2−2 lies between −2 and 2, so ∣f′′(x)∣≤2. With s=x2, which lies in [0,1], the polynomial 16s2−48s+12 has derivative 32s−48<0, so it decreases from 12 at s=0 to −20 at s=1; so 16x4−48x2+12≤20, and f(4)(x)≤20.
(b) Trapezoidal rule, with K=2 and b−a=1:12n22≤10−6 needs n2≥166,667, so n=409 suffices, as in Example 11.20. Simpson’s rule, with K=20:180n420≤10−6 needs n4≥111,112, that is, n≥18.26; with n even, n=20 suffices.
(c) The box shows ∣ET∣≈1.5×10−5 at n=64, still too big; since the errors fall like n21, the trapezoidal rule reaches 10−6 near n=250, before the guaranteed 409. Simpson’s rule has ∣ES∣≈2×10−6 at n=8, still too big, and 1.25×10−7 at n=16. Since its errors fall like n41,n=10 should give about 2×10−6⋅0.84≈8×10−7, and the box’s simpson function confirms it: ∣ES∣≈8.2×10−7 at n=10. That is half the guaranteed 20. The bounds are guarantees, and cautious ones: f(4) is in fact at most 12 on [0,1], which would give n=18.
Exercise 11.10★★★Wallis’s integrals
Let In=∫0π/2sinnxdx for n=0,1,2,…
(a) Show that I0=2π,I1=1, and In=nn−1In−2 for n≥2.
(b) Find I5 and I6.
(c) Prove that nInIn−1=2π for every n≥1.
Show solution✓ Checked
(a)I0=∫0π/21dx=2π and I1=[−cosx]0π/2=0+1=1. For n≥2, Theorem 11.3 in its definite form (Example 11.7(c)) gives
In=[−nsinn−1xcosx]0π/2+nn−1In−2,
and the bracket is 0: at x=2π because cos2π=0, and at x=0 because sin0=0 and n−1≥1.
(b)I5=54⋅32⋅I1=158 and I6=65⋅43⋅21⋅I0=4815⋅2π=325π≈0.4909.
(c) By induction on n. For n=1:1⋅I1I0=2π. Suppose nInIn−1=2π for some n≥1. By (a), In+1=n+1nIn−1, so
(a) Show that Simpson’s rule with n=2 gives the exact values of ∫−11x3dx and ∫02x3dx, but not of ∫−11x4dx.
(b) Find the error ES for ∫−11x4dx with n=2, and compare it with the bound of Theorem 11.10.
(c) Do the same with n=4. What do you conclude about the bound?
Show solution✓ Checked
(a) With n=2 on [−1,1],Δx=1 and S2=31[f(−1)+4f(0)+f(1)]. For x3:31(−1+0+1)=0=∫−11x3dx. On [0,2]:31(0+4⋅1+8)=4=∫02x3dx. For x4:S2=31(1+0+1)=32, but ∫−11x4dx=52.
(b)ES=52−32=−154. The fourth derivative of x4 is the constant 24, so K=24, and the bound is
180⋅2424⋅25=2880768=154.
The size of the error, ∣ES∣=154, equals the bound.
(c) With n=4,Δx=21 and the points −1,−21,0,21,1:
S4=61[1+4⋅161+0+4⋅161+1]=61⋅25=125,
so ES=52−125=−601, exactly 16 times smaller than with n=2. The bound is 180⋅4424⋅25=601: equal to ∣ES∣ again. So the constant 180 in Theorem 11.10 cannot be replaced by a larger number: for x4 the bound is attained. (The same happens for x2 with the bounds of Theorem 11.8.)
Exercise 11.12★★★The midpoint error
This exercise proves the midpoint half of Theorem 11.8. Centre a subinterval at 0: for a subinterval [m−h,m+h], apply what follows to g(t)=f(m+t), whose integral over [−h,h] is the integral of f over [m−h,m+h]. So let f′′ be continuous on [−h,h], where h>0.
Add the two formulas: the terms in f′(0) cancel. On [0,h],h−x=h−∣x∣, and on [−h,0],x+h=h−∣x∣, so the two integrals combine into the one stated.
(c)2hf(0) is the midpoint rule on [−h,h], a subinterval of width w=2h, so the left side of (b) is the error of the midpoint rule on one subinterval. The weight 21(h−∣x∣)2 is at least 0, and
21∫−hh(h−∣x∣)2dx=∫0h(h−x)2dx=3h3=24w3.
So, if ∣f′′∣≤K, the comparison theorem bounds the error of one subinterval by 24Kw3, and adding up n subintervals of width nb−a gives ∣EM∣≤24n2K(b−a)3. If f′′≥0, each error is at least 0, so EM≥0, that is, Mn≤∫abf(x)dx.
10
Check yourself
1
Which choice of u and dv makes ∫xe3xdx easier?
With u=x,du=dx and v=31e3x, the new integral ∫31e3xdx is easy, and the answer is 31xe3x−91e3x+C. With u=e3x and dv=xdx, the new integral is ∫21x2⋅3e3xdx: the power of x goes up. With u=xe3x and dv=dx, the new integral ∫x(e3x+3xe3x)dx is worse. And 3x⋅ex is not the integrand at all.
2
The best first step for ∫sin3xcos2xdx is
The power of the sine is odd, so save one sinx for du=−sinxdx and write the rest in terms of cosx: the integral becomes −∫(1−u2)u2du. The half-angle identities are for even powers. u=sinx needs a spare factor cosx with the rest even, but the power of the cosine here is even. Parts could work only with much more effort.
3
Which substitution suits ∫x2x2+16dx?
x2+a2 with a=4 calls for x=4tanθ, since 16tan2θ+16=16sec2θ. The sine suits 16−x2 and the secant x2−16.x=16tanθ uses a2 instead of a:256tan2θ+16 is not a perfect square.
4
The form of the partial fraction decomposition of x2(x−1)x+3 is
The factor x is repeated, so it needs a term for each power, x and x2 (Theorem 11.7); here A=−4,B=−3 and C=4. Leaving out either power gives equations with no solution, and x2(x−1)A with a constant A cannot equal a fraction whose numerator is x+3.
5
You find ∫x2+4dx=ln(x+x2+4)+C, and SymPy prints asinh(x/2). Which is true?
arsinh2x=ln(2x+4x2+1)=ln(x+x2+4)−ln2. Antiderivatives on an interval may differ by a constant, so both are right; differentiating either gives x2+41. Different functions can be antiderivatives of the same function, which is what “+C” says.
6
Which of these integrands has no elementary antiderivative?
By Liouville’s theorem, e−x2 has none; its antiderivatives are 2πerfx+C. The others are elementary: −21e−x2 by substitution, −(x2+2x+2)e−x by parts twice, and −21e−2x from the table.
7
If ∣f′′(x)∣≤3 on [0,2], the error bound of Theorem 11.8 for T10 is
12n2K(b−a)3=12⋅1023⋅23=120024=0.02. 0.01 is the bound for the midpoint rule, which has 24 in place of 12. 0.2 divides by n instead of n2, and 0.002 by n3.
8
For a smooth function such as ex on [0,1], doubling n in Simpson’s rule divides the error by about
The bound 180n4K(b−a)5 is divided by 24=16 when n doubles, and for a smooth function such as ex the errors themselves fall by about the same factor, as the widget and the Compute it box show. 4 is the factor for the midpoint and trapezoidal rules, whose bounds shrink like n21; 2 is the factor for left and right sums.