Why and How do certain manipulations in indefinite integrals "just work"?

I am going to take a very simple example to elaborate my question.

When we integrate $\sec (x)\,dx$ we divide and multiply by $\sec (x) + \tan (x)$.

$$\int \sec(x)\,dx = \int \sec (x) \left[{\sec (x) + \tan (x) \over \sec (x) + \tan (x)}\right]\, dx$$

I am just solving from here.

$$\int {\sec^2(x) + \sec(x)\tan(x) \over \sec(x) + \tan(x)} \, dx $$

Then we let $\sec(x) + \tan(x) = u$

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

$$\implies \int {du \over u}$$

$$= \ln{\left|\sec(x) + \tan(x)\right|} + c$$

Now coming to my questions.

  1. Why do we HAVE to make that manipulation of multiplying $\sec(x) + \tan(x)$. Like I know its to get the answer...but why does it work so well?

  2. How to even think like that? Like "if I multiply $\sec(x) + \tan(x)$ in the numerator and denominator then I'll be able to solve this very easily." What in that integral gives one direction to think of such a manipulation ?


Solution 1:

Many otherwise-mysterious tricks in integrals involving trigonometric functions can be explained by expressing the trig functions in terms of exponentials, as in $\cos(x)=(e^{ix}+e^{-ix})/2$. The resulting rational expressions in exponentials can always be integrated...

EDIT: to explain why/how rational expressions on $e^{ix}$ can always be integrated: for example, $$ \int {1\over 1+e^{ix}} \, dx \;=\; -i \int {1\over e^{ix}(1+e^{ix})}\;d(e^{ix}) \;=\; -i \int {1\over t(1+t)}\;dt $$ with $t=e^{ix}$. Then use partial fractions to break this up into easily-computable pieces.

Once I learned this, years ago, I mostly lost interest in the tricks, because equivalents of them can be recovered by using exponentials and complex numbers. No guessing is necessary.

Nevertheless, historically, I'm fully confident that people did just experiment endlessly until they found a trick to be able to compute a given indefinite integral, and then that trick was passed on to subsequent generations. In particular, if we do look at it that way, there's no real way that one can "anticipate" the necessary tricks...

Solution 2:

(This answer could perhaps be seen as an expansion of the one given by Steven Stadnicki.)

There are general approaches to "algebraizing" the problem and getting rid of the transcendental functions like $\sec(x)$. One approach is to use complex valued functions as (essentially) explained in the answer by Paul Garrett.

Another approach (which avoids complex numbers) uses the rational parametrisation of the circle obtained by "projecting" a point $(\cos x, \sin x)$ from the circle from the point $(-1,0)$ to point $(0,t)$ on the vertical axis. We easily check that $t=\tan(x/2)$ using the included angle theorem in high school geometry. This gives the identities: $$ \begin{align*} \cos(x) &= \frac{1-t^2}{1+t^2} \\ \sin(x) &= \frac{2t}{1+t^2} \\ \end{align*} $$ So $x=2\tan^{-1}(t)$ where $t$ lies in $(-\infty,\infty)$.

Note that $dx=\frac{2~dt}{1+t^2}$.

All trigonometric functions can be written as rational functions of $t$, so can integrals. For example, $$ \int \sec(x) dx = \int \frac{1+t^2}{1-t^2}\frac{2dt}{1+t^2} = \int \frac{2}{1-t^2} dt $$ which can be integrated using partial fractions. $$ \int \frac{2}{1-t^2} dt = \int \left(\frac{1}{1+t} + \frac{1}{1-t}\right)dt = \log(1+t) - \log(1-t) + c $$ Substituting $t$ in terms of $x$ gives the answer.

Edit: TIL, thanks to Steve Stadnicki's answer, that this is known as the Weierstrass substitution and was known (at least) to Euler; which is not surprising since it leads to the formulation of the arc length of an ellipse in terms of elliptic integrals.

Solution 3:

You don’t have to do it that way, but it’s still a nice way to go about it, as you get something like $\int \frac{f’(x)}{f(x)} \, dx$. A more natural way, maybe, is the following (although the idea is the same)

$$\int \frac{dx}{\cos x} \\ =\int \frac{\cos x}{\cos^2 x} \, dx \\ = \int \frac{\cos x}{1-\sin^2x} \,dx $$ Let $\sin x = t \implies \cos x \ dx = dt$: $$=\int \frac{dt}{1-t^2} \\ =\frac 12 \ln \left | \frac{t+1}{t-1} \right | + C \\ = \frac 12 \ln\left | \frac{1+\sin x}{1-\sin x} \right | + C$$