A worked solution of the integral has been provided as an answer to a previous question.

But I am still unclear why I get the wrong answer from the following method which uses a formula for the definite integral provided by Wolfram Alpha.

Wolfram Alpha indicates the following solution formula:-

$$ \int_0^{2\pi} \frac{\sin x}{1 + A \sin x} dx = (1/A)\left( x - \frac{2 \tan^{-1} \left( \frac{A + \tan{(x/2)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} + constant\right)^{2\pi}_0 $$

My thinking is that substituting for $x$ by $2 \pi$ and by $0$ leads to the corresponding values of $\tan(x/2)$ being the same, namely $\tan(\pi) = \tan(0) = 0$. It follows therefore that the fractional term:- $$ \frac{2 \tan^{-1} \left( \frac{A + \tan{(x/2)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} $$ has the same value ( let us call it $Q$ ) for $x=2\pi$ and $x=0.$ Therefore the definite integral becomes

$$ \int_0^{2\pi} \frac{\sin x}{1 + A \sin x} dx = (1/A)\left( (2\pi - Q + constant) - (0 - Q + constant) \right) = 2\pi/A. $$

For $A = 0.2$ we derive the result $$ \int_0^{2\pi} \frac{\sin x}{1 + 0.2 \sin x} dx = 10 \pi. $$

However Wolfram Alpha gives the answer as $-0.64782$ (approx.) which is reasonable looking at the graph and agrees with the formula provided in @abel's answer to my previous question.

So what is wrong with my reasoning? I realize that the $\tan$ function is not continuous over the range $0,2\pi$ but I don't know what that implies for the analysis of the definite integral. What rules or tricks should I apply in order to use the Wolfram Alpha formula? Must I always beware the appearance of $\tan()$ functions in integrand formulae?


The main problem is that the Fundamental Theorem of Calculus only applies if the antiderivative you apply it to is continuous. If you graph your antiderivative, you will notice that (whatever the value of $a$), it is discontinuous at $x=\pi$.

To make $$ \arctan{\left( \frac{A+\tan{\frac{1}{2}x}}{\sqrt{1-A^2}} \right)} $$ continuous, you have to add something like $\pi\lfloor x/(2\pi)+1/2 \rfloor $, which cancels out the discontinuity in the arctangent (as $\tan{\frac{1}{2}x}$ tends to $+\infty$ as $x \uparrow \pi$, but $-\infty$ as $x \downarrow \pi$, so the arctangent has a discontinuity as it switches between $-\pi/2$ and $\pi/2$). You will find that when you evaluate the integral using the antiderivative, you do get the correct answer.

  • $\begingroup$ Many thanks, very informative. But I'm not confident about how to proceed. I am thinking that I could evaluate the antiderivative over the range $-\pi/2,\pi/2$ and multiply by two. Is that correct? $\endgroup$ – steveOw Jun 11 '15 at 12:27
  • $\begingroup$ Notice that the integrand is the same on $[\pi,2\pi]$ as on $[-\pi,0]$, so you can change the limits to $[-\pi,\pi]$, where the antiderivative is continuous (provided you take the limits from the right direction), and evaluate it from there. (You can't do what you suggest as the integrand will not behave in the same way on each interval: try it and you should get a different answer.) $\endgroup$ – Chappers Jun 11 '15 at 12:33
  • $\begingroup$ Aha, now I see the error in my thinking. I have developed a detailed answer along the lines you suggest. $\endgroup$ – steveOw Jun 11 '15 at 19:18

Using the guidance provided by Chappers and Hans I have come up with this approach.

The Wolfram Alpha solution is:-

$$ \int_0^{2\pi} \frac{\sin x}{1 + A \sin x} dx = (1/A)\left( x - \frac{2 \tan^{-1} \left( \frac{A + \tan{(x/2)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} + C\right)^{2\pi}_0 $$

The antiderivative (on the RHS of the equation above) cannot be evaluated by plugging in values for the limiting values of $x=0$ and $x=2\pi$ because the $\tan^{-1}$ term in the anti-derivative function is not continuous over the range $0..2\pi$

See this plot.

However the $\tan^{-1}$ term is cyclic with a period of $\pi$. Therefore the definite integral over $0..2\pi$ is the same as the definite integral over any other range of length $2\pi$ or two times the definite integral over any range of length $\pi$. We proceed by selecting one particular range: $-\pi/2..\pi/2$ over which the $\tan^{-1}$ term is continuous. We will need to multiply the expression by two to compensate for the difference in ranges.

Proceeding thus... $$ \int_0^{2\pi} \frac{\sin x}{1 + A \sin x} dx = Q = (2*1/A)\left( x - \frac{2 \tan^{-1} \left( \frac{A + \tan{(x/2)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} + C\right)_{-\pi/2}^{+\pi/2} $$

$$Q = (2/A) \left[ \left( \pi/2- \frac{2 \tan^{-1} \left( \frac{A + \tan{(+\pi/4)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} + C\right) - \left( (-\pi/2) - \frac{2 \tan^{-1} \left( \frac{A + \tan{(-\pi/4)}}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} + C\right) \right] $$

$$Q = (2/A) \left[ \pi - \frac{ 2\tan^{-1} \left( \frac{A + 1}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} + \frac{ 2\tan^{-1} \left( \frac{A -1}{\sqrt{(1-A^2)}}\right)}{\sqrt{(1-A^2)}} \right] $$

$$Q = \frac{2}{A} \left[ \pi + \frac{ 2\tan^{-1} \left( \frac{A - 1}{\sqrt{(1-A^2)}}\right) -2\tan^{-1} \left( \frac{A + 1}{\sqrt{(1-A^2)}}\right) } {\sqrt{(1-A^2)}} \right] $$

It happens that (for $0<A<1$) (tested in Excel, see Note at bottom of answer) $$ \tan^{-1} \left( \frac{A - 1}{\sqrt{(1-A^2)}}\right) -\tan^{-1} \left( \frac{A + 1}{\sqrt{(1-A^2)}}\right) =\tan^{-1} (-\infty) = - \pi/2 $$

and so we get

$$ \int_0^{2\pi} \frac{\sin x}{1 + A \sin x} dx = Q = \frac{2\pi}{A} \left[ 1- \frac{1}{\sqrt{(1-A^2)}} \right] $$

which is the same as the answer derived by @abel in answer to the previous question and for which, with $A=0.2$ we get the result $Q=-0.64782$ (approx.).


Note No proof is provided here for the assertion that ( for $0<A<1$ ) $$ \tan^{-1} \left( \frac{A - 1}{\sqrt{(1-A^2)}}\right) -\tan^{-1} \left( \frac{A + 1}{\sqrt{(1-A^2)}}\right) =\tan^{-1} (-\infty) = - \pi/2 $$ However it can be checked (a) by testing in a spreadsheet such as Excel or (b) using the inverse-tangent addition theorem:- $$ \tan^{-1} x \pm \tan^{-1} y = \tan^{-1} \left( \frac{x \pm y}{1 \mp xy} \right). $$

  • $\begingroup$ Hang on, $\arctan{\left( \frac{A \pm 1}{\sqrt{1-A^2}} \right)} = \pm \frac{\pi}{2} $ is false. What you need to do is add the arctangents, which can be done by taking the tangent, using the sum formula and then working out how many multiples of $\pi$ you need to add. $\endgroup$ – Chappers Jun 11 '15 at 20:20
  • $\begingroup$ @Chappers, Oh yes, I see, my bad, I got muddled in Excel. I have (hopefully) now resolved it using the correct period for the $\tan$ function. $\endgroup$ – steveOw Jun 12 '15 at 16:05

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.