<s>[INST] Evaluating $\int \frac{\sin{x}+\cos{x}}{\sin^4{x}+\cos^4{x}} \mathrm dx$ I am having real trouble evaluating this indefinite integral
$$\int{\frac{\sin{x}+\cos{x}}{\sin^4{x}+\cos^4{x}}}dx$$
Need I mention that I already tried WolframAlpha with little success? It returned a complicated expression full of many $\arctan$ terms.
Here is what I have already tried:


*

*Seperating denominator as $(1-\sqrt{2}\sin{x}\cos{x})(1-\sqrt{2}\sin{x}\cos{x})$ and applying partial fractions.

*Multiplying and dividing by $\sec^4{x}$


Please provide any help. It would be appreciated if you give a hint rather than the whole solution.
 [/INST] We first split the integral into two.
$$
\begin{aligned}
I:=& \int \frac{\sin x+\cos x}{\sin ^{4} x+\cos ^{4} x} d x \\
=&-\int \frac{d(\cos x)}{\left(1-\cos ^{2} x\right)^{2}+\cos ^{4} x}+\int \frac{d(\sin x)}{\sin ^{4} x+\left(1-\sin ^{2} x\right)^{2}} \\
=& \frac{1}{2}\left[\underbrace{-\int \frac{d y}{y^{4}-y^{2}+\frac{1}{2}}}_{J}+\underbrace{\int \frac{d z}{z^{4}-z^{2}+\frac{1}{2}}}_{K}\right]
\end{aligned}
$$
where $y=\cos x$ and $z=\sin x$
We need to find one of them, say $J$. We are going to play a little trick on $J$.
\begin{aligned}J &=\int \frac{\frac{1}{y^{2}} d y}{y^{2}+\frac{1}{2 y^{2}}-1} \\
&=\frac{1}{\sqrt 2} \int \frac{1+\frac{1}{y^{2}}-\left(1-\frac{1}{y^{2}}\right)}{y^{2}+\frac{1}{2 y^{2}}-1} d y \\
&=\frac{1}{\sqrt2} \int \frac{d\left(y-\frac{1}{y}\right)}{\left(y-\frac{1}{y}\right)^{2}+1}-\frac{1}{\sqrt2} \int \frac{d\left(y+\frac{1}{y}\right)}{\left(y+\frac{1}{y}\right)^{2}-3}\\
&=\frac{1}{\sqrt2} \tan ^{-1}\left(y-\frac{1}{\sqrt2y}\right)-\frac{1}{2 \sqrt{6}} \ln \left|\frac{y+\frac{1}{\sqrt2y}-\sqrt{3}}{y+\frac{1}{\sqrt2y}+\sqrt{3}}\right|+C_{1} \\
&=\frac{1}{\sqrt2} \tan ^{-1}(\cos x-\frac{\sec x}{\sqrt2})-\frac{1}{2 \sqrt{6}} \ln \left|\frac{\sqrt2\cos ^{2} x-\sqrt{6} \cos x+1}{\sqrt2\cos ^{2} x+\sqrt{6} \cos x+1}\right|+C_{1}\end{aligned}
Replacing y by z yields
$$
K=\frac{1}{2} \tan ^{-1}(\sin x-\frac{\csc x}{\sqrt2})-\frac{1}{2 \sqrt{6}} \ln \left|\frac{\sqrt2\sin ^{2} x-\sqrt{6} \sin x+1}{\sqrt2\sin ^{2} x+\sqrt{6} \sin x+1}\right|+C_{2}
$$
We can now conclude that
$$
\begin{aligned}
I=& \frac{1}{2\sqrt2}\left[\tan ^{-1}(\sin x-\frac{\csc x}{\sqrt2})-\tan ^{-1}(\cos x-\frac{\sec x}{\sqrt2})\right] \\
&+\frac{1}{4 \sqrt{6}} \ln \left| \frac{\left(\sqrt2\cos ^{2} x-\sqrt{6} \cos x+1\right)\left(\sqrt2\sin ^{2} x+\sqrt{6} \sin x+1\right)}{\left(\sqrt2\cos ^{2} x+\sqrt{6} \cos x+1\right)\left(\sqrt2\sin ^{2} x-\sqrt{6} \sin x+1\right)}\right|+C
\end{aligned}
$$
</s>