L12intTechTrigPowers.mws
Calculus II
Lesson 12: Integration of Trigonometric Powers
Introduction
>
restart;
One of the most important uses of reduction formulas is to evaluate antiderivatives 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 expressionit 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, antiderivatives 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 antiderivatives 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);
>
p2 := changevar(u=cos(x), p1, u);
>
p3 := simplify(p2);
>
p4 := value(p3);
>
p5 := subs(u=cos(x), p4);
>
p1 = p5 + C;
>
(c)
>
p1 := Int( tan(x)^4 * sec(x)^2 , x);
>
p2 := changevar( u=tan(x), p1, u);
>
p3 := value(p2);
>
p4 := subs( u=tan(x), p3);
>
p1 = p4 + C;
>
>
Question 2
Find each of the following antiderivatives by using a suitable substitution.
Solutions.
(a)
>
p1 := Int( sin(x)^n * cos(x), x);
>
p2 := changevar( u=sin(x), p1, u);
>
p3 := value(p2);
>
p4 := subs( u=sin(x), p3);
>
p1 = p4 + C;
>
(b)
>
p1 := Int(cos(x)^n * 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;
>
(c)
>
p1 := Int( tan(x)^n * sec(x)^2 , x);
>
p2 := changevar( u=tan(x), p1, u);
>
p3 := value(p2);
>
p4 := subs( u=tan(x), p3);
>
p1 = p4 + C;
>
(d)
>
p1 := Int( cot(x)^n * csc(x)^2 , x);
>
p2 := changevar( u=cot(x), p1, u);
>
p3 := simplify(p2);
>
p4 := value(p3);
>
p5 := subs( u=cot(x), p4);
>
p1 = p5 + C;
>
Integrals of the form
>
restart;
>
with(student):
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)^(n2), x);
>
p3 := subs(sin(x)^2 = (1cos(x)^2), p2);
>
p4 := expand(p3, n2);
(The optional argument
n2
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 antidifferentiate 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 lowerlevel 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 antiderivatives 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 righthand 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 antiderivatives by writing a procedure whose input is
, and whose output is the righthand 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)^(n1) * cos(x)
>
+ (n1)/n * Int( sin(x)^(n2), 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);
>
p1 = p5 + C;
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 antiderivative
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)^(n1) * cos(x)
>
+ (n1)/n * sinpowerint(n2);
>
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);
>
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 rewritten 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)^(m1)/(n+m)
>
+ (m1)/(n+m)*Int(sin(x)^n * cos(x)^(m2) , x);
>
end:
>
p1 := Int(sin(x)^7 * cos(x)^5 , x);
>
p2 := lowercos(7,5);
>
p3 := (1/3)*lowercos(7,3);
>
p4 := value(p3);
>
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 antiderivative, 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 antiderivative 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 the form
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
=

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

or
=

.
Question 5
Find the antiderivatives
,
,
and
.
Solutions.
We will do the first two by writing procedures to reduce powers of tangent or secant.
>
tanred := proc(n) 1/(n1) * tan(x)^(n1)  Int(tan(x)^(n2), x) end:
>
secred := proc(m) 1/(m1) * tan(x)*sec(x)^(m2)
>
+ (m2)/(m1) * Int(sec(x)^(m2) , x) end:
>
p1 := Int( tan(x)^4, x);
>
p2 := tanred(4);
>
p3 := tanred(2);
>
p4 := value(p3);
>
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 antiderivative.
>
q4 := value(q3);
>
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 antiderivative 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)^(n1)*sec(x)^m
>
 (n1)/m * tanred2(n2,m+2);
>
else Int(tan(x)^n * sec(x)^m, x);
>
fi;
>
end:
>
secpowerint := proc(m)
>
if(m >= 2) then 1/(m1)*tan(x)*sec(x)^(m2)
>
+ (m2)/(m1) * secpowerint(m2);
>
else value(Int(sec(x)^m, x));
>
fi;
>
end:
We can now evaluate both antiderivatives.
>
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;