# How to integrate $\int \sec ^m(x) \tan ^n(x) \, dx$

$$\sec ^2(x)=\tan ^2(x)+1$$ $$\csc ^2(x)=\cot ^2(x)+1$$

We can evaluate integrals of the form:

$$\int \sec ^m(x) \tan ^n(x) \, dx$$

$$\int \csc ^m(x) \cot ^n(x) \, dx$$

with substitution unless $m$ is odd and $n$ is even. What I am interested to know is why am I not able to solve this with substitution if $m$ is odd and $n$ is even. I am aware that I can solve it by integration by parts. But I do not see the underlying reason for why it is not possible when using substitution?

What if $m$ is odd, $n$ is even. For example, $m=1, n=0$.

$$\int \sec x\;dx$$ Proceed as the method says. Keep $\sec^2$ and use a pythagorean identity to convert all the rest to $\tan$ ... even if you don't see two secants, you can still do it: $$\int \sec x\;dx = \int \frac{\sec^2 x}{\sec x}\;dx = \int\frac{\sec^2 x}{\sqrt{1+\tan^2 x}} \;dx$$ then substitute $u = \tan x$ to get $$\int \frac{du}{\sqrt{1+u^2}}$$ Then do this one "somehow" and substitute back $$\int \frac{du}{\sqrt{1+u^2}} = \log\big(u+\sqrt{1+u^2}\;\big) + C =\log\big(\tan x + \sqrt{\sec^2 x}\;\big)+ C = \log(\tan x \pm \sec x) + C$$

The difference in these cases ($n$ even and $m$ odd) is that you do not end up with a rational function of $u$ to integrate. You have a square root.

GEdgar's good answer shows that you can evaluate the integral $$\int \sec^m x \tan^n x \,dx. \qquad m, n \in \Bbb Z_{\geq 0}$$ with substitution, even when $$m$$ odd and $$n$$ even.

The spirit of the question is thus closer to

Why do neither of the substitutions $$u = \sec x, \quad du = \sec x \tan x \,dx \qquad \textrm{and} \qquad v = \tan x, \quad \,dv = \sec^2 x \,dx$$ produce integrals of polynomial (or rational) functions when $$m$$ is odd and $$n$$ is even?

Notice that substituting $$\sec^2 x = \tan^2 x + 1$$ may change replace the integrand with one with multiple terms, but the powers of $$\sec x$$ and $$\tan x$$ of each resulting term are respectively odd and even.

Making the first substitution leaves an odd number $$p$$ of powers of $$\tan x$$, which cannot be written as a polynomial in $$u$$; indeed, $$\tan^p x = (\sec^2 x - 1)^{p / 2} = (u^2 - 1)^{p / 2}$$. The argument for the other substitution is similar.

Other substitutions will produce rational integrals, however: The tangent half-angle substitution $$x = 2 \arctan t$$, $$dx = \frac{2 \,dt}{1 + t^2}$$ transforms the integral into $$2^{n + 1} \int \frac{(1 + t^2)^{m - 1} t^n dt}{(1 - t^2)^{m + n}} .$$ This integral can in turn be evaluated for particular $$m, n$$ using the Method of Partial Fractions.

Because when $m$ is even"regardless of $n$", we take the benefit of our knowledge that the $\sec^2(x)$ the anti derivative of $\tan(x)$ so we isolate $\sec^2(x)$ and replace the left with $1+\tan^2(x)$ ....... and when $m$ and $n$ are odds we take the benefit of our knowledge that $\sec(x) \tan(x)$ the anti derivative of $\sec(x)$ so we isolate $\sec(x)\tan(x)$ and replace the $\tan^2(x)=\sec^2(x)-1$ ......... now when $m$ is odd and $n$ is even what is the identity or relation that we is able to be used isolating $\sec^2(x)$ has no meaning if we can't replace the rest of the expressions to tan and isolating $\sec(x)\tan(x)$ has no meaning if we can't replace the rest of the expressions to $\sec(x)$ so what is done as you declared you already know we replace $\tan^2(x)=\sec^2(x)-1$ and continue by parts with the $\sec(x)$ ......... I hope I made it clear, Please feed me back if anything doesn't make sense

• This answer needs to be edited to include proper MathJaX formatting, and could also be split into paragraphs to improve readability, but it is nice overall. Welcome to the site. – The Count Feb 18 '17 at 1:33