While looking at the solution
$$\int\sec^3x\,dx \,=\, \frac 12\ln|\sec x + \tan x|\,+\,\frac 12 \sec x \tan x+C\,,$$ from integration by parts, I see that $\frac d{dx}\sec x$ is formed by both $u=\sec x$ and $v=\tan x$ when we let $\int\sec^3x\,dx=\int u\,dv$ so $$\int\sec^3x\,dx \,=\, \frac 12\left(\int\sec x\,dx\,+\,\frac d{dx}\sec x\right)+C\,.$$
I find that this is a simple way to remember the result from now on (and avoid having to evaluate the integral to convince myself) but I wonder why such a nice result happens with this integral and
is it trivial that the integral of a function raised to some power is equal to a fraction of the sum of its integral and its derivative?
Why does this happen with this particular integral and are there other interesting examples of similar behavior?
Thanks for the input!
Taking the derivative of both sides of $$\int\sec^3(x)\ dx = \frac{1}{2}\left(\int\sec(x)\ dx+\frac{d}{dx}\sec(x) \right)$$ shows that $\sec(x)$ satisfies the differential equation: $$y^3 = \frac{1}{2}(y+y'').$$ Now, we can are in a position to generalize this; we can search for solutions to the differential equation $$y^n=\frac{1}{k}(y+y'')\quad\Leftrightarrow\quad y'' = ky^n-y = f(y)$$ for $k>0$ and $n\in\mathbb{Z}_{\geq 0}$. This is a second order autonomous ODE, and has the following implicit solution: $$K\pm x = \int\frac{1}{\sqrt{\displaystyle C+2\int f(y)\ dy}}\ dy = \int\frac{1}{\sqrt{\frac{2k}{n+1}y^{n+1}-y^2+C}}\ dy$$ for $C$ and $K$ arbitrary constants. In the case where $n=3$, $k=2$, $C=K=0$, and we take positive $x$ on the left we have the solution $$x = \int\frac{1}{\sqrt{y^4-y^2}}\ dy = \int\frac{1}{|y|\sqrt{y^2-1}}\ dy = \operatorname{arcsec}(y)+A$$ and therefore $y=\sec(x-A)$. When $K=0$, the left hand side is $-x$, and $n=3$, $k=2$, and $C=0$, we have $$x = \int\frac{-1}{\sqrt{y^4-y^2}}\ dy = \int\frac{-1}{|y|\sqrt{y^2-1}}\ dy = \operatorname{arccsc}(y)+A$$ and so $y=\csc(x-A)$. Taking $f(y) = y-ky^n$ will give you things like David Quinn's second example. Maybe the masters of integration around here will have more to say about integrals of the form: $$\int\frac{1}{\sqrt{\frac{2k}{n+1}y^{n+1}-y^2+C}}\ dy.$$