Application Center - Maplesoft

App Preview:

Calculus II: Lesson 12: Integration of Trigonometric Powers

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

L12-intTechTrigPowers.mws

Calculus II

Lesson 12: Integration of Trigonometric Powers

Introduction

> restart;

One of the most important uses of reduction formulas is to evaluate anti-derivatives of powers of trigonometric functions, such as Int(sin(x)^n,x) , Int(sin(x)^n*cos(x)^m,x) or even Int(tan(x)^n*sec(x)^m,x) . In this worksheet, we will see how this is done.

Of course, you already know some simple integrals of this type:

> Int(sin(x),x) = int(sin(x), x) + C;

Int(sin(x),x) = -cos(x)+C

> Int(cos(x), x) = int(cos(x), x) + C;

Int(cos(x),x) = sin(x)+C

> Int(sec(x)^2,x) = int(sec(x)^2, x) + C;

Int(sec(x)^2,x) = sin(x)/cos(x)+C

(It is hard to get Maple to write tan(x) in this last expression--it seems to prefer to work with sines and cosines.)

Some other integrals involving low powers can be done quickly with a substitution:

> with(student):

> p1 := Int(sin(x)^5 * cos(x), x);

p1 := Int(sin(x)^5*cos(x),x)

> p2 := changevar(u=sin(x), p1, u);

p2 := Int(u^5,u)

> p3 := value(p2);

p3 := 1/6*u^6

> p4 := subs(u=sin(x), p3);

p4 := 1/6*sin(x)^6

> p1 = p4 + C;

Int(sin(x)^5*cos(x),x) = 1/6*sin(x)^6+C

(Of course, we should check this answer by differentiating it.) Integrals of the form Int(cos(x)^n*sin(x),x) can be done similarly, by substituting u = cos(x) . On the other hand, since the derivative of tan(x) is sec(x)^2 , for a tangent substitution to work we need an integral of the form Int(tan(x)^n*sec(x)^2,x) .

Since we know, or know how to find, anti-derivatives of certain small powers of trigonometric functions, it is natural to ask whether examples involving higher powers can be turned into these by reduction formulas.

Question 1

Find the following anti-derivatives by performing a suitable substitution.

Solutions. (Be sure you have loaded the student package before executing these solutions.)

(a) Int(cos(x)^3*sin(x),x)

> p1 := Int( cos(x)^3 * sin(x), x);

p1 := Int(cos(x)^3*sin(x),x)

> p2 := changevar(u=cos(x), p1, u);

p2 := Int(-u^3,u)

> p3 := simplify(p2);

p3 := -Int(u^3,u)

> p4 := value(p3);

p4 := -1/4*u^4

> p5 := subs(u=cos(x), p4);

p5 := -1/4*cos(x)^4

> p1 = p5 + C;

Int(cos(x)^3*sin(x),x) = -1/4*cos(x)^4+C

>

(b) Int(cos(x)^9*sin(x),x)

> p1 := Int( cos(x)^9 * sin(x), x);

p1 := Int(cos(x)^9*sin(x),x)

> p2 := changevar(u=cos(x), p1, u);

p2 := Int(-u^9,u)

> p3 := simplify(p2);

p3 := -Int(u^9,u)

> p4 := value(p3);

p4 := -1/10*u^10

> p5 := subs(u=cos(x), p4);

p5 := -1/10*cos(x)^10

> p1 = p5 + C;

Int(cos(x)^9*sin(x),x) = -1/10*cos(x)^10+C

>

(c) Int(tan(x)^4*sec(x)^2,x)

> p1 := Int( tan(x)^4 * sec(x)^2 , x);

p1 := Int(tan(x)^4*sec(x)^2,x)

> p2 := changevar( u=tan(x), p1, u);

p2 := Int(u^4,u)

> p3 := value(p2);

p3 := 1/5*u^5

> p4 := subs( u=tan(x), p3);

p4 := 1/5*tan(x)^5

> p1 = p4 + C;

Int(tan(x)^4*sec(x)^2,x) = 1/5*tan(x)^5+C

>

>

Question 2

Find each of the following anti-derivatives by using a suitable substitution.

Solutions.

(a) Int(sin(x)^n*cos(x),x)

> p1 := Int( sin(x)^n * cos(x), x);

p1 := Int(sin(x)^n*cos(x),x)

> p2 := changevar( u=sin(x), p1, u);

p2 := Int(u^n,u)

> p3 := value(p2);

p3 := u^(n+1)/(n+1)

> p4 := subs( u=sin(x), p3);

p4 := sin(x)^(n+1)/(n+1)

> p1 = p4 + C;

Int(sin(x)^n*cos(x),x) = sin(x)^(n+1)/(n+1)+C

>

(b) Int(cos(x)^n*sin(x),x)

> p1 := Int(cos(x)^n * sin(x), x);

p1 := Int(cos(x)^n*sin(x),x)

> p2 := changevar( u=cos(x), p1, u);

p2 := Int(-u^n,u)

> p3 := simplify(p2);

p3 := -Int(u^n,u)

> p4 := value(p3);

p4 := -u^(n+1)/(n+1)

> p5 := subs( u=cos(x), p4);

p5 := -cos(x)^(n+1)/(n+1)

> p1 = p5 + C;

Int(cos(x)^n*sin(x),x) = -cos(x)^(n+1)/(n+1)+C

>

(c) Int(tan(x)^n*sec(x)^2,x)

> p1 := Int( tan(x)^n * sec(x)^2 , x);

p1 := Int(tan(x)^n*sec(x)^2,x)

> p2 := changevar( u=tan(x), p1, u);

p2 := Int(u^n,u)

> p3 := value(p2);

p3 := u^(n+1)/(n+1)

> p4 := subs( u=tan(x), p3);

p4 := tan(x)^(n+1)/(n+1)

> p1 = p4 + C;

Int(tan(x)^n*sec(x)^2,x) = tan(x)^(n+1)/(n+1)+C

>

(d) Int(cot(x)^n*csc(x)^2,x)

> p1 := Int( cot(x)^n * csc(x)^2 , x);

p1 := Int(cot(x)^n*csc(x)^2,x)

> p2 := changevar( u=cot(x), p1, u);

p2 := Int(-u^n,u)

> p3 := simplify(p2);

p3 := -Int(u^n,u)

> p4 := value(p3);

p4 := -u^(n+1)/(n+1)

> p5 := subs( u=cot(x), p4);

p5 := -cot(x)^(n+1)/(n+1)

> p1 = p5 + C;

Int(cot(x)^n*csc(x)^2,x) = -cot(x)^(n+1)/(n+1)+C

>

Integrals of the form Int(sin(x)^n*cos(x)^m,x)

> restart;

> with(student):

We will begin with a special case: m = 0 . Our integral is then

> p1 := Int(sin(x)^n , x);

p1 := Int(sin(x)^n,x)

There is no problem if n = 0 or n = 1 , so we can assume 2 <= n . In this case, as discussed in class, the relevant reduction formula is

Int(sin(x)^n,x) = -1/n sin(x)^(n-1)*cos(x) + (n-1)/n Int(sin(x)^(n-2),x) .

>

Derivation of the formula (optional)

The trick is to separate off a factor of sin(x)^2 , and write it as 1-cos(x)^2 :

> p2 := Int( sin(x)^2*sin(x)^(n-2), x);

p2 := Int(sin(x)^2*sin(x)^(n-2),x)

> p3 := subs(sin(x)^2 = (1-cos(x)^2), p2);

p3 := Int((1-cos(x)^2)*sin(x)^(n-2),x)

> p4 := expand(p3, n-2);

p4 := Int(sin(x)^(n-2),x)-Int(sin(x)^(n-2)*cos(x)^2...

(The optional argument n-2 in the expand command prevents Maple from expanding the exponent n-2 .) We now want to integrate the second integral by parts, writing it as Int(sin(x)^(n-2)*cos(x)*cos(x),x) , and differentiating the second factor of cos(x) . This requires us to anti-differentiate the factor sin(x)^(n-2)*cos(x) , but we saw how to do this earlier. When getting Maple to do this calculation, it is convenient to use a command called op . The name op is short for operand , and the op command refers to a particular operand, or piece, of an expression. For example, in the expression p4 you see two integrals: two operands. (Each of these is itself built up from lower-level pieces, but that need not concern us here.) Each of these integrals can be referred to by picking out the correct operand from p4:

> op(1, p4);

Int(sin(x)^(n-2),x)

> op(2, p4);

-Int(sin(x)^(n-2)*cos(x)^2,x)

With the op command, we can integrate just one of these two integrals by parts:

> p5 := op(1, p4) + intparts(op(2, p4), cos(x));

p5 := Int(sin(x)^(n-2),x)-cos(x)*sin(x)^(n-1)/(n-1)...

> p6 := op(1, p5) + op(2, p5) + simplify(op(3, p5));

p6 := Int(sin(x)^(n-2),x)-cos(x)*sin(x)^(n-1)/(n-1)...

We are almost done. This last expression, p6, is equal to our original integral p1. The first term is what we want: an integral like p1, but with a lower power. Unfortunately, the original integral p1 has shown up again in the last term. We can get around this problem, though, by solving the resulting equation for p1. Since Maple thinks that p1 already has a value, it will probably refuse to solve an equation for it, so we first replace p1 in the equation by an unassigned expression, and then solve for that expression.

> eqn1 := p1 = p6;

eqn1 := Int(sin(x)^n,x) = Int(sin(x)^(n-2),x)-cos(x...

> eqn2 := subs(p1=a, eqn1);

eqn2 := a = Int(sin(x)^(n-2),x)-cos(x)*sin(x)^(n-1)...

> p7 := solve(eqn2, a);

p7 := (Int(sin(x)^(n-2),x)*n-Int(sin(x)^(n-2),x)-co...

> p1 = p7 + C;

Int(sin(x)^n,x) = (Int(sin(x)^(n-2),x)*n-Int(sin(x)...

>

Question 3

Use the reduction formula for Int(sin(x)^n,x) to find anti-derivatives for Int(sin(x)^5,x) , Int(sin(x)^4,x) and Int(sin(x)^19,x) .

You can do this painfully by hand, or you could try to be clever and write a Maple procedure that works out the formula. For example, you could write a procedure whose input is the exponent n and whose output is the right-hand side of the reduction formula. Even better: with a for loop, or a recursive program, you could write a procedure that accepts n as input and evaluates the integral completely.

Solutions. We will do the first two anti-derivatives by writing a procedure whose input is n , and whose output is the right-hand side of the formula. Note the use of the op command (explained in the optional section above) to separate off terms in the intermediate answers.

> sinred := proc(n) (-1/n)*sin(x)^(n-1) * cos(x)

> + (n-1)/n * Int( sin(x)^(n-2), x);

> end:

Here is a solution for Int(sin(x)^5,x) :

> p1 := Int( sin(x)^5 , x);

p1 := Int(sin(x)^5,x)

> p2 := sinred(5);

p2 := -1/5*sin(x)^4*cos(x)+4/5*Int(sin(x)^3,x)

> p3 := op(1, p2);

p3 := -1/5*sin(x)^4*cos(x)

> p4 := (4/5)*sinred(3);

p4 := -4/15*sin(x)^2*cos(x)+8/15*Int(sin(x),x)

> p5 := p3 + value(p4);

p5 := -1/5*sin(x)^4*cos(x)-4/15*sin(x)^2*cos(x)-8/1...

> p1 = p5 + C;

Int(sin(x)^5,x) = -1/5*sin(x)^4*cos(x)-4/15*sin(x)^...

Here is Int(sin(x)^4,x) , organised slightly differently:

> q1 := Int( sin(x)^4 , x);

q1 := Int(sin(x)^4,x)

> q2 := sinred(4);

q2 := -1/4*sin(x)^3*cos(x)+3/4*Int(sin(x)^2,x)

> q3 := (3/4)*sinred(2);

q3 := -3/8*sin(x)*cos(x)+3/8*Int(1,x)

> q4 := value(q3);

q4 := -3/8*sin(x)*cos(x)+3/8*x

> q5 := op(1, q2) + q4;

q5 := -1/4*sin(x)^3*cos(x)-3/8*sin(x)*cos(x)+3/8*x

> q1 = q5 + C;

Int(sin(x)^4,x) = -1/4*sin(x)^3*cos(x)-3/8*sin(x)*c...

The anti-derivative Int(sin(x)^19,x) could be done the same way, but it would obviously be long. Instead, let's write a recursive procedure ( a procedure which calls itself repeatedly) to do the reduction formula as many times as needed. The procedure below is very basic: a more sophisticated version would have checks to make sure that you didn't try to use it with (say) n = 1/2 or n = -3 . The program checks to see whether n is at least 2; if so, it applies the reduction formula, which involves calling itself with a smaller value of n ; if not, n is presumably either 0 or 1 and the integral can be evaluated.

> sinpowerint := proc(n)

> if(n >= 2) then (-1/n)*sin(x)^(n-1) * cos(x)

> + (n-1)/n * sinpowerint(n-2);

> else value(Int(sin(x)^n, x));

> fi;

> end:

We can quickly check our new procedure by evaluating the two cases we did earlier:

> sinpowerint(5);

-1/5*sin(x)^4*cos(x)-4/15*sin(x)^2*cos(x)-8/15*cos(...

> sinpowerint(4);

-1/4*sin(x)^3*cos(x)-3/8*sin(x)*cos(x)+3/8*x

These answers agree with what we got earlier, so we can go for the big kahuna:

> Int( sin(x)^19, x) = sinpowerint(19) + C;

Int(sin(x)^19,x) = -1/19*sin(x)^18*cos(x)-18/323*si...
Int(sin(x)^19,x) = -1/19*sin(x)^18*cos(x)-18/323*si...

Congratulations: you have just re-written a small part of Maple 's int command.

>

>

The next special case is the integral Int(cos(x)^m,x) . This type of integral can be done with the reduction formula

Int(cos(x)^m,x) = 1/m cos(x)^(m-1)*sin(x) + (m-1)/m Int(cos(x)^(m-2),x) .

Finally, for the general case, there are two formulas:

Int(sin(x)^n*cos(x)^m,x) = -sin(x)^(n-1)*cos(x)^(m+1)/(n+m) + (n-1)/(n+m) Int(sin(x)^(n-2)*cos(x)^m,x) ,

and

Int(sin(x)^n*cos(x)^m,x) = sin(x)^(n+1)*cos(x)^(m-1)/(n+m) + (m-1)/(n+m) Int(sin(x)^n*cos(x)^(m-2),x) .

Repeated use of one or other of these will reduce the problem to one of the special cases we have already studied.

>

Question 4

Find Int(sin(x)^7*cos(x)^5,x) , Int(sin(x)^4*cos(x)^7,x) and Int(sin(x)^6*cos(x)^4,x) .

Solutions. For the first two, we will lower the power of cosine. In the first example, it probably desn't make much difference which way we go, but the cosine has the lower power; in the second, it will be much quicker to lower the

odd power than the even one. To save typing, we will write a procedure which will lower a cosine power in an integral of this type. n is the power of sin(x) ; m is the power of cos(x) .

> lowercos := proc(n,m) sin(x)^(n+1)*cos(x)^(m-1)/(n+m)

> + (m-1)/(n+m)*Int(sin(x)^n * cos(x)^(m-2) , x);

> end:

> p1 := Int(sin(x)^7 * cos(x)^5 , x);

p1 := Int(sin(x)^7*cos(x)^5,x)

> p2 := lowercos(7,5);

p2 := 1/12*sin(x)^8*cos(x)^4+1/3*Int(sin(x)^7*cos(x...

> p3 := (1/3)*lowercos(7,3);

p3 := 1/30*sin(x)^8*cos(x)^2+1/15*Int(sin(x)^7*cos(...

> p4 := value(p3);

p4 := 1/30*sin(x)^8*cos(x)^2+1/120*sin(x)^8

> p1 = op(1,p2) + p4 + C;

Int(sin(x)^7*cos(x)^5,x) = 1/12*sin(x)^8*cos(x)^4+1...

(It is interesting to try and check this result by differentiation!)

Here is the second one. Notice that by choosing to reduce the odd power, we end up with an easy anti-derivative, and never need to reduce the other power.

> q1 := Int( sin(x)^4 * cos(x)^7 , x);

q1 := Int(sin(x)^4*cos(x)^7,x)

> q2 := lowercos(4,7);

q2 := 1/11*sin(x)^5*cos(x)^6+6/11*Int(sin(x)^4*cos(...

> q3 := (6/11)*lowercos(4,5);

q3 := 2/33*sin(x)^5*cos(x)^4+8/33*Int(sin(x)^4*cos(...

> q4 := (8/33)*lowercos(4,3);

q4 := 8/231*sin(x)^5*cos(x)^2+16/231*Int(sin(x)^4*c...

The last anti-derivative can be done by substituting u = sin(x) ; we will "cheat" and get Maple to evaluate it in one step.

> q5 := value(q4);

q5 := 8/231*sin(x)^5*cos(x)^2+16/1155*sin(x)^5

Now we need to put all the pieces together:

> q1 = op(1, q2) + op(1, q3) + q5 + C;

Int(sin(x)^4*cos(x)^7,x) = 1/11*sin(x)^5*cos(x)^6+2...

For the last example, since both powers are even, it probably doesn't make much difference which way we go, but it can't hurt to lower the smaller power. There is another advantage to doing that here: we already have a procedure which will lower a power of cosine for us, as well as one which will evaluate the integral that remains when the powers of cosine have disappeared.

> r1 := Int( sin(x)^6 * cos(x)^4, x);

r1 := Int(sin(x)^6*cos(x)^4,x)

> r2 := lowercos(6,4);

r2 := 1/10*sin(x)^7*cos(x)^3+3/10*Int(sin(x)^6*cos(...

> r3 := (3/10)*lowercos(6,2);

r3 := 3/80*sin(x)^7*cos(x)+3/80*Int(sin(x)^6,x)

> r4 := (3/80)*sinpowerint(6);

r4 := -1/160*sin(x)^5*cos(x)-1/128*sin(x)^3*cos(x)-...

> r1 = op(1,r2) + op(1,r3) + r4 + C;

Int(sin(x)^6*cos(x)^4,x) = 1/10*sin(x)^7*cos(x)^3+3...

>

Integrals of the form Int(tan(x)^n*sec(x)^m,x)

Integrals of this type can be handled in a very similar maner to those of the previous section. The special cases m = 0 or n = 0 can be handled by the reduction formulas

Int(tan(x)^n,x) = 1/(n-1) tan(x)^(n-1) - Int(tan(x)^(n-2),x)

and

Int(sec(x)^m,x) = 1/(m-1) tan(x)*sec(x)^(m-2) + (m-2)/(m-1) Int(sec(x)^(m-2),x)

respectively. The general case can then be done with one or other of the formulas

Int(tan(x)^n*sec(x)^m,x) = 1/(n+1) tan(x)^(n+1)*sec(x)^(m-2) - (m-2)/(n+1) Int(tan(x)^(n+2)*sec(x)^(m-2),x)

or

Int(tan(x)^n*sec(x)^m,x) = 1/m tan(x)^(n-1)*sec(x)^m - (n-1)/m Int(tan(x)^(n-2)*sec(x)^(m+2),x) .

Question 5

Find the anti-derivatives Int(tan(x)^4,x) , Int(sec(x)^5,x) , Int(tan(x)^4*sec(x)^4,x) and Int(tan(x)^4*sec(x)^5,x) .

Solutions. We will do the first two by writing procedures to reduce powers of tangent or secant.

> tanred := proc(n) 1/(n-1) * tan(x)^(n-1) - Int(tan(x)^(n-2), x) end:

> secred := proc(m) 1/(m-1) * tan(x)*sec(x)^(m-2)

> + (m-2)/(m-1) * Int(sec(x)^(m-2) , x) end:

> p1 := Int( tan(x)^4, x);

p1 := Int(tan(x)^4,x)

> p2 := tanred(4);

p2 := 1/3*tan(x)^3-Int(tan(x)^2,x)

> p3 := -tanred(2);

p3 := -tan(x)+Int(1,x)

> p4 := value(p3);

p4 := -tan(x)+x

> p1 = op(1, p2) + p4 + C;

Int(tan(x)^4,x) = 1/3*tan(x)^3-tan(x)+x+C

>

> q1 := Int( sec(x)^5, x);

q1 := Int(sec(x)^5,x)

> q2 := secred(5);

q2 := 1/4*tan(x)*sec(x)^3+3/4*Int(sec(x)^3,x)

> q3 := (3/4)*secred(3);

q3 := 3/8*tan(x)*sec(x)+3/8*Int(sec(x),x)

The reduction formula is of no further help, but you are supposed to know this anti-derivative.

> q4 := value(q3);

q4 := 3/8*tan(x)*sec(x)+3/8*ln(sec(x)+tan(x))

> q1 = op(1, q2) + q4 + C;

Int(sec(x)^5,x) = 1/4*tan(x)*sec(x)^3+3/8*tan(x)*se...

>

For the last two examples, notice that if we start off by reducing the power of tangent each time, we will (after two applications of the appropriate reduction formula) end up with an integral which involves only secant. The clever way to do these two would therefore be to write two recursive programs: one to reduce powers of tangent, and one to evaluate the anti-derivative of a power of secant. Here they are ( n is the power of tangent; m is the power of secant).

> tanred2 := proc(n,m)

> if(n >= 2) then (1/m)*tan(x)^(n-1)*sec(x)^m

> - (n-1)/m * tanred2(n-2,m+2);

> else Int(tan(x)^n * sec(x)^m, x);

> fi;

> end:

> secpowerint := proc(m)

> if(m >= 2) then 1/(m-1)*tan(x)*sec(x)^(m-2)

> + (m-2)/(m-1) * secpowerint(m-2);

> else value(Int(sec(x)^m, x));

> fi;

> end:

We can now evaluate both anti-derivatives.

> r1 := Int(tan(x)^4 * sec(x)^4 , x);

r1 := Int(tan(x)^4*sec(x)^4,x)

> r2 := tanred2(4,4);

r2 := 1/4*tan(x)^3*sec(x)^4-1/8*tan(x)*sec(x)^6+1/8...

> r3 := (3/8)*secpowerint(8);

r3 := 3/56*tan(x)*sec(x)^6+9/140*tan(x)*sec(x)^4+3/...

> r1 = op(1,r2) + op(2,r2) + r3 + C;

Int(tan(x)^4*sec(x)^4,x) = 1/4*tan(x)^3*sec(x)^4-1/...

>

> s1 := Int( tan(x)^4 * sec(x)^5 , x);

s1 := Int(tan(x)^4*sec(x)^5,x)

> s2 := tanred2(4,5);

s2 := 1/5*tan(x)^3*sec(x)^5-3/35*tan(x)*sec(x)^7+3/...

> s3 := (3/35)*secpowerint(9);

s3 := 3/280*tan(x)*sec(x)^7+1/80*tan(x)*sec(x)^5+1/...

> s1 = op(1,s2) + op(2,s2) + s3 + C;

Int(tan(x)^4*sec(x)^5,x) = 1/5*tan(x)^3*sec(x)^5-3/...
Int(tan(x)^4*sec(x)^5,x) = 1/5*tan(x)^3*sec(x)^5-3/...