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 , or even . 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(cos(x), x) = int(cos(x), x) + C;
> Int(sec(x)^2,x) = int(sec(x)^2, x) + C;
(It is hard to get Maple to write 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);
> p2 := changevar(u=sin(x), p1, u);
> p3 := value(p2);
> p4 := subs(u=sin(x), p3);
> p1 = p4 + C;
(Of course, we should check this answer by differentiating it.) Integrals of the form can be done similarly, by substituting . On the other hand, since the derivative of is , for a tangent substitution to work we need an integral of the form .
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)
> p1 := Int( cos(x)^3 * sin(x), x);
> p2 := changevar(u=cos(x), p1, u);
> p3 := simplify(p2);
> p4 := value(p3);
> p5 := subs(u=cos(x), p4);
> p1 = p5 + C;
>
(b)
> p1 := Int( cos(x)^9 * sin(x), x);
(c)
> p1 := Int( tan(x)^4 * sec(x)^2 , x);
> p2 := changevar( u=tan(x), p1, u);
> p4 := subs( u=tan(x), p3);
Question 2
Find each of the following anti-derivatives by using a suitable substitution.
Solutions.
> p1 := Int( sin(x)^n * cos(x), x);
> p2 := changevar( u=sin(x), p1, u);
> p4 := subs( u=sin(x), p3);
> p1 := Int(cos(x)^n * sin(x), x);
> p2 := changevar( u=cos(x), p1, u);
> p5 := subs( u=cos(x), p4);
> p1 := Int( tan(x)^n * sec(x)^2 , x);
(d)
> p1 := Int( cot(x)^n * csc(x)^2 , x);
> p2 := changevar( u=cot(x), p1, u);
> p5 := subs( u=cot(x), p4);
Integrals of the form
We will begin with a special case: . Our integral is then
> p1 := Int(sin(x)^n , x);
There is no problem if or , so we can assume . In this case, as discussed in class, the relevant reduction formula is
= + .
Derivation of the formula (optional)
The trick is to separate off a factor of , and write it as :
> p2 := Int( sin(x)^2*sin(x)^(n-2), x);
> p3 := subs(sin(x)^2 = (1-cos(x)^2), p2);
> p4 := expand(p3, n-2);
(The optional argument n-2 in the expand command prevents Maple from expanding the exponent .) We now want to integrate the second integral by parts, writing it as , and differentiating the second factor of . This requires us to anti-differentiate the factor , 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);
> op(2, p4);
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));
> p6 := op(1, p5) + op(2, p5) + simplify(op(3, p5));
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;
> eqn2 := subs(p1=a, eqn1);
> p7 := solve(eqn2, a);
> p1 = p7 + C;
Question 3
Use the reduction formula for to find anti-derivatives for , and .
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 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 as input and evaluates the integral completely.
Solutions. We will do the first two anti-derivatives by writing a procedure whose input is , 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 :
> p1 := Int( sin(x)^5 , x);
> p2 := sinred(5);
> p3 := op(1, p2);
> p4 := (4/5)*sinred(3);
> p5 := p3 + value(p4);
Here is , organised slightly differently:
> q1 := Int( sin(x)^4 , x);
> q2 := sinred(4);
> q3 := (3/4)*sinred(2);
> q4 := value(q3);
> q5 := op(1, q2) + q4;
> q1 = q5 + C;
The anti-derivative 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) or . The program checks to see whether is at least 2; if so, it applies the reduction formula, which involves calling itself with a smaller value of ; if not, 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;
We can quickly check our new procedure by evaluating the two cases we did earlier:
> sinpowerint(5);
> sinpowerint(4);
These answers agree with what we got earlier, so we can go for the big kahuna:
> Int( sin(x)^19, x) = sinpowerint(19) + C;
Congratulations: you have just re-written a small part of Maple 's int command.
The next special case is the integral . This type of integral can be done with the reduction formula
+ .
Finally, for the general case, there are two formulas:
= + ,
and
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 , and .
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. is the power of ; is the power of .
> 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);
> p1 := Int(sin(x)^7 * cos(x)^5 , x);
> p2 := lowercos(7,5);
> p3 := (1/3)*lowercos(7,3);
> p1 = op(1,p2) + p4 + C;
(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);
> q2 := lowercos(4,7);
> q3 := (6/11)*lowercos(4,5);
> q4 := (8/33)*lowercos(4,3);
The last anti-derivative can be done by substituting ; we will "cheat" and get Maple to evaluate it in one step.
> q5 := value(q4);
Now we need to put all the pieces together:
> q1 = op(1, q2) + op(1, q3) + q5 + C;
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);
> r2 := lowercos(6,4);
> r3 := (3/10)*lowercos(6,2);
> r4 := (3/80)*sinpowerint(6);
> r1 = op(1,r2) + op(1,r3) + r4 + C;
Integrals of this type can be handled in a very similar maner to those of the previous section. The special cases or can be handled by the reduction formulas
= -
= +
respectively. The general case can then be done with one or other of the formulas
or
= - .
Question 5
Find the anti-derivatives , , and .
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);
> p2 := tanred(4);
> p3 := -tanred(2);
> p1 = op(1, p2) + p4 + C;
> q1 := Int( sec(x)^5, x);
> q2 := secred(5);
> q3 := (3/4)*secred(3);
The reduction formula is of no further help, but you are supposed to know this anti-derivative.
> q1 = op(1, q2) + q4 + C;
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 ( is the power of tangent; 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);
> 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));
We can now evaluate both anti-derivatives.
> r1 := Int(tan(x)^4 * sec(x)^4 , x);
> r2 := tanred2(4,4);
> r3 := (3/8)*secpowerint(8);
> r1 = op(1,r2) + op(2,r2) + r3 + C;
> s1 := Int( tan(x)^4 * sec(x)^5 , x);
> s2 := tanred2(4,5);
> s3 := (3/35)*secpowerint(9);
> s1 = op(1,s2) + op(2,s2) + s3 + C;