How to calculate $\int \frac{\cos^2 x}{1 + \sin^2 x}dx$ My approach was to use a double-arc formula for cosine and sine, but I did not succeed.
$\sin^2 x = \frac{1 - \cos(2x)}{2}$ and $\cos^2x = \frac{1 + \cos(2x)}{2}$
 A: HINT Proceed with the following substitution $\tan\frac{x}{2}=t$, then $x=2\arctan t$, $dx=2dt/(1+t^2)$.
Remember that $\sin x=\frac{2t}{1+t^2}$ and $\cos x=\frac{1-t^2}{1+t^2}$.
A: Bioche's rules suggest the substitution $\; t=\tan x$, so $\mathrm d t=(1+t^2)\,\mathrm dx\iff \mathrm dx=\dfrac{\mathrm d t}{1+t^2}$.
Indeed, $\;\cos^2x=\dfrac 1{1+t^2}$, $\;\sin^2x=t^2\cos^2x=\dfrac {t^2}{1+t^2}$, so that
$$\int \frac{\cos^2 x}{1 + \sin^2 x}\,\mathrm dx=\int \frac{\mathrm d t}{(1 + t^2)(1 + 2t^2)}$$
There remains to decompose this fraction into partial fractions:
$$ \frac{1}{(1 + t^2)(1 + 2t^2)}= \frac{A}{(1 + t^2)}+\frac{B}{(1 + 2t^2)}.$$
Can you proceed from there?
A: We reduce the degree of the numerator with
$$\int\frac{\cos^2x}{1+\sin^2x}dx=\int\frac{2-(1+\sin^2x)}{1+\sin^2x}dx=2\int\frac{dx}{1+\sin^2x}-x$$
and we introduct a tangent to rationalize,
$$\int\frac{dx}{1+\sin^2x}=\int\frac{dx}{\cos^2x+2\sin^2x}=\int\frac{dx}{\cos^2x(1+2\tan^2x)}=\int\frac{dt}{1+2t^2}
\\=\frac1{\sqrt2}\int\frac{du}{1+u^2}=\frac1{\sqrt2}\arctan u=\frac1{\sqrt2}\arctan\sqrt2t=\frac1{\sqrt2}\arctan(\sqrt2\tan x).$$
A: BE CAREFUL:
$\frac{\cos^2(x)}{1+\sin^2(x)}$ is a continuous function over $\mathbb{R}$, therefore you would generally want an antiderivative which also has that property. It is here that WolframAlpha is evidently inferior to GeoGebra (with integration) as latter gives the wonderful solution:
$$ \int \frac{\cos^2(x)}{1+\sin^2(x)} dx = \sqrt{2} \arctan \left( {\frac{(2-\sqrt2)\sin2x}{(\sqrt2 - 2)\cos2x +\sqrt2 +2}} \right) +(\sqrt2 -1)x +C$$
By graphical inspection (or otherwise), after implementing the Weierstrass substitution, one can deduce that the continuous integral is
$$ \sqrt2 \arctan(\sqrt2 \tan(x)) -x + k \left\lfloor \frac{x+\pi/2}{\pi} \right\rfloor + C $$
Where, $f(x) := \sqrt2 \arctan(\sqrt2 \tan(x)) -x $, 
$$k = \lim_{x \to \pi/2 ^-} f(x) - \lim_{x \to \pi/2 ^+} f(x)  $$
Then, to retrieve GeoGebra's beautiful closed form solution, use:
$$ \lfloor x \rfloor = \frac{1}{\pi}(\arctan(\cot(\pi x))+\pi x-\pi/2)$$
Read Szeto's answer here: Continuous antiderivative of $\frac{1}{1+\cos^2 x}$ without the floor function. for the floor function insight and concerns about discontinuity.
A: Try this
$$\int \dfrac{\cos^2x}{1+\sin^2x}dx=\int\dfrac{1-\sin^2x}{1+\sin^2x}dx=\int \biggl(\dfrac{2}{1+\sin^2x}-1\biggr)dx$$
Can you take it from here?
A: Note that we can write
$$\begin{align}
\frac{\cos^2(x)}{1+\sin^2(x)}&=\frac{1+\cos(2x)}{3-\cos(2x)}\\\\
&=\frac{4-(3-\cos(2x))}{3-\cos(2x)}\\\\
&=-1+\frac{4}{3-\cos(2x)}
\end{align}$$
Enforce the substitution $y=\tan(x)$, so that $\cos(2x)=\frac{1-y^2}{1+y^2}$ and $dx=\frac1{1+y^2}\,dy$.  Proceeding reveals 
$$\begin{align}
\int\frac{4}{3-\cos(2x)}\,dx&=\int \frac{2}{1+2y^2}\,dy\\\\
&=\sqrt2\arctan(\sqrt2\,y)+C\\\\
&=\sqrt{2}\arctan(\sqrt2 \tan(x))+C
\end{align}$$
Putting it all together yield
$$\int \frac{\cos^2(x)}{1+\sin^2(x)}\,dx=-x+\sqrt{2}\arctan(\sqrt2 \tan(x))+C$$
A: Use the substitution:
$$\sin(x)=\frac{2t}{1+t^2}$$
$$\cos(x)=\frac{1-t^2}{1+t^2}$$
$$dx=\frac{2t}{1+t^2}dt$$the so called Weierstrass Substitution.
