@Kolyo,
So how do we integrate ∫ (tan x)^m (sec x)^n dx, where m >=0 and n > 0 are integers?
Preliminaries...
First, introduce two new functions:
u(x) = sec(x) + tan(x);
v(x) = sec(x) - tan(x).
Second, note that:
sec = (u + v) / 2, and
tan = (u - v) / 2.
Third, note that u(x) * v(x) = 1,
because
uv = (sec + tan)(sec - tan) = sec^2 - tan^2 = 1 = (tan^2 + 1) - tan^2 = 1.
Fourth, investigate properties of integration and differentiation:
(i)
u' = (sec + tan)' = sec' + tan' = sec*tan + sec^2 = (tan + sec) * sec = u * sec
v' = (sec - tan)' = sec' - tan' = sec*tan - sec^2 = (tan - sec) * sec = - (sec - tan) sec = - v * sec
(ii)
If n is an integer other than zero,
then
∫ sec(x) * u(x)^n dx
= ∫ u(x)^(n-1) * sec(x) * u(x) dx
= ∫ u(x)^(n-1) * u'(x) dx
= ∫ U^(n-1) * dU [where U = u(x)]
= 1/n * U^n + C = u(x)^n / n + C.
(iii)
If n is a positive integer,
then
∫ sec(x) * v(x)^n dx
= ∫ sec(x) * u(x)^(-n) dx
[because v = 1/u]
= u(x)^(-n) / (-n) + C
[because of (ii)]
= - v(x)^n / n + C.
(iv)
∫ sec(x) dx = ∫ u*sec(x)/u dx = ∫ u'/u dx = ∫ du/u = ln |u| + C
Main argument...
We can use all that to solve an integration problem like ∫ (tan x)^2 (sec x)^5 dx.
∫ (tan x)^2 (sec x)^5 dx
= ∫ sec(x) (tan x)^2 (sec x)^4 dx
= ∫ sec(x) [(u - v)/2]^2 [(u + v)/2]^4 dx
= 1/64 * ∫ sec(x) (u - v)^2 (u + v)^4 dx
= 1/64 * ∫ sec(x) (u^2 - 2uv + v^2) (u^4 + 4u^3 v + 6u^2 v^2 + 4uv^3 + v^4) dx
= 1/64 * ∫ sec(x) (u^2 - 2 + v^2) (u^4 + 4u^2 + 6 + 4v^2 + v^4) dx
[using uv = 1]
= 1/64 * ∫ sec(x) (u^6 + 2u^4 - u^2 - 4 - v^2 + 2v^4 + v^6) dx
[multiplying polynomials through and using uv = 1]
= 1/64 * [(1/6) u^6 + (1/2) u^4 - (1/2) u^2 - 4 ln |u| + (1/2) v^2 - (1/2) v^4 - (1/6) v^6] + C
[using (ii), (iii), (iv) above]
= (1/384) u^6 + (1/128) u^4 - (1/128) u^2 - (1/16) ln |u| + (1/128) v^2 - (1/128) v^4 - (1/384) v^6 + C
I think that's done right, but I don't feel like checking the details. In any case, it takes a bit of work if you want to put it in a more familiar form, but at least the integration is done, and this approach works for integrating the general form of ∫ (tan x)^m (sec x)^n dx, where m >=0 and n > 0 are both integers.
Footnote:
Those same new functions, u(x) and v(x), can be used to perform a simpler, more intuitive version of the
WeierstraB substitution.
Suppose you have any rational function of sin(x) and cos(x) that you want to integrate:
F[sin x, cos x].
∫ F[sin x, cos x] dx
= ∫ F[tan/sec, 1/sec] dx
= ∫ F[(u - v)/(u + v), 2/(u+v)] (u*sec) dx / (u*sec)
= ∫ F[ (u^2 - 1) / (u^2 + 1), 2u / (u^2 + 1)] du / [u(u+v)/2]
= ∫ F[ (u^2 - 1) / (u^2 + 1), 2u / (u^2 + 1)] 2 du / (u^2 + 1)
So it reduces the integrand to a rational function in one variable just like the normal Weierstrass substitution does.
That's about all u(x) and v(x) do, as far we know...