Derive the formula \[\bbox[5px, border:1px solid black, #F9F7ED]{ \int \sec ^{n} x\,dx=\dfrac{\sec ^{n-2}x\,\tan \,x}{n-1} +\dfrac{n-2}{n-1}\int \sec ^{n-2} x\,dx\qquad n \geq 3}\tag{4} \]
This choice makes \(\int dv\) easy to integrate. Then \[ \begin{eqnarray*} du&=&[ (n-2)\sec ^{n-3}x\cdot \sec x\,\tan x] \,dx =[ (n-2)\sec ^{n-2}x\,\tan x] \,dx \\[6pt] v&=&\int \sec^{2}x\,dx=\tan x \end{eqnarray*} \]
Using integration by parts, we get \[ \begin{equation*} \int \sec ^{n}x\,dx=\sec ^{n-2}x\,\tan x-(n-2)\int \sec ^{n-2}x\,\tan ^{2}x\,dx \end{equation*} \]
To express the integrand on the right in terms of \(\sec x,\) we use the trigonometric identity, \(\tan ^{2}x+1=\sec ^{2}x,\) and replace \(\tan ^{2}x\) by \(\sec ^{2}x-1\), obtaining \[ \begin{eqnarray*} \int \sec ^{n}x\,dx& =&\sec ^{n-2}x\tan x-(n-2)\int \sec ^{n-2}x(\sec^{2}x-1)\,dx \\[4pt] \int \sec ^{n}x\,dx& =& \sec ^{n-2}x\tan x-(n-2)\int \sec ^{n}x\,dx+(n-2)\int \sec ^{n-2}x\,dx \end{eqnarray*} \]
Moving the middle term on the right to the left, we obtain \[ (n-1)\int \sec ^{n}x\,dx=\sec ^{n-2}x\,\tan x+(n-2)\int \sec ^{n-2}x\,dx \]
Finally, divide both sides by \(n-1\): \[ \int \sec ^{n}x\,dx=\frac{\sec ^{n-2}x\tan x}{n-1}+\frac{n-2}{n-1}\int \sec ^{n-2}x\,dx \]