# integrate $\int \frac{dx}{1+cos^2x}$

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

I used $\cos x=\frac{1-v^2}{1+v^2}$ and $dx=\frac{2dv}{1+v^2}$

and got $$2\int \frac{dv}{v^4-v^2+1}=2\int \frac{dv}{(v^2-\frac{1}{2})^2+(\frac{\sqrt{3}}{2})^2}=\frac{4}{\sqrt{3}}arctan(\frac{2v^2-1}{\sqrt{3}})+c$$

How to continue?

• You can use partial fraction decomposition. – Foobaz John Feb 17 '16 at 23:46
• Depending on OP's purpose, it might be better to apply partial fractions over $\Bbb R$, in which case one wants to use the real factorization into the irreducible quadratic factors of the denominator. One can save some time when working out the factorization using the fact that the denominator is even to conclude that it must have the form $(v^2 + a v + 1)(v^2 - a v + 1)$. – Travis Feb 17 '16 at 23:53
• Complete the square: $v^4-v^2+1=v^4-v^2+1/4+3/4=(v^2-1/2)^2+3/4$. – Ian Feb 17 '16 at 23:53
• You can't jump straight to arctan because you would need to substitute $u=v^2-1/2$, but you do not have the factor of $v$ required to make this substitution perform correctly. – Ian Feb 17 '16 at 23:54
• @gbox The arctan integral is of the form $\frac{du}{u^2+a^2}$. To get to this form you would need to substitute $u=v^2-1/2$, but this would give $du=2vdv$, and you don't have the factor of $v$ in the original integrand to get "absorbed" into the du. If you could avoid that then you could do all sorts of crazy things like "prove" $\int \frac{dx}{x^2+1} = \ln(x^2+1)$. – Ian Feb 17 '16 at 23:57

An alternative method:

Multiplying through by $sec^2(x)$:

$$\int \frac{dx}{1+\cos^2x} = \int \frac{sec^2x}{1+sec^2x}dx$$

Defining $u = tanx$, $du = sec^2x$ $dx$, and using the identity $1+tan^2x = sec^2x$:

$$\int \frac{sec^2x}{1+sec^2x}dx = \int \frac{1}{u^2+2}du$$

The integral is now of the form of a very well-known $\arctan$ integral

• Your actual centered formula is correct but you wrote the identity you were using backwards. (You meant $\sec^2(x)=1+\tan^2(x)$. I remember this one by either rederiving it as necessary, or by looking at the values at zero.) – Ian Feb 17 '16 at 23:59
• @Ian Thank you for catching my mistake! :) – Brenton Feb 18 '16 at 0:01
• so I get $\frac{1}{\sqrt{2}}arctan(\frac{u}{\sqrt{2}})+C=\frac{1}{\sqrt{2}}arctan(\frac{tanx}{\sqrt{2}})+C$? – gbox Feb 18 '16 at 0:02
• @gbox That's right. You can check it on Wolfram. – Ian Feb 18 '16 at 0:10

Note that $\cos^2(x)=\frac{1+\cos(2x)}{2}$. Then,

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

Enforcing the substitution $x=u/2$ yields

$$\int \frac{2}{3+\cos(2x)}\,dx=\int \frac{1}{3+\cos(u)}\,du \tag 1$$

Now, making the Weierstrass Substitution in $(1)$, as in the OP, we find

$$\int \frac{1}{1+\cos^2(x)}\,dx=\frac{1}{\sqrt 2}\arctan\left(\frac{\tan(u/2)}{\sqrt 2}\right)+C=\frac{1}{\sqrt 2}\arctan\left(\frac{\tan(x)}{\sqrt 2}\right)+C$$

• I did not get it, the first attempt gives a different answer? – gbox Feb 18 '16 at 0:19
• Keep trying. You'll get it. – Mark Viola Feb 18 '16 at 0:36