55
$\begingroup$

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 ?

$\endgroup$
12
  • 39
    $\begingroup$ This is unquestionably the most challenging antidifferentiation problem of first-year calculus. It arose in (if I recall correctly) the year 1599 from a problem in cartography, and remained unsolved for many years. If I'm not mistaken, its solution was the first-ever use of partial fractions to find an antiderivative. $\endgroup$ Aug 10, 2021 at 19:58
  • 6
    $\begingroup$ en.wikipedia.org/wiki/Integral_of_the_secant_function $\endgroup$ Aug 10, 2021 at 20:06
  • 8
    $\begingroup$ We're usually shown these tricks as you have been and by doing more and more problems gain the experience to look for similar tricks when solving similar problems. This remains true no matter how far you go in your studies. $\endgroup$
    – John Douma
    Aug 10, 2021 at 20:09
  • 4
    $\begingroup$ "An Application of Geography to Mathematics". by V. Frederick Rickey (Bowling Green State University) and Philip M. Tuchinsky (Ford Motor Co.) This article originally appeared in: Mathematics Magazine May, 1980 academia.edu/23672123/… $\endgroup$ Aug 10, 2021 at 20:12
  • 6
    $\begingroup$ I privately think of the trigonometric identity $$ \tan\theta+\sec\theta=\tan\left( \frac\theta2 + \frac\pi4 \right) $$ as "the cartographers' tangent half-angle formula." I don't know whether anyone else calls it that. $\qquad$ $\endgroup$ Aug 10, 2021 at 20:15

9 Answers 9

92
$\begingroup$

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...

$\endgroup$
13
  • 10
    $\begingroup$ There is a tradition to repeat/learn trig-function methods without mention of complex numbers. In the U.S., when I was a kid, most high-school teachers were not aware of how to use complex numbers and exponentials to express trig functions, in the first place. Second, at that time "calculus" was considered a very advanced topic for high school, and in many schools it was not offered at all. And in those times one could obtain a high-school math-teaching certificate without really knowing calculus. Different times, illustrative of a certain tradition. Some people like trig identities, too, :) $\endgroup$ Aug 10, 2021 at 20:08
  • 1
    $\begingroup$ You may see the book Joseph Edward's Integral calculus, it's more or less a formula book, but you will see many examples of mentioned tricks. @HarshDarji $\endgroup$ Aug 10, 2021 at 20:20
  • 2
    $\begingroup$ Not really a book.. but there is a 'video text book' online, search up Professor Greist, Single variable calculus. He also goes into vector calculus @HarshDarji $\endgroup$ Aug 10, 2021 at 20:24
  • 8
    $\begingroup$ Ah, well! :) In those days, there was no internet, only a library. And mathematics was the least expensive of many activities. Just needing scraps of paper and a pencil. And libraries were one of the few cool, quiet places around... :) Plus, if one accidentally learns a bit of calculus from an encyclopedia, rather than from a gigantic textbook dedicated to convince readers of the ponderousness of the subject, it seems amazingly useful, and not (artificially) difficult. It is a pity that "calculus" in the U.S. has become a primary "filter" for kids in college. It has perverted it... sigh... $\endgroup$ Aug 10, 2021 at 20:30
  • 4
    $\begingroup$ @Buraian, do you mean Professor Ghrist? $\endgroup$
    – J W
    Aug 11, 2021 at 10:08
43
$\begingroup$

(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.

$\endgroup$
6
  • $\begingroup$ Ah, indeed, the fact that the circle is a "genus zero" curve. Very good. The invariance of genus is also a good thing to keep in mind when trying to understand why some specific "algebraic" integrals cannot be converted to integrals of rational functions. :) $\endgroup$ Aug 12, 2021 at 22:21
  • $\begingroup$ This answers how to integrate it, but doesn't really seem to be an answer to the question posed. The question posed is "what would make you think to multiply and divide by $\sec x + \tan x$?" not "how do you integrate $\sec x$ without that step?" $\endgroup$ Aug 13, 2021 at 11:57
  • $\begingroup$ @The_Sympathizer I interpreted the question to mean: "How does one come up with tricks of this kind?" rather than the specific trick. I think that multiplication/division by $\sec x+\tan x$ can perhaps be motivated by re-writing the simplifications of rational functions of $t$ in terms of trigonometric functions of $x$. However, I have not worked this out. $\endgroup$
    – Kapil
    Aug 13, 2021 at 15:00
  • 1
    $\begingroup$ The term "Weierstrass substitution" is a misnomer. This cannot be mentioned in the title of a Wikipedia article because a refereed source is needed to show it is a misnomer. Prof. Fred Rickey of the U.S. Military Academy at West Point searched through Weierstrass's writings looking for this and found that it's not there. But he hasn't published that in a refereed article. $\endgroup$ Dec 25, 2021 at 4:38
  • 1
    $\begingroup$ It's a bit simpler if instead of $t = \tan (x/2),$ which leads to $\cos x = (1-t^2)/(1+t^2)$ and $dx=2\,dt/(1+t^2),$ one uses $t = \tan(\pi/4+x/2),$ which leads to $\sin x= (t^2-1)/(t^2+1)$ and $\cos x = 2t/(t^2+1)$ and $dx = 2\,dt/(t^2+1).$ Then one has $$ \int\sec x\,dx = \int\frac{dt} t = \log|t|+C = \log\left|\tan\left( \frac\pi4+\frac x2 \right) \right|+C = \log\left| \tan x + \sec x \right|+C.$$ $\endgroup$ Dec 25, 2021 at 5:24
26
$\begingroup$

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$$

$\endgroup$
2
  • $\begingroup$ I see. So its about somehow getting $\int {f'(x) \over f(x)}$ and then going ahead. Right? $\endgroup$
    – HarshDarji
    Aug 10, 2021 at 19:54
  • 5
    $\begingroup$ @HarshDarji Not necessarily $\int\frac{f’(x)}{f(x)}$, but something of the form $\int\frac{f’(x)}{p(f(x))}$ where $p(x)$ is a polynomial. $\endgroup$
    – Tavish
    Aug 11, 2021 at 12:19
10
$\begingroup$

I'll answer your second question. It's a great question, and asking it is really important for getting better at solving math problems. In general, with integral questions, I would say that thinking about these kinds of things just comes with experience and seeing a lot of similar problems.

However, in this case, such intuition isn't enough (in my opinion). I think rather that this is one of those things where people tried for a while to find an antiderivative for $\operatorname{sec}(x)$, and someone happened to come up with this after messing around for a while.

(Also, practically speaking, I think that such a question would be too difficult for an exam, if students hadn't already seen the trick.)

$\endgroup$
4
  • $\begingroup$ Is this the only way to solve the integral though? Like is there any other approach? $\endgroup$
    – HarshDarji
    Aug 10, 2021 at 19:50
  • 1
    $\begingroup$ I didn't know another approach, but I'm happy to see that the other answers have provided lots! $\endgroup$
    – Sambo
    Aug 17, 2021 at 1:50
  • 1
    $\begingroup$ After having done quite a bit indefinite integration by now, I reckon this integral doesn't seem that much of a big deal. Tho yeah back when I asked the question, it did smth more like a magic trick XD $\endgroup$
    – HarshDarji
    Sep 12, 2021 at 16:13
  • $\begingroup$ @HarshDarji I dunno, this trick still seems like magic to me! Though it's been neat to see all the other possible ways of getting to the answer. $\endgroup$
    – Sambo
    Sep 13, 2021 at 17:12
10
$\begingroup$

(1) By writing the integral as $$ \int \frac{\sec^2 x + \sec x \tan x}{\tan x + \sec x} \, dx \, , $$ you have (rather miraculously) put it into the form $$ \int \frac{g'(x)}{g(x)} \, dx = \ln|g(x)|+C\, . $$ More generally, $$ \int f'(g(x)) \cdot g'(x) \, dx =f(g(x))+C \, . $$ This is a direct consequence of the chain rule.

(2) I agree with you that this substitution is a "magic-trick", and it would only be obvious to someone who already knows the value of the integral. Here is an approach that I hope you could imagine coming up with yourself (albeit, with a fair amount of trial and error):

$$ \int \sec x \, dx = \int \frac{1}{\cos x } \, dx = \int \frac{\cos x }{\cos^2x} \, dx = \int \frac{\cos x}{1-\sin^2 x} \, dx \, . $$ Make the substitution $u=\sin x$ and use trig identities to simplify .

Again, the idea behind this approach is to write the integral in the form $$ \int f'(g(x)) \cdot g'(x) \, dx \, , $$ here with $g(x)=\sin x$. Making the substitution $u=\sin x$ is just a practical way of applying the chain rule in reverse as described above. For more information, see this post about integration of secant.

$\endgroup$
6
  • $\begingroup$ @HarshDarji: It also helps to understand the theory behind integration by substitution. If you want to learn more about this, I would highly recommend reading Michael Spivak's *Calculus*—in particular, see Chapter 19: integration in elementary terms. $\endgroup$
    – Joe
    Aug 10, 2021 at 20:08
  • 3
    $\begingroup$ @HarshDarji: I'm very glad I could help. In short, integration by substitution works because $$ \int f'(g(x)) \cdot g'(x) \, dx = f(g(x))+C \, . $$ On the other hand, if we make the substitution $u=g(x)$, replacing $f'(g(x))$ with $f'(u)$ and $g'(x) \, dx$ with $du$, we obtain $$ \int f'(u) \, du = f(u)+C=f(g(x))+C \, , $$ which is the same thing. So every time you make a substitution, you are always applying the chain rule in reverse. (Sometimes it is non-obvious that this is what is going on, though.) $\endgroup$
    – Joe
    Aug 10, 2021 at 20:23
  • $\begingroup$ Oh hell. I just answered without reading the other answers...is my answer just an angry version of yours? $\endgroup$
    – BCLC
    Aug 13, 2021 at 4:07
  • 1
    $\begingroup$ @BCLC: I don't mind you keeping your answer. I found it quite amusing :) $\endgroup$
    – Joe
    Aug 13, 2021 at 14:30
  • 1
    $\begingroup$ @BCLC: No problem! $\endgroup$
    – Joe
    Aug 14, 2021 at 10:04
9
$\begingroup$

I will show how Paul Garrett's Method can be used here.

Basics

Lemma 1: $e^{ix} = \cos x + i \sin x$

Proof: you need Taylor series, see my article (albeit not very rigorous)

Lemma 2: $\frac{e^{ix} + e^{-ix} }{2} = \cos x$

Proof: $$ e^{ix} = \cos x + i \sin x$$ $$ e^{-ix} = \cos(-x) + i \sin(-x) = \cos(x) - i \sin x$$ Adding the two equations and halving, we find the required.


Computing the integral:

$$ \int \sec x \,dx = \int \frac{1}{\cos x} \, dx = \int \frac{2 \, dx }{e^{ix} + e^{-ix} } = \int 2\frac{e^{ix} }{e^{2ix} +1} \, dx$$

The last integral calls for a natural substitution of $e^{ix} = t$, then we have a standard polynomial integral which is intuitive to evaluate.

$\endgroup$
3
  • 2
    $\begingroup$ Could I suggest some improvements in LaTeX or MathJax usage in your linked web page? You have this: $$ p(x) = a_o + a_1x + a_2x^2 + a_3x^3..a_mx_m $$ In more standard usage, one writes: $$ p(x) =a_0 + a_1x+a_2x^2 + a_3x^2+\cdots + a_mx^m$$ The dots are not coded as .. nor ... but (in this case) \cdots. If you use instead \ldots you see this: $$ p(x)= a_0 + a_1x+a_2x^2 + a_3x^2+\cdots + a_mx^m $$ If you use ... then instead you see this: $$ p(x)= a_0 + a_1x+a_2x^2 + a_3x^2+... + a_mx^m $$ (with the dots to the left of where they should be. If you use ... in$\,\ldots\qquad$ $\endgroup$ Aug 10, 2021 at 20:44
  • 2
    $\begingroup$ If you use ... rather than \ldots or \cdots or \dots in genuine LaTeX as opposed to MathJax then you get something about like this: $$ p(x) =a_0 + a_1x+a_2x^2 + a_3x^2+\text{...} + a_mx^m $$ which you can contrast with this: $$ p(x) =a_0 + a_1x+a_2x^2 + a_3x^2+... + a_mx^m $$ (Either of these is incorrect according to fastidious usage conventions, whereas $$ p(x) =a_0 + a_1x+a_2x^2 + a_3x^2+\ldots + a_mx^m $$ is not.) $\qquad$ $\endgroup$ Aug 10, 2021 at 20:47
  • $\begingroup$ Thank you @Hardy for the recommendations, I'll save it. The website itself doesn't support latex, so I'll have to render it in another software and upload it as a jpg there. It's a bit of work, but I'll do the improvements as you've suggested. $\endgroup$ Aug 10, 2021 at 20:51
5
$\begingroup$

You don't have to use that trick. There's a much simpler one: $$ \int\frac{1}{\sin t\cos t}\,dt =\int\frac{\cos^2t+\sin^2t}{\sin t\cos t}\,dt =\int\Bigl(\frac{\cos t}{\sin t}+\frac{\sin t}{\cos t}\Bigr)\,dt =\log\lvert\tan t\rvert+c $$ How can you transform $\cos x$ into $a\sin t\cos t$? Easy: set $x=2t-\pi/2$. Et voilà $$ \int\frac{1}{\cos x}\,dx=\int\frac{1}{\sin t\cos t}\,dt=\log\lvert\tan t\rvert+c=\log\Bigl|\tan\Bigl(\frac{x}{2}+\frac{\pi}{4}\Bigr)\Bigr|+c $$ By the way, this also yields, with $x=2t$, $$ \int\frac{1}{\sin x}\,dx=\int\frac{1}{\sin t\cos t}\,dt=\log\Bigl|\tan\frac{x}{2}\Bigr|+c $$

$\endgroup$
5
$\begingroup$

There is a more elementary way to see this — to see why one would do this — that I don't think the other answers have really highlighted.

First of all, one must be familiar with logarithms, and the fact that $\frac{f^\prime}{f}$ is the derivative of $\ln\left|f\right|$.

Next you look at your trig derivatives. The functions $\sin$ and $\cos$ are a pair, and their derivatives are just each other, with a minus sign thrown in when appropriate. Couldn't be simpler! (Well, it could be simpler, if the minus sign weren't a thing, but that behavior is reserved for $\sinh$ and $\cosh$.)

Another nice pair of functions is $\sec$ and $\tan$. What makes them a pair? Well, they both have the same domains, because they have $\cos$ in their denominators. They also live together in a version of the Pythagorean identity: $\tan^2x + 1 = \sec^2x$. So let's look at their derivatives.

We have $\frac{d}{dx}\tan x=\sec^2 x$, and $\frac{d}{dx}\sec x=\sec x\tan x$. Their derivatives aren't exactly "each other", but they are each $\sec x$ times the other function. That means that, because addition is commutative, the derivative of their sum has a nice property: $$\frac{d}{dx}(\sec x+\tan x) = \sec x(\sec x+\tan x)$$ Taking $f(x) = \sec x+\tan x$, we have $$f'(x) = \sec x\cdot f(x)$$ or: $$\frac{f'(x)}{f(x)}=\sec x$$ From here, it's just a matter of putting the pieces together.

$\endgroup$
2
  • $\begingroup$ Yeah, so basically chain rule reversed right? $\endgroup$
    – HarshDarji
    Aug 13, 2021 at 18:43
  • 1
    $\begingroup$ Exactly, also known as integration by substitution $\endgroup$ Aug 13, 2021 at 18:44
3
$\begingroup$

I initially posted this as a comment, but with my master's degree and with my 10,000 rep, I think I will get away with post this as an answer. Actually with my anger at the system but at no particular person, I don't really care.

Part 1: it's easy:

  1. know how to integrate secant a better way.
  2. differentiate and then figure out the trick of the sec + tan thingy
  3. show it to beginning calculus students and wait for stackexchange questions like this to come up.

Part 2: seriously this is a big coincidence discovered by simple differentiation after integrating secant by better methods. Then it's presented to beginning calculus students as an amazing trick. Look at the antiderivative itself. It's $$\ln|\text{something}|.$$

This sets off alarm bells that the since derivative of $\ln |f|$ is $\frac{f'}{f}$ then we'll multiply $\sec$ by $\frac{f}{f}$ with $f = \sec + \tan$. I forgot the details myself (Edit: Ah, see this other answer) but if you think about differentiating the $\ln|\text{something}|$, then I don't think it should be too hard to come up with $\frac{\sec + \tan}{\sec + \tan}$. I suppose we could test out calculus students in highschool as some experiment like if they come up with $\frac{\sec + \tan}{\sec + \tan}$ after you tell them the antiderivative and hint them to differentiate the antiderivative and then maybe hint again to multiply with $\frac{\text{something}}{\text{the same thing}}$. Perhaps do some control group vs treatment group where some students are taught this unrelated thing about integrating $\frac{f'}{f}$

  • Edit: Wait...yeah I remember now! Derivative of $\ln|f|$ is $\frac{f'}{f}$ Soooo we observe that derivative $f'$ of $f=\sec + \tan$ is $f'=\sec(\sec + \tan)$, sooo...yeah I think it's easy if you know already know the antiderivative.

I seriously seriously doubt anyone thought of this one day from scratch. I seriously seriously think someone (oh apparently someone named James Gregory) thought of this after they already integrated secant with partial fractions (oh apparently this has a name: Barrow's approach) or the 'sneakiest substitution': Weierstrass (says michael spivak, the living legend who invented 'e').

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.