# How to integrate $\int_{0}^{2\pi} \frac{1}{\sin^4x + \cos^4 x} \,dx$

So I followed the explanations made in this post and I got that:
$$\int \frac{1}{\sin^4x + \cos^4 x} \,dx = \frac{\sqrt{2}}{2}\arctan\left(\frac{\sqrt{2}}{2}\tan\left(2x\right)\right) + C$$
But when I try to use the Leibniz-Newton formula and evaluate the integral from $$0$$ to $$2\pi$$ I get that it's $$0$$ because $$\tan\left(2x\right)$$ evaluates to $$0$$ at both $$x=0$$ and $$x=2\pi$$. Is there another way to solve this integral and get the correct answer ($$2\pi\sqrt2$$)?

• $\tan(x/2)$ is not continuous on $(0,2\pi)$. To use that form, you must split it over intervals where the antiderivative is continuous. Jun 27, 2019 at 8:13
• The core issue is that $\tan(x/2)$ is not monotonic on the interval. You will need to split up into intervals of $\frac{k\pi}{2}$ to $\frac{(k + 1)\pi}{2}$
– user679268
Jun 27, 2019 at 9:31
• Related: math.stackexchange.com/questions/1356523/… (and the linked questions there). Jun 27, 2019 at 9:52

A correct antiderivative is

$$\int\frac{1}{\sin^4 x+\cos^4 x}\, \mathrm{d}x = \frac{1}{\sqrt{2}}\arctan\left(\frac{1}{\sqrt{2}}\tan(2x)\right)+\mathsf{C},$$

which is true on every interval $$\left(\frac{k\pi}{2}-\frac{\pi}{4}, \frac{k\pi}{2}+\frac{\pi}{4} \right)$$ with $$k \in \mathbb{Z}$$. You may check the following plot for the comparison of both sides. This is not surprising, since $$\tan(2x)$$ has discontinuity at every point of the form $$k\pi/2 + \pi/4$$ for $$k \in \mathbb{Z}$$, which naturally restricts the region of validity of the above formula.

If you want to get an expression that is valid on a larger set, you must patch different antiderivatives (with different choices of 'constant of integration') to remove discontinuity. Alternatively, we can exploit the symmetry of the integrand to write

\begin{align*} \int_{0}^{2\pi} \frac{1}{\sin^4 x+\cos^4 x}\,\mathrm{d}x &= 8\int_{0}^{\frac{\pi}{4}} \frac{1}{\sin^4 x+\cos^4 x}\,\mathrm{d}x \\ &= 8 \lim_{a \to (\pi/4)^+} \int_{0}^{a} \frac{1}{\sin^4 x+\cos^4 x}\,\mathrm{d}x, \end{align*}

which then can be computed by the above antiderivative.

Just an alternate method of evaluation that relies heavily on symmetry.

$$J=\int_0^{2\pi}\frac{dx}{\sin(x)^4+\cos(x)^4}$$ We can do a bunch of trig and notice that this simplifies to $$J=4\int_0^{2\pi}\frac{dx}{3+\cos(4x)}=16\int_0^{\pi/2}\frac{dx}{3+\cos(4x)}.$$ Preforming $$4x\mapsto x$$ gives $$J=4\int_0^{2\pi}\frac{dx}{3+\cos x}=8\int_0^\pi \frac{dx}{3+\cos x}.$$ Then we use my favorite substitution, $$t=\tan(x/2)$$: $$J=16\int_0^\infty \frac{1}{3+\frac{1-t^2}{1+t^2}}\frac{dt}{1+t^2}=8\int_0^\infty\frac{dx}{t^2+2}$$ and the rest is rather easy.

• Great solution :-)
– user679268
Jun 27, 2019 at 9:36
• @KevinNivek Thank you very much! I was very proud of myself for finding it! :) Jun 27, 2019 at 21:24

You cannot directly use the indefinite integral to compute the definite integral because $$\tan 2\, x$$ is not defined at $$\pi/4, 3\pi /4, 5\pi /4, 7\pi /4$$. But you can use the indefinite integral to compute the definite integral from $$0$$ to $$\pi/4 -\epsilon$$ , the integral from $$\pi/4+\epsilon$$ to $$3\pi/4 -\epsilon$$ etc. When you take the limit as $$\epsilon \to 0$$ pay attention to the sign of $$\tan$$ and $$\arctan$$. You should now be able to compute the integral.

Note. I have edited the answer based on the comment by Travis.

• The discontinuities of the given antiderivative are at $\frac{\pi}{4}, \frac{3 \pi}{4}, \ldots$, not at $\frac{\pi}{2}$. Jun 27, 2019 at 8:52
• Now I get it. I have to integrate over the intervals where the function is continuous and evaluate the limits at the ends. Jun 27, 2019 at 9:10

Given integral $$I = \int^{2 \pi}_0 \cfrac{1}{\sin^4 x + \cos^4 x} dx = 4 \int^{\pi/2}_0 \cfrac{dx}{\sin^4 x + \cos^4 x}$$

By repeatedly using $$\int^{2a}_0 f(x) dx = \int^a_0 f(x) dx + \int^a_0 f(2a-x) dx$$

On multiplying numerator and denominator by $$\sec^4(x)$$, followed by substitution of $$\tan(x) = u$$ \begin{align} I &= 4 \int^{\infty}_0 \cfrac{1 + u^2}{1+ u^4} du \\ &= 4 \int^{\infty}_0 \cfrac{1}{\bigg( u - \frac{1}{u} \bigg)^2 + 2} d \bigg( u - \frac{1}{u} \bigg) \\ &= \cfrac{4}{\sqrt{2}} \arctan \bigg(\cfrac{u-\frac{1}{u}}{\sqrt{2}} \bigg) \bigg|^{\infty}_0 = 2 \sqrt{2} \pi\end{align}

• I didn't know about that property of definite integrals. Jun 27, 2019 at 8:52
• Do you need proof? It is quite easy :) Jun 27, 2019 at 9:03
• That would help. I know that to prove $\int^a_{0}f(x)dx=\int^a_{0}f(a-x)dx$ I have to use substitution. Do I use the same method here? Jun 27, 2019 at 9:08
• You have to use $\int^{2a}_0 f(x) dx = \int^a_0 f(x) dx + \int^{2a}_a f(x) dx$ and then a substitution. Jun 27, 2019 at 9:09

The given antiderivative, $$\frac{1}{\sqrt 2} \arctan \left( \frac{1}{\sqrt 2} \tan 2 x \right)$$ is not defined everywhere on the interval $$[0, 2 \pi]$$ of integration---it is undefined at $$\frac{\pi}{4}, \frac{3 \pi}{4}, \frac{5 \pi}{4}, \frac{7 \pi}{4}$$, so the usual hypotheses of the Fundamental Theorem of Calculus are not satisfied for that interval. In retrospect this is not surprising, since the trigonometric substitution that leads to this formula is not defined at those values.

On the other hand, using the double angle formulas for $$\sin$$ and $$\cos$$ (or just their complex representations) shows that the integrand has period $$\frac{\pi}{2}$$; using this observation and the symmetry of the integrand gives $$\int_0^{2 \pi} \frac{dx}{\sin^4 x + \cos^4 x} = 8 \int_0^{\frac{\pi}{4}} \frac{dx}{\sin^4 x + \cos^4 x} .$$ The given antiderivative is defined everywhere on $$[0, \frac{\pi}{4})$$, so we can write $$\int_0^{2 \pi} \frac{dx}{\sin^4 x + \cos^4 x} = 8 \cdot \lim_{a \nearrow \frac{\pi}{4}} \int_0^a \frac{dx}{\sin^4 x + \cos^4 x}$$ apply the F.T.C., and compute the limit.

Of course, since $$\sin$$ and $$\cos$$ do not vanish simultaneously, the original integrand is defined everywhere, and hence it has a continuous antiderivative on all of $$\Bbb R$$. One can verify that the antiderivative $$F$$ satisfying $$F(0) = 0$$ is $$F(x) = \left\{ \begin{array}{cl} \cdots & \cdots \\ \frac{1}{\sqrt 2} \arctan \left( \frac{1}{\sqrt 2} \tan 2 x \right), & -\frac{\pi}{4} < x < \frac{\pi}{4} \\ \frac{\pi}{2 \sqrt 2}, & x = \frac{\pi}{4} \\ \frac{1}{\sqrt 2} \left(\arctan \left( \frac{1}{\sqrt 2} \tan 2 x \right) + \pi \right) , & \frac{\pi}{2} < x < \frac{3 \pi}{4} \\ \frac{3 \pi}{2 \sqrt 2}, & x = \frac{3 \pi}{4} \\ \frac{1}{\sqrt 2} \left(\arctan \left( \frac{1}{\sqrt 2} \tan 2 x \right) + 2 \pi \right) , & \frac{3 \pi}{2} < x < \frac{5 \pi}{2}\\ \cdots & \cdots \end{array} \right. .$$ It is evidently less practical than appealing to periodicity and symmetry as above, but we can also evaluate the integral by finding this antiderivative---which does satisfy the hypotheses of the F.T.C. on the interval $$[0, 2 \pi]$$---and then applying the F.T.C.

You've got many methods here to find the anti-derivative, but hey, why not one more?

Here \begin{align} I &= \int \frac{1}{\sin^4(x) + \cos^4(x)}\:dx = \int \frac{1}{\cos^4(x)\left(\tan^4(x) + 1\right)}\:dx \nonumber \\ &= \int \sec^2(x)\sec^2(x) \cdot\frac{1}{\tan^4(x) + 1}\:dx = \int \sec^2(x) \cdot\frac{\tan^2(x) + 1}{\tan^4(x) + 1}\:dx \end{align} Let $$t = \tan(x)$$: \begin{align} I &= \int \frac{t^2 + 1}{t^4 + 1}\:dt = \int \frac{t^2 + 1}{\left(t^2 + \sqrt{2}t + 1\right)\left(t^2 - \sqrt{2}t + 1\right)}\:dt \nonumber \\ &= \int \frac{1}{2}\left[\frac{1}{t^2 + \sqrt{2}t + 1} + \frac{1}{t^2 - \sqrt{2}t + 1} \right]\:dt \nonumber \\ &= \frac{1}{2}\left[ \int \frac{1}{t^2 + \sqrt{2}t + 1}\:dt + \int \frac{1}{t^2 - \sqrt{2}t + 1}\:dt \right] = \frac{1}{2}\left[ J_1 + J_2\right] \end{align} We now address $$J_1$$ and $$J_2$$ separately. Here we begin with $$J_1$$: $$\begin{equation} J_1 = \int \frac{1}{t^2 + \sqrt{2}t + 1}\:dt = \int \frac{1}{\left(t + \frac{1}{\sqrt{2}}\right)^2 + \frac{1}{2}}\:dt = \frac{1}{\sqrt{\frac{1}{2}}}\arctan\left(\frac{t + \frac{1}{\sqrt{2}}}{\sqrt{\frac{1}{2}}}\right)= \sqrt{2}\arctan\left(\sqrt{2}t + 1\right) \end{equation}$$ Note I've omitted the constant of integration here. Similarly we find that $$J_2$$ is $$\begin{equation} J_2 = \sqrt{2}\arctan\left(\sqrt{2}t - 1\right) \end{equation}$$ Thus our integral $$I$$ becomes: \begin{align} I &= \frac{1}{2}\left[ J_1 + J_2\right] = \frac{1}{2}\bigg[\sqrt{2}\arctan\left(\sqrt{2}t + 1\right) + \sqrt{2}\arctan\left(\sqrt{2}t - 1\right)\bigg] + C = \frac{1}{\sqrt{2}}\bigg[ \arctan\left(\sqrt{2}t + 1\right) + \arctan\left(\sqrt{2}t - 1\right)\bigg] + C \nonumber \\ &=\frac{1}{\sqrt{2}}\bigg[ \arctan\left(\sqrt{2}\tan(x) + 1\right) + \arctan\left(\sqrt{2}\tan(x) - 1\right)\bigg] + C \end{align} Where $$C$$ is the constant of integration. Thus, $$\begin{equation} \int \frac{1}{\sin^4(x) + \cos^4(x)}\:dx =\frac{1}{\sqrt{2}}\bigg[ \arctan\left(\sqrt{2}\tan(x) + 1\right) + \arctan\left(\sqrt{2}\tan(x) - 1\right)\bigg] + C \end{equation}$$

• Very nice (+1). I did not have the patience to find an antiderivative :) Jun 27, 2019 at 21:26