I'm having trouble solving:

$$\int \frac{1}{\cos^2(x)+\cos(x)+1}dx$$

Wolfram Alpha gives an answer with imaginary numbers. I am able to get somewhat close to the answer by doing a Weierstrass Substitution, but the partial fraction decomposition because very ugly. I wanted to know if there is an easier way of solving the integral? Or if someone could solve it with the partial fractions.


  • $\begingroup$ Tangent half-angle substitution works fine :/ $\endgroup$ – Phoenix Jan 5 '18 at 2:00
  • $\begingroup$ It does. I'm currently working it out again, but it's just really ugly. (I could very easily be doing something wrong though, which is why I'm doing it again) $\endgroup$ – Tom Himler Jan 5 '18 at 2:01
  • 1
    $\begingroup$ @TomHimler: the final outcome is really ugly, I agree, but the technique is fine, it converts such trigonometric integral into $\int\frac{1+t^2}{3+t^4}\,dt$. $\endgroup$ – Jack D'Aurizio Jan 5 '18 at 2:02
  • $\begingroup$ Yep, that's exactly what I got. I'm just trying to see if there's a simpler way of doing it. Thanks for the response though! $\endgroup$ – Tom Himler Jan 5 '18 at 2:03
  • 1
    $\begingroup$ Well, a more general problem: $$\mathscr{I}_{\space\text{n}}:=\int\frac{1}{1+\cos\left(x\right)+\dots+\cos^\text{n}\left(x\right)}\space\text{d}x=\int\frac{1}{1+\displaystyle\sum_{\text{k}=1}^\text{n}\cos^\text{k}\left(x\right)}\space\text{d}x=$$ $$\int\frac{1}{\left(\frac{\cos^{1+\text{n}}\left(x\right)-1}{\cos\left(x\right)-1}\right)}\space\text{d}x=\int\frac{\cos\left(x\right)-1}{\cos^{1+\text{n}}\left(x\right)-1}\space\text{d}x\tag1$$ $\endgroup$ – Jan Jan 5 '18 at 9:05

We have $\cos^2(x)+\cos(x)+1\geq \frac{3}{4}$ so the integral is well-defined over any bounded interval of the real line. By letting $x=2\arctan t$ the integral is converted into $$ \int \frac{2(1+t^2)}{3+t^4}\,dt $$ which only depends on $\arctan\left(1\pm \frac{\sqrt{2}\,t}{\sqrt[4]{3}}\right)$ and $\log\left(\sqrt{3} \pm \sqrt{2}\sqrt[4]{3}\,t + t^2\right)$ by partial fraction decomposition.


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.