# Integration of $\sec^4 x$

While practicing for the AP exam, I came across an integral that I found interesting and I attempted to do by hand: $$\int(\sec^4 x)\, dx$$ Eventually I got stuck, but here are the steps I took- $$\int(\sec^4 x) \,dx$$ $$\int(\sec^2 x)(\sec x)(\sec x)\,dx$$ $$\int(\sec^2 x)(\sec x) (\frac{\tan x}{\sin x})\,dx$$ $$\int(\csc x)(\sec^2 x)(\sec x \tan x)\,dx$$ Apply Integration by parts $$(u=\csc x, dv=\sec^2 x(\sec x\tan x)$$ $$\frac{\sec^3 x}{3\sin x} + \int(\frac{\sec^3 x}{3})(\csc x \cot x) \,dx$$ $$\frac{\sec^3 x}{3\sin x} + {1\over 3}\int(\sec^2 x)(\csc^2 x) \,dx$$ Here is where I get stuck.. I appreciate any help you can offer on where to go from here!

$$\frac{d}{dx}\tan x=\sec^2x.$$ Therefore $$\frac{d}{dx}\tan^3 x=3\sec^2x\tan^2x=3\sec^4x-3\sec^2x.$$ So $$\frac{d}{dx}(\tan^3 x+3\tan x)=3\sec^4x.$$

$I=\displaystyle\int\sec^4(x)\,dx$

$I =\displaystyle\int \sec^2(x)(1+\tan^2(x))\,dx$

$u=\tan(x)\implies \sec^2(x)\,dx =\,du$

$I = \displaystyle\int1+u^2\,du$

$I = u+\frac{u^3}3+C$

$I = \tan(x)+\frac{\tan^3(x)}3+C$

As noted here, we can integrate powers of secant with integration by parts, viz. $$\int\sec^{n+2}x\,dx=\sec^n x\tan x-n\int\sec^n x\tan^2 x \, dx = \frac{\sec^n x \tan x+n \int\sec^n x \, dx}{n+1}.$$This recursion allows us to go from $\int\sec^2 x \,dx=\tan x + C$ to $$\int\sec^4 x \,dx = \frac{\sec^2 x \tan x + 2\tan x}{3}+C.$$

• I edited this in order to put a small space before each instance of $dx.$ But I also saw numerous instances of \mathrm{sec}. Using that instead of \sec fails to result in proper spacing in things like $3\sec x,$ where you see instead $3\mathrm{sec} x.$ So I changed those. $\qquad$ May 7, 2018 at 15:39
• @MichaelHardy Thanks. Sorry about sec. I got into a bad habit because, it seems, such a workaround is necessary for the hyperbolic secant.
– J.G.
May 7, 2018 at 16:00
• You should also not use \mathrm{} for the hyperbolic secant either. Instead, write \operatorname{sech}. The difference between \mathrm{sech} and \operatorname{sech} is seen here: \begin{align} \text{3\mathrm{sech}x}: & \qquad 3\mathrm{sech}x \\ \text{3\operatorname{sech}x}: & \qquad 3\operatorname{sech}x \\ \text{3\operatorname{sech}(x)}: & \qquad 3\operatorname{sech}(x) \end{align} You see that proper spacing is not present with \mathrm{} and with \operatorname{} the space to the right and left of $\operatorname{sech}$ depends on the context. May 7, 2018 at 20:06
• @MichaelHardy Thanks for that insight.
– J.G.
May 7, 2018 at 20:57

Your approach is a little long. How about $\sec^4x=(\sec^2x)(\sec^2x)=\sec^2x(\tan^2x+1)=\sec^2x\tan^2x+\sec^2x$. Now you can integrate?

In general: Whenever you have an EVEN power of secant, the idea is to "peel off" one $\sec^2x$ and convert all other $\sec^2x$ terms into $tan^2x+1$ terms. It's a little annoying to work out the parenthesis on $(\tan^2x+1)^n$ but that's just algebra. What is going to happen is that you will end up with tangent terms that all are accompanied with a $\sec^2x$ terms, so they are ready to be integrated with the power rule.

For this problem in particular, I would automatically do what @TheIntegrator did, but in general we can find $$I_n=\int\sec^nx\ dx$$ $$I_n=\int\sec^{n-2}x\sec^2x\ dx$$ $$I_n=\int(\tan^2x+1)^{n-2}\sec^2x\ dx$$ Applying the substitution $$u=\tan x$$ gives $$I_n=\int(u^2+1)^{n-2}du$$ Assuming that $$n\geq2$$ is an even integer, we can expand our integrand into a series using the binomial formula: $$(a+b)^m=\sum_{k=0}^m{m\choose k}a^{m-k}b^k$$ Plugging in $$a=u^2$$, $$b=1$$, and $$m=n-2$$ gives $$I_n=\int\sum_{k=0}^{n-2}{n-2\choose k}(u^2)^{n-k-2}du$$ $$I_n=\int\sum_{k=0}^{n-2}{n-2\choose k}u^{2n-2k-4}du$$ Cleverly interchanging the $$\sum$$ and $$\int$$ signs, $$I_n=\sum_{k=0}^{n-2}{n-2\choose k}\int u^{2n-2k-4}du$$ Integrating $$u^{2n-2k-4}$$ and plugging in gives $$I_n=\sum_{k=0}^{n-2}{n-2\choose k}\frac{u^{2n-2k-3}}{2n-2k-3}$$ $$I_n=\sum_{k=0}^{n-2}{n-2\choose k}\frac{(\tan x)^{2n-2k-3}}{2n-2k-3}+C$$ Keep in mind that this formula only works for positive even values of $$n$$. If you want to know a general formula that works for all $$n$$, I can show you, but it's a bit more involved.

• As I have developed quite significantly in the past couple years, I would not be opposed to seeing the general form \forall n if you are still willing Sep 5, 2020 at 12:08

In fact, this is quasi immediate.

$$\int\sec^4x\,dx=\int(\tan^2x+1)\,d\tan x=\frac13\tan^3x+\tan x.$$

• thanks for dripping on me as a high schooler. you inspired me to get an advanced math education Nov 29, 2020 at 7:35
• @MikeH: not being an English native, I cannot fully appreciate the salt in your comment.
– user65203
Nov 29, 2020 at 10:46
• actually no salt, I was (mostly) genuine! I just thought it was funny looking back. “dripping on me” in this case means elegantly solving it in a way completely over my head :) Nov 29, 2020 at 19:45
• @MikeH: thanks for the explanation.
– user65203
Nov 30, 2020 at 7:29