How do you integrate $int frac{1}{a + cos x} dx$?












11












$begingroup$


How do you integrate $int frac{1}{a + cos x} dx$? Is it solvable by elementary methods? I was trying to do it while incorrectly solving a homework problem but I couldn't find the answer.



Thanks!










share|cite|improve this question









$endgroup$








  • 4




    $begingroup$
    The Weierstrass substitution $u=tan(x/2)$ (Wikipedia) turns it into an integrating a rational function problem.
    $endgroup$
    – André Nicolas
    Apr 20 '12 at 23:22










  • $begingroup$
    Wolfram|Alpha gives a surprisingly complicated antiderivative. If you click on "Show Steps", you can see how it's derived using the Weierstraß substitution that André suggested.
    $endgroup$
    – joriki
    Apr 20 '12 at 23:25












  • $begingroup$
    @joriki: To remove your surprise, see my answer :-)
    $endgroup$
    – Aryabhata
    Apr 20 '12 at 23:42










  • $begingroup$
    @Aryabhata: I'm not sure why that should lessen my surprise :-) I can see that it's complicated, either from your answer or from Wolfram|Alpha's; what I meant was that I wouldn't have expected it to be that complicated just from the integrand, which seems relatively tame at first sight.
    $endgroup$
    – joriki
    Apr 20 '12 at 23:50










  • $begingroup$
    @joriki: I see, I should have chosen the word 'lessen' instead of 'remove' :-)
    $endgroup$
    – Aryabhata
    Apr 20 '12 at 23:52
















11












$begingroup$


How do you integrate $int frac{1}{a + cos x} dx$? Is it solvable by elementary methods? I was trying to do it while incorrectly solving a homework problem but I couldn't find the answer.



Thanks!










share|cite|improve this question









$endgroup$








  • 4




    $begingroup$
    The Weierstrass substitution $u=tan(x/2)$ (Wikipedia) turns it into an integrating a rational function problem.
    $endgroup$
    – André Nicolas
    Apr 20 '12 at 23:22










  • $begingroup$
    Wolfram|Alpha gives a surprisingly complicated antiderivative. If you click on "Show Steps", you can see how it's derived using the Weierstraß substitution that André suggested.
    $endgroup$
    – joriki
    Apr 20 '12 at 23:25












  • $begingroup$
    @joriki: To remove your surprise, see my answer :-)
    $endgroup$
    – Aryabhata
    Apr 20 '12 at 23:42










  • $begingroup$
    @Aryabhata: I'm not sure why that should lessen my surprise :-) I can see that it's complicated, either from your answer or from Wolfram|Alpha's; what I meant was that I wouldn't have expected it to be that complicated just from the integrand, which seems relatively tame at first sight.
    $endgroup$
    – joriki
    Apr 20 '12 at 23:50










  • $begingroup$
    @joriki: I see, I should have chosen the word 'lessen' instead of 'remove' :-)
    $endgroup$
    – Aryabhata
    Apr 20 '12 at 23:52














11












11








11


6



$begingroup$


How do you integrate $int frac{1}{a + cos x} dx$? Is it solvable by elementary methods? I was trying to do it while incorrectly solving a homework problem but I couldn't find the answer.



Thanks!










share|cite|improve this question









$endgroup$




How do you integrate $int frac{1}{a + cos x} dx$? Is it solvable by elementary methods? I was trying to do it while incorrectly solving a homework problem but I couldn't find the answer.



Thanks!







calculus






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Apr 20 '12 at 23:14









badatmathbadatmath

1,93932142




1,93932142








  • 4




    $begingroup$
    The Weierstrass substitution $u=tan(x/2)$ (Wikipedia) turns it into an integrating a rational function problem.
    $endgroup$
    – André Nicolas
    Apr 20 '12 at 23:22










  • $begingroup$
    Wolfram|Alpha gives a surprisingly complicated antiderivative. If you click on "Show Steps", you can see how it's derived using the Weierstraß substitution that André suggested.
    $endgroup$
    – joriki
    Apr 20 '12 at 23:25












  • $begingroup$
    @joriki: To remove your surprise, see my answer :-)
    $endgroup$
    – Aryabhata
    Apr 20 '12 at 23:42










  • $begingroup$
    @Aryabhata: I'm not sure why that should lessen my surprise :-) I can see that it's complicated, either from your answer or from Wolfram|Alpha's; what I meant was that I wouldn't have expected it to be that complicated just from the integrand, which seems relatively tame at first sight.
    $endgroup$
    – joriki
    Apr 20 '12 at 23:50










  • $begingroup$
    @joriki: I see, I should have chosen the word 'lessen' instead of 'remove' :-)
    $endgroup$
    – Aryabhata
    Apr 20 '12 at 23:52














  • 4




    $begingroup$
    The Weierstrass substitution $u=tan(x/2)$ (Wikipedia) turns it into an integrating a rational function problem.
    $endgroup$
    – André Nicolas
    Apr 20 '12 at 23:22










  • $begingroup$
    Wolfram|Alpha gives a surprisingly complicated antiderivative. If you click on "Show Steps", you can see how it's derived using the Weierstraß substitution that André suggested.
    $endgroup$
    – joriki
    Apr 20 '12 at 23:25












  • $begingroup$
    @joriki: To remove your surprise, see my answer :-)
    $endgroup$
    – Aryabhata
    Apr 20 '12 at 23:42










  • $begingroup$
    @Aryabhata: I'm not sure why that should lessen my surprise :-) I can see that it's complicated, either from your answer or from Wolfram|Alpha's; what I meant was that I wouldn't have expected it to be that complicated just from the integrand, which seems relatively tame at first sight.
    $endgroup$
    – joriki
    Apr 20 '12 at 23:50










  • $begingroup$
    @joriki: I see, I should have chosen the word 'lessen' instead of 'remove' :-)
    $endgroup$
    – Aryabhata
    Apr 20 '12 at 23:52








4




4




$begingroup$
The Weierstrass substitution $u=tan(x/2)$ (Wikipedia) turns it into an integrating a rational function problem.
$endgroup$
– André Nicolas
Apr 20 '12 at 23:22




$begingroup$
The Weierstrass substitution $u=tan(x/2)$ (Wikipedia) turns it into an integrating a rational function problem.
$endgroup$
– André Nicolas
Apr 20 '12 at 23:22












$begingroup$
Wolfram|Alpha gives a surprisingly complicated antiderivative. If you click on "Show Steps", you can see how it's derived using the Weierstraß substitution that André suggested.
$endgroup$
– joriki
Apr 20 '12 at 23:25






$begingroup$
Wolfram|Alpha gives a surprisingly complicated antiderivative. If you click on "Show Steps", you can see how it's derived using the Weierstraß substitution that André suggested.
$endgroup$
– joriki
Apr 20 '12 at 23:25














$begingroup$
@joriki: To remove your surprise, see my answer :-)
$endgroup$
– Aryabhata
Apr 20 '12 at 23:42




$begingroup$
@joriki: To remove your surprise, see my answer :-)
$endgroup$
– Aryabhata
Apr 20 '12 at 23:42












$begingroup$
@Aryabhata: I'm not sure why that should lessen my surprise :-) I can see that it's complicated, either from your answer or from Wolfram|Alpha's; what I meant was that I wouldn't have expected it to be that complicated just from the integrand, which seems relatively tame at first sight.
$endgroup$
– joriki
Apr 20 '12 at 23:50




$begingroup$
@Aryabhata: I'm not sure why that should lessen my surprise :-) I can see that it's complicated, either from your answer or from Wolfram|Alpha's; what I meant was that I wouldn't have expected it to be that complicated just from the integrand, which seems relatively tame at first sight.
$endgroup$
– joriki
Apr 20 '12 at 23:50












$begingroup$
@joriki: I see, I should have chosen the word 'lessen' instead of 'remove' :-)
$endgroup$
– Aryabhata
Apr 20 '12 at 23:52




$begingroup$
@joriki: I see, I should have chosen the word 'lessen' instead of 'remove' :-)
$endgroup$
– Aryabhata
Apr 20 '12 at 23:52










5 Answers
5






active

oldest

votes


















14












$begingroup$

Let $ y = frac{x}{2}$.



$$frac{1}{a + cos 2y} = frac{1}{a -1 + 2cos ^2 y} = frac{sec^2 y}{(a-1)sec^2 y + 2} = frac{sec^2 y}{a + 1 + (a-1)tan^2 y} $$



Thus



$$int frac{1}{a + cos x} text{d}x = int frac{2}{a + cos 2y} text{d}y $$



$$ = int frac{ 2sec^2 y}{ a + 1 + (a-1)tan^2 y} text{d} y$$



Now make the subsitution $t = tan y$.



I remember having used the same trick before: Summing the series $ frac{1}{2n+1} + frac{1}{2} cdot frac{1}{2n+3} + cdots text{ad inf}$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Clever! Thanks for the solution :)
    $endgroup$
    – badatmath
    Apr 23 '12 at 4:13



















9












$begingroup$

Generalization:



Let's consider $cos x = frac{1-t^2}{1+t^2}; t = tanfrac{x}{2}; dx=frac{2}{1+t^2} dt.$ Then we get that our integral becomes:



$$J = int frac{2dt}{(a+b)+(a-b) t^2}$$



I. For the case $a>b$, consider $a+b=u^2$ and $a-b=v^2$, and obtain that:
$$J = 2int frac{dt}{u^2+v^2 t^2}=frac{2}{uv} arctanfrac{vt}{u} +C.$$
Turning back to our notation we get:
$$I=frac{2}{sqrt{a^2-b^2}} arctanleft(sqrt{frac{a-b}{a+b}} tanfrac{x}{2} right) + C.$$



II. For the case $a<b$, consider $a+b=u^2$ and $a-b=-v^2$, and obtain that:
$$J = 2int frac{dt}{u^2-v^2 t^2}=frac{1}{uv}lnfrac{u+vt}{u-vt} +C.$$



Turning back again to out initial notation and have that:



$$I=frac{2}{sqrt{b^2-a^2}} lnfrac{b+a cos x + sqrt{b^2-a^2} sin x}{a+b cos x} + C.$$
Also, note that $x$ must be different from ${+}/{-}arccos(-frac{a}{b})+2kpi$ if $|frac{a}{b}|leq1$.



Q.E.D.






share|cite|improve this answer











$endgroup$





















    7












    $begingroup$

    This doesn't help you to evaluate the indefinite integral, but I though I would add that the definite integral $int_0^{2 pi
    } frac{1}{a + cos x} dx$ can also be evaluated using methods from complex analysis. Let us make the simplifying assumption that $a > 1$ to avoid a blow up in the integral. Other values of $a$ (including complex ones!) can be made to work too.



    We have
    begin{align*}
    int_0^{2 pi
    } frac{dx}{a + cos x} &= int_0^{2 pi} frac{dx}{a + frac{e^{ix} + e^{-ix}}{2}} \
    &= 2int_0^{2 pi} frac{e^{ix} dx}{2ae^{ix} + e^{2ix} + 1} && text{Let } z=e^{ix}, text{ so } dz = ie^{ix} dx. \
    &= frac{2}{i} int_{|z|=1} frac{dz}{z^2 + 2az + 1} \
    &= frac{2}{i} int_{|z|=1} frac{dz}{(z-z_1)(z-z_2)}
    end{align*}
    where the circle $|z|=1$ is parametrized counterclockwise and
    begin{align*} z_1 = -a - sqrt{a^2-1} && z_2 = -a + sqrt{a^2-1}.
    end{align*}
    Clearly $z_1 < -a < -1$, so $z_1$ is outside of the unit circle. As for $z_2$, it is convenient to notice that
    begin{align*}
    z_1 z_2 = 1.
    end{align*}
    Thus, since $z_1$ is outside the unit circle, its inverse $z_2$ is inside the unit circle. So, applying the residue theorem, we have



    begin{align*}
    frac{2}{i} int_{|z|=1} frac{dz}{(z-z_1)(z-z_2)}
    &= frac{2}{i} 2 pi i mathrm{Res}left( frac{1}{(z-z_1)(z-z_2)}, z_2right) \
    &= 4 pi frac{1}{z_2 - z_1} \
    &= 4 pi frac{1}{2 sqrt{a^2 -1}} \
    &= frac{2 pi}{sqrt{a^2-1}}.
    end{align*}



    One can check this result against the one obtained from Arybatha's antiderivative, although a bit of care needs to be taken as an improper integral crops up while making the various substitutions.
    begin{align*}
    int_0^{2 pi
    } frac{dx}{a + cos x}
    &= int_0^pi frac{2 dy}{a+1 + (a-1) tan^2(y)} && y= frac{x}{2}\
    &= int_0^infty frac{ 2 dt}{ a + 1 + (a-1)t^2} +int_{-infty}^0 frac{ 2 dt}{ a + 1 + (a-1)t^2} && t = tan(y) \
    &= frac{2}{sqrt{a^2-1}} arctanleft( sqrt{ frac{a-1}{a+1}} t right) big|_0^infty + frac{2}{sqrt{a^2-1}} arctanleft( sqrt{ frac{a-1}{a+1}} t right) big|_{-infty}^0 \
    &= frac{2 pi}{sqrt{a^2-1}}
    end{align*}






    share|cite|improve this answer









    $endgroup$





















      4












      $begingroup$

      Expanding André's comment



      Say we have an integral of the form



      $$int R(sin x,cos x) dx$$



      Then the substitution



      $$t= tanfrac x 2 $$



      will change the integral into a rational function of



      $$sin x = frac{2t}{1+t^2}$$



      $$cos x = frac{1-t^2}{1+t^2}$$



      and of course



      $$dx = frac{2 dt}{1+t^2}$$



      Would you like to try solve it that way or want a full solution?






      share|cite|improve this answer









      $endgroup$





















        0












        $begingroup$

        Also a generalised solution, borrowing from and expanding upon user1357113's answer,



        I. For the case $|a| > |b|$, note that the substitution $t=tan left( frac{x}{2} right)$ is not injective. So to retrieve a continuous antiderivative, we have as a complete answer



        $$
        int frac{1}{a+bcos(x)} {rm d}x
        = frac{2}{sqrt{a^2-b^2}} arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) + frac{2pi}{sqrt{a^2-b^2}} leftlfloor frac{x+pi}{2pi} rightrfloor +C
        $$



        However, we can simplify the ugly floor function in terms of arctangents and tangents. First, we have



        $$
        pi leftlfloor frac{x+pi}{2pi} rightrfloor
        = frac{x}{2} - arctan left( tan left( frac{x}{2} right) right)
        $$



        So, implementing this and then asking What is $arctan(x) + arctan(y)$? We get



        $$
        begin{align}
        int frac{1}{a+bcos(x)} {rm d}x
        & = frac{2}{sqrt{a^2-b^2}} arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) + frac{2}{sqrt{a^2-b^2}} left( frac{x}{2} - arctan left( tan left( frac{x}{2} right) right) right) +C \
        & = frac{1}{sqrt{a^2-b^2}} left( x + 2arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) - 2arctan left( tan left( frac{x}{2} right) right) right) + C \
        & = frac{1}{sqrt{a^2-b^2}} left( x + 2arctan left( frac{ sqrt{frac{a-b}{a+b}}tan left(frac{x}{2}right) - tan left(frac{x}{2}right) }{1 + sqrt{frac{a-b}{a+b}} tan^2 left(frac{x}{2}right) } right) right) + C \
        end{align}
        $$



        Which ultimately simplifies to a satisfying compact




        $$ int frac{1}{a+bcos(x)} {rm d}x
        = frac{1}{sqrt{a^2-b^2}} left( x - 2arctan left( frac{ (sqrt{a+b}-sqrt{a-b})tan left(frac{x}{2}right) }{sqrt{a+b} + sqrt{a-b} tan^2 left(frac{x}{2}right) } right) right) + C
        $$




        II. And for the case $|a|<|b|$, we will have, from user1357113's partial fraction decomposition,




        $$ int frac{1}{a+bcos(x)} {rm d}x
        = frac{1}{sqrt{b^2-a^2}}lnleft(left|frac{b+acosleft(xright)+sqrt{b^2-a^2}sinleft(xright)}{a+bcosleft(xright)}right|right) +C
        $$




        III a. And for the case $a = b$, we will have
        $$
        begin{align}
        int frac{1}{a+bcos(x)} {rm d}x
        & = frac1a int frac{1}{1+cos(x)} {rm d}x \
        & = frac1a int frac{1}{1+2cos^2(frac{x}{2})-1}{rm d}x \
        & = frac1{2a} int sec^2 left(frac{x}{2}right) {rm d}x \
        & = frac1a tanleft(frac{x}{2}right) + C
        end{align}
        $$



        III b. Finally, for the case $a = -b$, we will have
        $$
        begin{align}
        int frac{1}{a+bcos(x)} {rm d}x
        & = frac1a int frac{1}{1-cos(x)} {rm d}x \
        & = frac1a int frac{1}{1 - 1 + 2sin^2(frac{x}{2})}{rm d}x \
        & = frac1{2a} int csc^2 left(frac{x}{2}right) {rm d}x \
        & = frac1b cotleft(frac{x}{2}right) + C
        end{align}
        $$






        share|cite|improve this answer











        $endgroup$














          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f134577%2fhow-do-you-integrate-int-frac1a-cos-x-dx%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          14












          $begingroup$

          Let $ y = frac{x}{2}$.



          $$frac{1}{a + cos 2y} = frac{1}{a -1 + 2cos ^2 y} = frac{sec^2 y}{(a-1)sec^2 y + 2} = frac{sec^2 y}{a + 1 + (a-1)tan^2 y} $$



          Thus



          $$int frac{1}{a + cos x} text{d}x = int frac{2}{a + cos 2y} text{d}y $$



          $$ = int frac{ 2sec^2 y}{ a + 1 + (a-1)tan^2 y} text{d} y$$



          Now make the subsitution $t = tan y$.



          I remember having used the same trick before: Summing the series $ frac{1}{2n+1} + frac{1}{2} cdot frac{1}{2n+3} + cdots text{ad inf}$






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Clever! Thanks for the solution :)
            $endgroup$
            – badatmath
            Apr 23 '12 at 4:13
















          14












          $begingroup$

          Let $ y = frac{x}{2}$.



          $$frac{1}{a + cos 2y} = frac{1}{a -1 + 2cos ^2 y} = frac{sec^2 y}{(a-1)sec^2 y + 2} = frac{sec^2 y}{a + 1 + (a-1)tan^2 y} $$



          Thus



          $$int frac{1}{a + cos x} text{d}x = int frac{2}{a + cos 2y} text{d}y $$



          $$ = int frac{ 2sec^2 y}{ a + 1 + (a-1)tan^2 y} text{d} y$$



          Now make the subsitution $t = tan y$.



          I remember having used the same trick before: Summing the series $ frac{1}{2n+1} + frac{1}{2} cdot frac{1}{2n+3} + cdots text{ad inf}$






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Clever! Thanks for the solution :)
            $endgroup$
            – badatmath
            Apr 23 '12 at 4:13














          14












          14








          14





          $begingroup$

          Let $ y = frac{x}{2}$.



          $$frac{1}{a + cos 2y} = frac{1}{a -1 + 2cos ^2 y} = frac{sec^2 y}{(a-1)sec^2 y + 2} = frac{sec^2 y}{a + 1 + (a-1)tan^2 y} $$



          Thus



          $$int frac{1}{a + cos x} text{d}x = int frac{2}{a + cos 2y} text{d}y $$



          $$ = int frac{ 2sec^2 y}{ a + 1 + (a-1)tan^2 y} text{d} y$$



          Now make the subsitution $t = tan y$.



          I remember having used the same trick before: Summing the series $ frac{1}{2n+1} + frac{1}{2} cdot frac{1}{2n+3} + cdots text{ad inf}$






          share|cite|improve this answer











          $endgroup$



          Let $ y = frac{x}{2}$.



          $$frac{1}{a + cos 2y} = frac{1}{a -1 + 2cos ^2 y} = frac{sec^2 y}{(a-1)sec^2 y + 2} = frac{sec^2 y}{a + 1 + (a-1)tan^2 y} $$



          Thus



          $$int frac{1}{a + cos x} text{d}x = int frac{2}{a + cos 2y} text{d}y $$



          $$ = int frac{ 2sec^2 y}{ a + 1 + (a-1)tan^2 y} text{d} y$$



          Now make the subsitution $t = tan y$.



          I remember having used the same trick before: Summing the series $ frac{1}{2n+1} + frac{1}{2} cdot frac{1}{2n+3} + cdots text{ad inf}$







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Apr 13 '17 at 12:21









          Community

          1




          1










          answered Apr 20 '12 at 23:41









          AryabhataAryabhata

          70.2k6157247




          70.2k6157247












          • $begingroup$
            Clever! Thanks for the solution :)
            $endgroup$
            – badatmath
            Apr 23 '12 at 4:13


















          • $begingroup$
            Clever! Thanks for the solution :)
            $endgroup$
            – badatmath
            Apr 23 '12 at 4:13
















          $begingroup$
          Clever! Thanks for the solution :)
          $endgroup$
          – badatmath
          Apr 23 '12 at 4:13




          $begingroup$
          Clever! Thanks for the solution :)
          $endgroup$
          – badatmath
          Apr 23 '12 at 4:13











          9












          $begingroup$

          Generalization:



          Let's consider $cos x = frac{1-t^2}{1+t^2}; t = tanfrac{x}{2}; dx=frac{2}{1+t^2} dt.$ Then we get that our integral becomes:



          $$J = int frac{2dt}{(a+b)+(a-b) t^2}$$



          I. For the case $a>b$, consider $a+b=u^2$ and $a-b=v^2$, and obtain that:
          $$J = 2int frac{dt}{u^2+v^2 t^2}=frac{2}{uv} arctanfrac{vt}{u} +C.$$
          Turning back to our notation we get:
          $$I=frac{2}{sqrt{a^2-b^2}} arctanleft(sqrt{frac{a-b}{a+b}} tanfrac{x}{2} right) + C.$$



          II. For the case $a<b$, consider $a+b=u^2$ and $a-b=-v^2$, and obtain that:
          $$J = 2int frac{dt}{u^2-v^2 t^2}=frac{1}{uv}lnfrac{u+vt}{u-vt} +C.$$



          Turning back again to out initial notation and have that:



          $$I=frac{2}{sqrt{b^2-a^2}} lnfrac{b+a cos x + sqrt{b^2-a^2} sin x}{a+b cos x} + C.$$
          Also, note that $x$ must be different from ${+}/{-}arccos(-frac{a}{b})+2kpi$ if $|frac{a}{b}|leq1$.



          Q.E.D.






          share|cite|improve this answer











          $endgroup$


















            9












            $begingroup$

            Generalization:



            Let's consider $cos x = frac{1-t^2}{1+t^2}; t = tanfrac{x}{2}; dx=frac{2}{1+t^2} dt.$ Then we get that our integral becomes:



            $$J = int frac{2dt}{(a+b)+(a-b) t^2}$$



            I. For the case $a>b$, consider $a+b=u^2$ and $a-b=v^2$, and obtain that:
            $$J = 2int frac{dt}{u^2+v^2 t^2}=frac{2}{uv} arctanfrac{vt}{u} +C.$$
            Turning back to our notation we get:
            $$I=frac{2}{sqrt{a^2-b^2}} arctanleft(sqrt{frac{a-b}{a+b}} tanfrac{x}{2} right) + C.$$



            II. For the case $a<b$, consider $a+b=u^2$ and $a-b=-v^2$, and obtain that:
            $$J = 2int frac{dt}{u^2-v^2 t^2}=frac{1}{uv}lnfrac{u+vt}{u-vt} +C.$$



            Turning back again to out initial notation and have that:



            $$I=frac{2}{sqrt{b^2-a^2}} lnfrac{b+a cos x + sqrt{b^2-a^2} sin x}{a+b cos x} + C.$$
            Also, note that $x$ must be different from ${+}/{-}arccos(-frac{a}{b})+2kpi$ if $|frac{a}{b}|leq1$.



            Q.E.D.






            share|cite|improve this answer











            $endgroup$
















              9












              9








              9





              $begingroup$

              Generalization:



              Let's consider $cos x = frac{1-t^2}{1+t^2}; t = tanfrac{x}{2}; dx=frac{2}{1+t^2} dt.$ Then we get that our integral becomes:



              $$J = int frac{2dt}{(a+b)+(a-b) t^2}$$



              I. For the case $a>b$, consider $a+b=u^2$ and $a-b=v^2$, and obtain that:
              $$J = 2int frac{dt}{u^2+v^2 t^2}=frac{2}{uv} arctanfrac{vt}{u} +C.$$
              Turning back to our notation we get:
              $$I=frac{2}{sqrt{a^2-b^2}} arctanleft(sqrt{frac{a-b}{a+b}} tanfrac{x}{2} right) + C.$$



              II. For the case $a<b$, consider $a+b=u^2$ and $a-b=-v^2$, and obtain that:
              $$J = 2int frac{dt}{u^2-v^2 t^2}=frac{1}{uv}lnfrac{u+vt}{u-vt} +C.$$



              Turning back again to out initial notation and have that:



              $$I=frac{2}{sqrt{b^2-a^2}} lnfrac{b+a cos x + sqrt{b^2-a^2} sin x}{a+b cos x} + C.$$
              Also, note that $x$ must be different from ${+}/{-}arccos(-frac{a}{b})+2kpi$ if $|frac{a}{b}|leq1$.



              Q.E.D.






              share|cite|improve this answer











              $endgroup$



              Generalization:



              Let's consider $cos x = frac{1-t^2}{1+t^2}; t = tanfrac{x}{2}; dx=frac{2}{1+t^2} dt.$ Then we get that our integral becomes:



              $$J = int frac{2dt}{(a+b)+(a-b) t^2}$$



              I. For the case $a>b$, consider $a+b=u^2$ and $a-b=v^2$, and obtain that:
              $$J = 2int frac{dt}{u^2+v^2 t^2}=frac{2}{uv} arctanfrac{vt}{u} +C.$$
              Turning back to our notation we get:
              $$I=frac{2}{sqrt{a^2-b^2}} arctanleft(sqrt{frac{a-b}{a+b}} tanfrac{x}{2} right) + C.$$



              II. For the case $a<b$, consider $a+b=u^2$ and $a-b=-v^2$, and obtain that:
              $$J = 2int frac{dt}{u^2-v^2 t^2}=frac{1}{uv}lnfrac{u+vt}{u-vt} +C.$$



              Turning back again to out initial notation and have that:



              $$I=frac{2}{sqrt{b^2-a^2}} lnfrac{b+a cos x + sqrt{b^2-a^2} sin x}{a+b cos x} + C.$$
              Also, note that $x$ must be different from ${+}/{-}arccos(-frac{a}{b})+2kpi$ if $|frac{a}{b}|leq1$.



              Q.E.D.







              share|cite|improve this answer














              share|cite|improve this answer



              share|cite|improve this answer








              edited Jun 19 '12 at 9:01

























              answered Jun 19 '12 at 8:45









              user 1357113user 1357113

              22.5k878227




              22.5k878227























                  7












                  $begingroup$

                  This doesn't help you to evaluate the indefinite integral, but I though I would add that the definite integral $int_0^{2 pi
                  } frac{1}{a + cos x} dx$ can also be evaluated using methods from complex analysis. Let us make the simplifying assumption that $a > 1$ to avoid a blow up in the integral. Other values of $a$ (including complex ones!) can be made to work too.



                  We have
                  begin{align*}
                  int_0^{2 pi
                  } frac{dx}{a + cos x} &= int_0^{2 pi} frac{dx}{a + frac{e^{ix} + e^{-ix}}{2}} \
                  &= 2int_0^{2 pi} frac{e^{ix} dx}{2ae^{ix} + e^{2ix} + 1} && text{Let } z=e^{ix}, text{ so } dz = ie^{ix} dx. \
                  &= frac{2}{i} int_{|z|=1} frac{dz}{z^2 + 2az + 1} \
                  &= frac{2}{i} int_{|z|=1} frac{dz}{(z-z_1)(z-z_2)}
                  end{align*}
                  where the circle $|z|=1$ is parametrized counterclockwise and
                  begin{align*} z_1 = -a - sqrt{a^2-1} && z_2 = -a + sqrt{a^2-1}.
                  end{align*}
                  Clearly $z_1 < -a < -1$, so $z_1$ is outside of the unit circle. As for $z_2$, it is convenient to notice that
                  begin{align*}
                  z_1 z_2 = 1.
                  end{align*}
                  Thus, since $z_1$ is outside the unit circle, its inverse $z_2$ is inside the unit circle. So, applying the residue theorem, we have



                  begin{align*}
                  frac{2}{i} int_{|z|=1} frac{dz}{(z-z_1)(z-z_2)}
                  &= frac{2}{i} 2 pi i mathrm{Res}left( frac{1}{(z-z_1)(z-z_2)}, z_2right) \
                  &= 4 pi frac{1}{z_2 - z_1} \
                  &= 4 pi frac{1}{2 sqrt{a^2 -1}} \
                  &= frac{2 pi}{sqrt{a^2-1}}.
                  end{align*}



                  One can check this result against the one obtained from Arybatha's antiderivative, although a bit of care needs to be taken as an improper integral crops up while making the various substitutions.
                  begin{align*}
                  int_0^{2 pi
                  } frac{dx}{a + cos x}
                  &= int_0^pi frac{2 dy}{a+1 + (a-1) tan^2(y)} && y= frac{x}{2}\
                  &= int_0^infty frac{ 2 dt}{ a + 1 + (a-1)t^2} +int_{-infty}^0 frac{ 2 dt}{ a + 1 + (a-1)t^2} && t = tan(y) \
                  &= frac{2}{sqrt{a^2-1}} arctanleft( sqrt{ frac{a-1}{a+1}} t right) big|_0^infty + frac{2}{sqrt{a^2-1}} arctanleft( sqrt{ frac{a-1}{a+1}} t right) big|_{-infty}^0 \
                  &= frac{2 pi}{sqrt{a^2-1}}
                  end{align*}






                  share|cite|improve this answer









                  $endgroup$


















                    7












                    $begingroup$

                    This doesn't help you to evaluate the indefinite integral, but I though I would add that the definite integral $int_0^{2 pi
                    } frac{1}{a + cos x} dx$ can also be evaluated using methods from complex analysis. Let us make the simplifying assumption that $a > 1$ to avoid a blow up in the integral. Other values of $a$ (including complex ones!) can be made to work too.



                    We have
                    begin{align*}
                    int_0^{2 pi
                    } frac{dx}{a + cos x} &= int_0^{2 pi} frac{dx}{a + frac{e^{ix} + e^{-ix}}{2}} \
                    &= 2int_0^{2 pi} frac{e^{ix} dx}{2ae^{ix} + e^{2ix} + 1} && text{Let } z=e^{ix}, text{ so } dz = ie^{ix} dx. \
                    &= frac{2}{i} int_{|z|=1} frac{dz}{z^2 + 2az + 1} \
                    &= frac{2}{i} int_{|z|=1} frac{dz}{(z-z_1)(z-z_2)}
                    end{align*}
                    where the circle $|z|=1$ is parametrized counterclockwise and
                    begin{align*} z_1 = -a - sqrt{a^2-1} && z_2 = -a + sqrt{a^2-1}.
                    end{align*}
                    Clearly $z_1 < -a < -1$, so $z_1$ is outside of the unit circle. As for $z_2$, it is convenient to notice that
                    begin{align*}
                    z_1 z_2 = 1.
                    end{align*}
                    Thus, since $z_1$ is outside the unit circle, its inverse $z_2$ is inside the unit circle. So, applying the residue theorem, we have



                    begin{align*}
                    frac{2}{i} int_{|z|=1} frac{dz}{(z-z_1)(z-z_2)}
                    &= frac{2}{i} 2 pi i mathrm{Res}left( frac{1}{(z-z_1)(z-z_2)}, z_2right) \
                    &= 4 pi frac{1}{z_2 - z_1} \
                    &= 4 pi frac{1}{2 sqrt{a^2 -1}} \
                    &= frac{2 pi}{sqrt{a^2-1}}.
                    end{align*}



                    One can check this result against the one obtained from Arybatha's antiderivative, although a bit of care needs to be taken as an improper integral crops up while making the various substitutions.
                    begin{align*}
                    int_0^{2 pi
                    } frac{dx}{a + cos x}
                    &= int_0^pi frac{2 dy}{a+1 + (a-1) tan^2(y)} && y= frac{x}{2}\
                    &= int_0^infty frac{ 2 dt}{ a + 1 + (a-1)t^2} +int_{-infty}^0 frac{ 2 dt}{ a + 1 + (a-1)t^2} && t = tan(y) \
                    &= frac{2}{sqrt{a^2-1}} arctanleft( sqrt{ frac{a-1}{a+1}} t right) big|_0^infty + frac{2}{sqrt{a^2-1}} arctanleft( sqrt{ frac{a-1}{a+1}} t right) big|_{-infty}^0 \
                    &= frac{2 pi}{sqrt{a^2-1}}
                    end{align*}






                    share|cite|improve this answer









                    $endgroup$
















                      7












                      7








                      7





                      $begingroup$

                      This doesn't help you to evaluate the indefinite integral, but I though I would add that the definite integral $int_0^{2 pi
                      } frac{1}{a + cos x} dx$ can also be evaluated using methods from complex analysis. Let us make the simplifying assumption that $a > 1$ to avoid a blow up in the integral. Other values of $a$ (including complex ones!) can be made to work too.



                      We have
                      begin{align*}
                      int_0^{2 pi
                      } frac{dx}{a + cos x} &= int_0^{2 pi} frac{dx}{a + frac{e^{ix} + e^{-ix}}{2}} \
                      &= 2int_0^{2 pi} frac{e^{ix} dx}{2ae^{ix} + e^{2ix} + 1} && text{Let } z=e^{ix}, text{ so } dz = ie^{ix} dx. \
                      &= frac{2}{i} int_{|z|=1} frac{dz}{z^2 + 2az + 1} \
                      &= frac{2}{i} int_{|z|=1} frac{dz}{(z-z_1)(z-z_2)}
                      end{align*}
                      where the circle $|z|=1$ is parametrized counterclockwise and
                      begin{align*} z_1 = -a - sqrt{a^2-1} && z_2 = -a + sqrt{a^2-1}.
                      end{align*}
                      Clearly $z_1 < -a < -1$, so $z_1$ is outside of the unit circle. As for $z_2$, it is convenient to notice that
                      begin{align*}
                      z_1 z_2 = 1.
                      end{align*}
                      Thus, since $z_1$ is outside the unit circle, its inverse $z_2$ is inside the unit circle. So, applying the residue theorem, we have



                      begin{align*}
                      frac{2}{i} int_{|z|=1} frac{dz}{(z-z_1)(z-z_2)}
                      &= frac{2}{i} 2 pi i mathrm{Res}left( frac{1}{(z-z_1)(z-z_2)}, z_2right) \
                      &= 4 pi frac{1}{z_2 - z_1} \
                      &= 4 pi frac{1}{2 sqrt{a^2 -1}} \
                      &= frac{2 pi}{sqrt{a^2-1}}.
                      end{align*}



                      One can check this result against the one obtained from Arybatha's antiderivative, although a bit of care needs to be taken as an improper integral crops up while making the various substitutions.
                      begin{align*}
                      int_0^{2 pi
                      } frac{dx}{a + cos x}
                      &= int_0^pi frac{2 dy}{a+1 + (a-1) tan^2(y)} && y= frac{x}{2}\
                      &= int_0^infty frac{ 2 dt}{ a + 1 + (a-1)t^2} +int_{-infty}^0 frac{ 2 dt}{ a + 1 + (a-1)t^2} && t = tan(y) \
                      &= frac{2}{sqrt{a^2-1}} arctanleft( sqrt{ frac{a-1}{a+1}} t right) big|_0^infty + frac{2}{sqrt{a^2-1}} arctanleft( sqrt{ frac{a-1}{a+1}} t right) big|_{-infty}^0 \
                      &= frac{2 pi}{sqrt{a^2-1}}
                      end{align*}






                      share|cite|improve this answer









                      $endgroup$



                      This doesn't help you to evaluate the indefinite integral, but I though I would add that the definite integral $int_0^{2 pi
                      } frac{1}{a + cos x} dx$ can also be evaluated using methods from complex analysis. Let us make the simplifying assumption that $a > 1$ to avoid a blow up in the integral. Other values of $a$ (including complex ones!) can be made to work too.



                      We have
                      begin{align*}
                      int_0^{2 pi
                      } frac{dx}{a + cos x} &= int_0^{2 pi} frac{dx}{a + frac{e^{ix} + e^{-ix}}{2}} \
                      &= 2int_0^{2 pi} frac{e^{ix} dx}{2ae^{ix} + e^{2ix} + 1} && text{Let } z=e^{ix}, text{ so } dz = ie^{ix} dx. \
                      &= frac{2}{i} int_{|z|=1} frac{dz}{z^2 + 2az + 1} \
                      &= frac{2}{i} int_{|z|=1} frac{dz}{(z-z_1)(z-z_2)}
                      end{align*}
                      where the circle $|z|=1$ is parametrized counterclockwise and
                      begin{align*} z_1 = -a - sqrt{a^2-1} && z_2 = -a + sqrt{a^2-1}.
                      end{align*}
                      Clearly $z_1 < -a < -1$, so $z_1$ is outside of the unit circle. As for $z_2$, it is convenient to notice that
                      begin{align*}
                      z_1 z_2 = 1.
                      end{align*}
                      Thus, since $z_1$ is outside the unit circle, its inverse $z_2$ is inside the unit circle. So, applying the residue theorem, we have



                      begin{align*}
                      frac{2}{i} int_{|z|=1} frac{dz}{(z-z_1)(z-z_2)}
                      &= frac{2}{i} 2 pi i mathrm{Res}left( frac{1}{(z-z_1)(z-z_2)}, z_2right) \
                      &= 4 pi frac{1}{z_2 - z_1} \
                      &= 4 pi frac{1}{2 sqrt{a^2 -1}} \
                      &= frac{2 pi}{sqrt{a^2-1}}.
                      end{align*}



                      One can check this result against the one obtained from Arybatha's antiderivative, although a bit of care needs to be taken as an improper integral crops up while making the various substitutions.
                      begin{align*}
                      int_0^{2 pi
                      } frac{dx}{a + cos x}
                      &= int_0^pi frac{2 dy}{a+1 + (a-1) tan^2(y)} && y= frac{x}{2}\
                      &= int_0^infty frac{ 2 dt}{ a + 1 + (a-1)t^2} +int_{-infty}^0 frac{ 2 dt}{ a + 1 + (a-1)t^2} && t = tan(y) \
                      &= frac{2}{sqrt{a^2-1}} arctanleft( sqrt{ frac{a-1}{a+1}} t right) big|_0^infty + frac{2}{sqrt{a^2-1}} arctanleft( sqrt{ frac{a-1}{a+1}} t right) big|_{-infty}^0 \
                      &= frac{2 pi}{sqrt{a^2-1}}
                      end{align*}







                      share|cite|improve this answer












                      share|cite|improve this answer



                      share|cite|improve this answer










                      answered Jun 6 '15 at 6:01









                      Mike FMike F

                      12.5k23583




                      12.5k23583























                          4












                          $begingroup$

                          Expanding André's comment



                          Say we have an integral of the form



                          $$int R(sin x,cos x) dx$$



                          Then the substitution



                          $$t= tanfrac x 2 $$



                          will change the integral into a rational function of



                          $$sin x = frac{2t}{1+t^2}$$



                          $$cos x = frac{1-t^2}{1+t^2}$$



                          and of course



                          $$dx = frac{2 dt}{1+t^2}$$



                          Would you like to try solve it that way or want a full solution?






                          share|cite|improve this answer









                          $endgroup$


















                            4












                            $begingroup$

                            Expanding André's comment



                            Say we have an integral of the form



                            $$int R(sin x,cos x) dx$$



                            Then the substitution



                            $$t= tanfrac x 2 $$



                            will change the integral into a rational function of



                            $$sin x = frac{2t}{1+t^2}$$



                            $$cos x = frac{1-t^2}{1+t^2}$$



                            and of course



                            $$dx = frac{2 dt}{1+t^2}$$



                            Would you like to try solve it that way or want a full solution?






                            share|cite|improve this answer









                            $endgroup$
















                              4












                              4








                              4





                              $begingroup$

                              Expanding André's comment



                              Say we have an integral of the form



                              $$int R(sin x,cos x) dx$$



                              Then the substitution



                              $$t= tanfrac x 2 $$



                              will change the integral into a rational function of



                              $$sin x = frac{2t}{1+t^2}$$



                              $$cos x = frac{1-t^2}{1+t^2}$$



                              and of course



                              $$dx = frac{2 dt}{1+t^2}$$



                              Would you like to try solve it that way or want a full solution?






                              share|cite|improve this answer









                              $endgroup$



                              Expanding André's comment



                              Say we have an integral of the form



                              $$int R(sin x,cos x) dx$$



                              Then the substitution



                              $$t= tanfrac x 2 $$



                              will change the integral into a rational function of



                              $$sin x = frac{2t}{1+t^2}$$



                              $$cos x = frac{1-t^2}{1+t^2}$$



                              and of course



                              $$dx = frac{2 dt}{1+t^2}$$



                              Would you like to try solve it that way or want a full solution?







                              share|cite|improve this answer












                              share|cite|improve this answer



                              share|cite|improve this answer










                              answered Apr 20 '12 at 23:29









                              Pedro TamaroffPedro Tamaroff

                              97.5k10153297




                              97.5k10153297























                                  0












                                  $begingroup$

                                  Also a generalised solution, borrowing from and expanding upon user1357113's answer,



                                  I. For the case $|a| > |b|$, note that the substitution $t=tan left( frac{x}{2} right)$ is not injective. So to retrieve a continuous antiderivative, we have as a complete answer



                                  $$
                                  int frac{1}{a+bcos(x)} {rm d}x
                                  = frac{2}{sqrt{a^2-b^2}} arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) + frac{2pi}{sqrt{a^2-b^2}} leftlfloor frac{x+pi}{2pi} rightrfloor +C
                                  $$



                                  However, we can simplify the ugly floor function in terms of arctangents and tangents. First, we have



                                  $$
                                  pi leftlfloor frac{x+pi}{2pi} rightrfloor
                                  = frac{x}{2} - arctan left( tan left( frac{x}{2} right) right)
                                  $$



                                  So, implementing this and then asking What is $arctan(x) + arctan(y)$? We get



                                  $$
                                  begin{align}
                                  int frac{1}{a+bcos(x)} {rm d}x
                                  & = frac{2}{sqrt{a^2-b^2}} arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) + frac{2}{sqrt{a^2-b^2}} left( frac{x}{2} - arctan left( tan left( frac{x}{2} right) right) right) +C \
                                  & = frac{1}{sqrt{a^2-b^2}} left( x + 2arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) - 2arctan left( tan left( frac{x}{2} right) right) right) + C \
                                  & = frac{1}{sqrt{a^2-b^2}} left( x + 2arctan left( frac{ sqrt{frac{a-b}{a+b}}tan left(frac{x}{2}right) - tan left(frac{x}{2}right) }{1 + sqrt{frac{a-b}{a+b}} tan^2 left(frac{x}{2}right) } right) right) + C \
                                  end{align}
                                  $$



                                  Which ultimately simplifies to a satisfying compact




                                  $$ int frac{1}{a+bcos(x)} {rm d}x
                                  = frac{1}{sqrt{a^2-b^2}} left( x - 2arctan left( frac{ (sqrt{a+b}-sqrt{a-b})tan left(frac{x}{2}right) }{sqrt{a+b} + sqrt{a-b} tan^2 left(frac{x}{2}right) } right) right) + C
                                  $$




                                  II. And for the case $|a|<|b|$, we will have, from user1357113's partial fraction decomposition,




                                  $$ int frac{1}{a+bcos(x)} {rm d}x
                                  = frac{1}{sqrt{b^2-a^2}}lnleft(left|frac{b+acosleft(xright)+sqrt{b^2-a^2}sinleft(xright)}{a+bcosleft(xright)}right|right) +C
                                  $$




                                  III a. And for the case $a = b$, we will have
                                  $$
                                  begin{align}
                                  int frac{1}{a+bcos(x)} {rm d}x
                                  & = frac1a int frac{1}{1+cos(x)} {rm d}x \
                                  & = frac1a int frac{1}{1+2cos^2(frac{x}{2})-1}{rm d}x \
                                  & = frac1{2a} int sec^2 left(frac{x}{2}right) {rm d}x \
                                  & = frac1a tanleft(frac{x}{2}right) + C
                                  end{align}
                                  $$



                                  III b. Finally, for the case $a = -b$, we will have
                                  $$
                                  begin{align}
                                  int frac{1}{a+bcos(x)} {rm d}x
                                  & = frac1a int frac{1}{1-cos(x)} {rm d}x \
                                  & = frac1a int frac{1}{1 - 1 + 2sin^2(frac{x}{2})}{rm d}x \
                                  & = frac1{2a} int csc^2 left(frac{x}{2}right) {rm d}x \
                                  & = frac1b cotleft(frac{x}{2}right) + C
                                  end{align}
                                  $$






                                  share|cite|improve this answer











                                  $endgroup$


















                                    0












                                    $begingroup$

                                    Also a generalised solution, borrowing from and expanding upon user1357113's answer,



                                    I. For the case $|a| > |b|$, note that the substitution $t=tan left( frac{x}{2} right)$ is not injective. So to retrieve a continuous antiderivative, we have as a complete answer



                                    $$
                                    int frac{1}{a+bcos(x)} {rm d}x
                                    = frac{2}{sqrt{a^2-b^2}} arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) + frac{2pi}{sqrt{a^2-b^2}} leftlfloor frac{x+pi}{2pi} rightrfloor +C
                                    $$



                                    However, we can simplify the ugly floor function in terms of arctangents and tangents. First, we have



                                    $$
                                    pi leftlfloor frac{x+pi}{2pi} rightrfloor
                                    = frac{x}{2} - arctan left( tan left( frac{x}{2} right) right)
                                    $$



                                    So, implementing this and then asking What is $arctan(x) + arctan(y)$? We get



                                    $$
                                    begin{align}
                                    int frac{1}{a+bcos(x)} {rm d}x
                                    & = frac{2}{sqrt{a^2-b^2}} arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) + frac{2}{sqrt{a^2-b^2}} left( frac{x}{2} - arctan left( tan left( frac{x}{2} right) right) right) +C \
                                    & = frac{1}{sqrt{a^2-b^2}} left( x + 2arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) - 2arctan left( tan left( frac{x}{2} right) right) right) + C \
                                    & = frac{1}{sqrt{a^2-b^2}} left( x + 2arctan left( frac{ sqrt{frac{a-b}{a+b}}tan left(frac{x}{2}right) - tan left(frac{x}{2}right) }{1 + sqrt{frac{a-b}{a+b}} tan^2 left(frac{x}{2}right) } right) right) + C \
                                    end{align}
                                    $$



                                    Which ultimately simplifies to a satisfying compact




                                    $$ int frac{1}{a+bcos(x)} {rm d}x
                                    = frac{1}{sqrt{a^2-b^2}} left( x - 2arctan left( frac{ (sqrt{a+b}-sqrt{a-b})tan left(frac{x}{2}right) }{sqrt{a+b} + sqrt{a-b} tan^2 left(frac{x}{2}right) } right) right) + C
                                    $$




                                    II. And for the case $|a|<|b|$, we will have, from user1357113's partial fraction decomposition,




                                    $$ int frac{1}{a+bcos(x)} {rm d}x
                                    = frac{1}{sqrt{b^2-a^2}}lnleft(left|frac{b+acosleft(xright)+sqrt{b^2-a^2}sinleft(xright)}{a+bcosleft(xright)}right|right) +C
                                    $$




                                    III a. And for the case $a = b$, we will have
                                    $$
                                    begin{align}
                                    int frac{1}{a+bcos(x)} {rm d}x
                                    & = frac1a int frac{1}{1+cos(x)} {rm d}x \
                                    & = frac1a int frac{1}{1+2cos^2(frac{x}{2})-1}{rm d}x \
                                    & = frac1{2a} int sec^2 left(frac{x}{2}right) {rm d}x \
                                    & = frac1a tanleft(frac{x}{2}right) + C
                                    end{align}
                                    $$



                                    III b. Finally, for the case $a = -b$, we will have
                                    $$
                                    begin{align}
                                    int frac{1}{a+bcos(x)} {rm d}x
                                    & = frac1a int frac{1}{1-cos(x)} {rm d}x \
                                    & = frac1a int frac{1}{1 - 1 + 2sin^2(frac{x}{2})}{rm d}x \
                                    & = frac1{2a} int csc^2 left(frac{x}{2}right) {rm d}x \
                                    & = frac1b cotleft(frac{x}{2}right) + C
                                    end{align}
                                    $$






                                    share|cite|improve this answer











                                    $endgroup$
















                                      0












                                      0








                                      0





                                      $begingroup$

                                      Also a generalised solution, borrowing from and expanding upon user1357113's answer,



                                      I. For the case $|a| > |b|$, note that the substitution $t=tan left( frac{x}{2} right)$ is not injective. So to retrieve a continuous antiderivative, we have as a complete answer



                                      $$
                                      int frac{1}{a+bcos(x)} {rm d}x
                                      = frac{2}{sqrt{a^2-b^2}} arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) + frac{2pi}{sqrt{a^2-b^2}} leftlfloor frac{x+pi}{2pi} rightrfloor +C
                                      $$



                                      However, we can simplify the ugly floor function in terms of arctangents and tangents. First, we have



                                      $$
                                      pi leftlfloor frac{x+pi}{2pi} rightrfloor
                                      = frac{x}{2} - arctan left( tan left( frac{x}{2} right) right)
                                      $$



                                      So, implementing this and then asking What is $arctan(x) + arctan(y)$? We get



                                      $$
                                      begin{align}
                                      int frac{1}{a+bcos(x)} {rm d}x
                                      & = frac{2}{sqrt{a^2-b^2}} arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) + frac{2}{sqrt{a^2-b^2}} left( frac{x}{2} - arctan left( tan left( frac{x}{2} right) right) right) +C \
                                      & = frac{1}{sqrt{a^2-b^2}} left( x + 2arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) - 2arctan left( tan left( frac{x}{2} right) right) right) + C \
                                      & = frac{1}{sqrt{a^2-b^2}} left( x + 2arctan left( frac{ sqrt{frac{a-b}{a+b}}tan left(frac{x}{2}right) - tan left(frac{x}{2}right) }{1 + sqrt{frac{a-b}{a+b}} tan^2 left(frac{x}{2}right) } right) right) + C \
                                      end{align}
                                      $$



                                      Which ultimately simplifies to a satisfying compact




                                      $$ int frac{1}{a+bcos(x)} {rm d}x
                                      = frac{1}{sqrt{a^2-b^2}} left( x - 2arctan left( frac{ (sqrt{a+b}-sqrt{a-b})tan left(frac{x}{2}right) }{sqrt{a+b} + sqrt{a-b} tan^2 left(frac{x}{2}right) } right) right) + C
                                      $$




                                      II. And for the case $|a|<|b|$, we will have, from user1357113's partial fraction decomposition,




                                      $$ int frac{1}{a+bcos(x)} {rm d}x
                                      = frac{1}{sqrt{b^2-a^2}}lnleft(left|frac{b+acosleft(xright)+sqrt{b^2-a^2}sinleft(xright)}{a+bcosleft(xright)}right|right) +C
                                      $$




                                      III a. And for the case $a = b$, we will have
                                      $$
                                      begin{align}
                                      int frac{1}{a+bcos(x)} {rm d}x
                                      & = frac1a int frac{1}{1+cos(x)} {rm d}x \
                                      & = frac1a int frac{1}{1+2cos^2(frac{x}{2})-1}{rm d}x \
                                      & = frac1{2a} int sec^2 left(frac{x}{2}right) {rm d}x \
                                      & = frac1a tanleft(frac{x}{2}right) + C
                                      end{align}
                                      $$



                                      III b. Finally, for the case $a = -b$, we will have
                                      $$
                                      begin{align}
                                      int frac{1}{a+bcos(x)} {rm d}x
                                      & = frac1a int frac{1}{1-cos(x)} {rm d}x \
                                      & = frac1a int frac{1}{1 - 1 + 2sin^2(frac{x}{2})}{rm d}x \
                                      & = frac1{2a} int csc^2 left(frac{x}{2}right) {rm d}x \
                                      & = frac1b cotleft(frac{x}{2}right) + C
                                      end{align}
                                      $$






                                      share|cite|improve this answer











                                      $endgroup$



                                      Also a generalised solution, borrowing from and expanding upon user1357113's answer,



                                      I. For the case $|a| > |b|$, note that the substitution $t=tan left( frac{x}{2} right)$ is not injective. So to retrieve a continuous antiderivative, we have as a complete answer



                                      $$
                                      int frac{1}{a+bcos(x)} {rm d}x
                                      = frac{2}{sqrt{a^2-b^2}} arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) + frac{2pi}{sqrt{a^2-b^2}} leftlfloor frac{x+pi}{2pi} rightrfloor +C
                                      $$



                                      However, we can simplify the ugly floor function in terms of arctangents and tangents. First, we have



                                      $$
                                      pi leftlfloor frac{x+pi}{2pi} rightrfloor
                                      = frac{x}{2} - arctan left( tan left( frac{x}{2} right) right)
                                      $$



                                      So, implementing this and then asking What is $arctan(x) + arctan(y)$? We get



                                      $$
                                      begin{align}
                                      int frac{1}{a+bcos(x)} {rm d}x
                                      & = frac{2}{sqrt{a^2-b^2}} arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) + frac{2}{sqrt{a^2-b^2}} left( frac{x}{2} - arctan left( tan left( frac{x}{2} right) right) right) +C \
                                      & = frac{1}{sqrt{a^2-b^2}} left( x + 2arctan left( sqrt{frac{a-b}{a+b}}tan left( frac{x}{2} right) right) - 2arctan left( tan left( frac{x}{2} right) right) right) + C \
                                      & = frac{1}{sqrt{a^2-b^2}} left( x + 2arctan left( frac{ sqrt{frac{a-b}{a+b}}tan left(frac{x}{2}right) - tan left(frac{x}{2}right) }{1 + sqrt{frac{a-b}{a+b}} tan^2 left(frac{x}{2}right) } right) right) + C \
                                      end{align}
                                      $$



                                      Which ultimately simplifies to a satisfying compact




                                      $$ int frac{1}{a+bcos(x)} {rm d}x
                                      = frac{1}{sqrt{a^2-b^2}} left( x - 2arctan left( frac{ (sqrt{a+b}-sqrt{a-b})tan left(frac{x}{2}right) }{sqrt{a+b} + sqrt{a-b} tan^2 left(frac{x}{2}right) } right) right) + C
                                      $$




                                      II. And for the case $|a|<|b|$, we will have, from user1357113's partial fraction decomposition,




                                      $$ int frac{1}{a+bcos(x)} {rm d}x
                                      = frac{1}{sqrt{b^2-a^2}}lnleft(left|frac{b+acosleft(xright)+sqrt{b^2-a^2}sinleft(xright)}{a+bcosleft(xright)}right|right) +C
                                      $$




                                      III a. And for the case $a = b$, we will have
                                      $$
                                      begin{align}
                                      int frac{1}{a+bcos(x)} {rm d}x
                                      & = frac1a int frac{1}{1+cos(x)} {rm d}x \
                                      & = frac1a int frac{1}{1+2cos^2(frac{x}{2})-1}{rm d}x \
                                      & = frac1{2a} int sec^2 left(frac{x}{2}right) {rm d}x \
                                      & = frac1a tanleft(frac{x}{2}right) + C
                                      end{align}
                                      $$



                                      III b. Finally, for the case $a = -b$, we will have
                                      $$
                                      begin{align}
                                      int frac{1}{a+bcos(x)} {rm d}x
                                      & = frac1a int frac{1}{1-cos(x)} {rm d}x \
                                      & = frac1a int frac{1}{1 - 1 + 2sin^2(frac{x}{2})}{rm d}x \
                                      & = frac1{2a} int csc^2 left(frac{x}{2}right) {rm d}x \
                                      & = frac1b cotleft(frac{x}{2}right) + C
                                      end{align}
                                      $$







                                      share|cite|improve this answer














                                      share|cite|improve this answer



                                      share|cite|improve this answer








                                      edited Jan 1 at 18:09

























                                      answered Jan 1 at 17:59









                                      MintMint

                                      5311417




                                      5311417






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Mathematics Stack Exchange!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          Use MathJax to format equations. MathJax reference.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f134577%2fhow-do-you-integrate-int-frac1a-cos-x-dx%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Wiesbaden

                                          To store a contact into the json file from server.js file using a class in NodeJS

                                          Marschland