1

I was trying to compute this integral $$\int_0^{2\pi} \frac{1}{5+3 \cos x} dx$$ using the substitution method $t = \tan \frac{x}{2}$ suggested in Michael Spivak's book: Calculus 3rd ed., pages 382-383. So I got the antiderivative $$\int \frac{1}{5+3 \cos x} dx = \frac{1}{2} \arctan \left(\frac{1}{2}\tan \frac{x}{2}\right)+ C$$ and then using the Fundamental Theorem of Calculus I get $$\int_0^{2\pi} \frac{1}{5+3 \cos x} dx = \frac{1}{2} \arctan \left(\frac{1}{2}\tan \frac{x}{2}\right)\Big|_0^{2\pi} = 0.$$ However, when I was checking my work in WolframAlpha I get this result: enter image description here

The area under the curve and the calculation from WolframAlpha makes sense to me.

One thing I noticed is that my antiderivative is not well defined everywhere, so maybe that is the reason why it does not work. But not sure :(

Update: Some members have suggested this answer: Find $\int_0^{2\pi} \frac{1}{4-5\cos x}dx$. Although it answers some of my questions, I was wondering if it is possible to compute an antiderivative defined on $\mathbb R$ that actually works without using complex analysis. :(

Can we compute the integral using an antiderivative defined on $\mathbb R$?

Edit 1: I fixed the value of the antiderivate I got.

Edit 2: Updated my question.

Edit 3: Updated my question again.

  • 1
    The antiderivative you have is incorrect because you probably forgot to backsubstitute after your integration was over. – Ninad Munshi Jul 22 '22 at 01:03
  • 1
    BTW, quite apart from any thing else: the integrand is always strictly positive. Therefore the integral could not be $0$. – peter a g Jul 22 '22 at 01:08
  • I corrected my antiderivate. Sorry. – learningmaths Jul 22 '22 at 01:10
  • https://math.stackexchange.com/questions/1942983/find-int-02-pi-frac15-4-cos-x-dx?rq=1 –  Jul 22 '22 at 01:17
  • arctan will jump by $\pi$ when you go through infinity. You need to add $\pi$ on one side to make arctan continuous there – Empy2 Jul 22 '22 at 01:19
  • 1
    First, I believe that $$\frac{\mathrm{d}}{\mathrm{d}x}\left[\frac{1}{2}\arctan\left(2\tan\frac{x}{2}\right)\right]=\frac{1}{5-3\cos x}.$$ WolframAlpha gives the correct antiderivative. Next, as pointed by other answers (in the linked post and in this very post) that the issue with this type of antiderivative is that they work only over each interval where $\cot(x/2)$ is well-defined and continuous. Lastly, you have to patch together different antiderivatives (corresponding to different choice of "constant" of integration) to give one that works on a larger interval. – Sangchul Lee Jul 22 '22 at 01:59
  • 1
    A more delicate method shows that even an analytic solution that is valid on all of $\mathbb{R}$ is available: $$\int\frac{1}{5+3\cos x} , \mathrm{d}x = \frac{x}{4} - \frac{1}{2}\arctan\left(\frac{\sin x}{3+\cos x}\right) + \mathsf{C}. $$ – Sangchul Lee Jul 22 '22 at 02:22
  • Wow! how do you get that? – learningmaths Jul 22 '22 at 02:25
  • 2
    The derivation of this formula needs more consideration than merely computing the definite integral asked. (For example, the term $\frac{x}{4}$ already entails the fact that the average of the $\frac{1}{5+3\cos x}$ is $\frac{1}{4}$, which then yields $\int_{0}^{2\pi}\frac{\mathrm{d}x}{5+3\cos x}=2\pi \cdot \frac{1}{4}=\frac{\pi}{2}$.) The method I know makes use of the following Fourier series $$\frac{1}{5+3\cos x}=\frac{1}{4}+\frac{1}{2}\sum_{n=1}^{\infty}\frac{\cos(nx)}{3^n},$$ which itself can be obtained algebraically by using $\cos x=(e^{ix}+e^{-ix})/2$ and the geometric series formula. – Sangchul Lee Jul 22 '22 at 02:34
  • Two of the three answers in the duplicate did not use complex analysis, and one of the two find explicitly the antiderivative. – Arctic Char Jul 22 '22 at 06:53
  • ok. I will delete my question – learningmaths Jul 22 '22 at 08:54
  • oh, it seems now that I cannot delete my question because other people have actually invested some time to answer it. – learningmaths Jul 22 '22 at 09:17
  • You could make a request here: https://math.meta.stackexchange.com/q/34447 –  Jul 25 '22 at 21:05

2 Answers2

6

So with that Weierstrass substitution we have

$$\newcommand{\II}{\mathcal{I}} \newcommand{\dd}{\mathrm{d}} \mathcal{I} := \int_0^{2\pi} \frac{1}{5+ 3 \cos x} \, \dd x = \int_?^? \frac{1}{5+3(1-t^2)/(1+t^2)} \frac{2 \, \dd t}{1+t^2} = \int_?^? \frac{1}{t^2 + 4} \, \dd t$$

Question: what should these bounds be? I left them out for a reason.

Recall that $\tan(\pi/2)$ is undefined, since $\cos(\pi/2)=0$. So in reality, we actually have to handle two integrals here, by splitting the original at $x=\pi$. Then we get

$$\II = \int_0^\infty \frac{1}{t^2 + 4} \, \dd t + \int_{-\infty}^0 \frac{1}{t^2 + 4} \, \dd t = \int_{-\infty}^\infty \frac{1}{t^2 + 4} \, \dd t $$

Clearly, the antiderivative is

$$\frac 1 2 \arctan \frac t 2$$

(up to a constant). Taking $t \to \pm \infty$ will give $\pm \pi/4$, so the fundamental theorem returns $\pi/2$ as intended.


I think this overlooking of how the bounds change and where the substitution may be undefined is causing the issue here. You can't just get to that final integral and swap back to the $(0,2\pi)$ viewpoint: the substitution is, in some sense, stretching both the function in the integrand and the bounds as well, so the bounds have to switch with you whenever you swap the variables.

This is why, while in theory, you can just find an antiderivative and then apply the fundamental theorem with a back-substitution into your original variable to use its bounds, in practice it's usually better to keep track of the way the boundaries change along the way. Nuances like these get lost.

Another thing of note in this same vein: $t=\tan(x/2)$ sends $0$ and $2\pi$ to the same point, $0$. This is how you can see where you lost information: naively just changing the bounds (ultimately what you did) without considering the intermediate behavior just resulted in an integral of the type $\int_0^0 f(x) \, \dd x$, "obviously" "equal to" zero. However, the values in between those two points got sent, literally, across the entirety of the real line. And integration cares about those points too, after all.

In summary: be careful with how substitutions affect your bounds of integration, and the well-definedness of the substitution on the entire interval. It's not just the endpoints that matter!

PrincessEev
  • 50,606
  • I just found this interesting article talking about the method you used. A DISCUSSION ON THE SUBSTITUTION METHOD FOR TRIGONOMETRIC RATIONAL FUNCTIONS: https://www.proquest.com/scholarly-journals/discussion-on-substitution-method-trigonometric/docview/855630997/se-2?accountid=14723 – learningmaths Jul 25 '22 at 01:35
  • At the end of the paper it is mentioned that there are antiderivatives defined on $\mathbb R$. $\int \frac{1}{a+b\cos x}dx = \frac{1}{\sqrt{a^2-b^2}}\left[x-2\arctan\left(\frac{2b\sin x}{2b \cos x +(\sqrt{a-b}+\sqrt{a+b})^2}\right)\right]+C$ for $a^2>b^2$ real numbers. – learningmaths Jul 25 '22 at 01:39
3

Your first antiderivative is "correct", that isn't (quite) the problem.

When I say "correct" rather than correct, the point is that to speak accurately we should always talk about an antiderivative on a specific interval, see my answer here. And $$\frac{1}{2} \arctan \left(\frac{1}{2}\tan \frac{x}{2}\right)$$ cannot be the antiderivative of anything on the interval $[0,2\pi]$, because it is not defined when $x=\pi$.

One way to get around this is $$\eqalign{\int_0^{2\pi} \frac{1}{5+3 \cos x} dx &=\int_{-\pi}^\pi \frac{1}{5+3\cos x}\,dx\qquad\hbox{(integral over a full period)}\cr &=2\int_0^\pi \frac{1}{5+3\cos x}\,dx\qquad\hbox{(the integrand is even)}\cr &= \arctan \left(\frac{1}{2}\tan \frac{x}{2}\right)\bigg|_0^\pi\cr &=\frac\pi2\ .\cr}$$

David
  • 84,708
  • 9
  • 96
  • 166
  • 1
    That is a cool strategy. Did not think about it! Do you think is possible to find an antiderivative defined on $R$ so we can use it? I noticed some people suggested using complex analysis, but I was wondering if methods from calculus would be enough to get a correct antiderivative. – learningmaths Jul 22 '22 at 01:51
  • The version in your question using $\cot$ works on the open interval $(0,2\pi)$. To do the integral carefully you would have to use limits to cope with the endpoints, but you should find that's not too hard. – David Jul 22 '22 at 02:28