1
$\begingroup$

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.

$\endgroup$
13
  • 1
    $\begingroup$ The antiderivative you have is incorrect because you probably forgot to backsubstitute after your integration was over. $\endgroup$ Commented Jul 22, 2022 at 1:03
  • 1
    $\begingroup$ BTW, quite apart from any thing else: the integrand is always strictly positive. Therefore the integral could not be $0$. $\endgroup$
    – peter a g
    Commented Jul 22, 2022 at 1:08
  • 1
    $\begingroup$ 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. $\endgroup$ Commented Jul 22, 2022 at 1:59
  • 1
    $\begingroup$ 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}. $$ $\endgroup$ Commented Jul 22, 2022 at 2:22
  • 2
    $\begingroup$ 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. $\endgroup$ Commented Jul 22, 2022 at 2:34

2 Answers 2

6
$\begingroup$

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!

$\endgroup$
2
  • $\begingroup$ I just found this interesting article talking about the method you used. A DISCUSSION ON THE SUBSTITUTION METHOD FOR TRIGONOMETRIC RATIONAL FUNCTIONS: proquest.com/scholarly-journals/… $\endgroup$ Commented Jul 25, 2022 at 1:35
  • $\begingroup$ 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. $\endgroup$ Commented Jul 25, 2022 at 1:39
3
$\begingroup$

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

$\endgroup$
2
  • 1
    $\begingroup$ 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. $\endgroup$ Commented Jul 22, 2022 at 1:51
  • $\begingroup$ 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. $\endgroup$
    – David
    Commented Jul 22, 2022 at 2:28

Not the answer you're looking for? Browse other questions tagged .