I'd like to evaluate the following integral:
$$\int \frac{\cos^2 x}{1+\tan x}dx$$
I tried integration by substitution, but I was not able to proceed.
I'd like to evaluate the following integral:
$$\int \frac{\cos^2 x}{1+\tan x}dx$$
I tried integration by substitution, but I was not able to proceed.
This one always works for rational functions of $\sin x$ and $\cos x$ but can be a bit tedious. Set: $$ z = \tan x / 2$$ so that $$ \mathrm{d}x = \frac{2\,\mathrm{d} z}{1 + z^2}$$ $$ \cos x = \frac{1 - z^2}{1 + z^2}$$ $$\sin x = \frac{2z}{1 + z^2}$$ Now, you have a rational fraction in $z$ that you can integrate by standard methods (partial fraction decomposition).
There are often simpler (and trickier) substitutions for this kind of integrals, but this one will always do the job.
Here's another way; rewrite: $$\int \frac{\cos^2 x}{1+\tan x} \,\mbox{d}x = \int \frac{\sec^2 x}{\left(1+\tan x\right) \sec^4 x} \,\mbox{d}x = \int \frac{\sec^2 x}{\left(1+\tan x\right)\left( 1+\tan^2x\right)^2} \,\mbox{d}x $$
Now set $u = \tan x$ to get: $$\int \frac{1}{\left(1+u\right)\left( 1+u^2\right)^2} \,\mbox{d}u$$ And you can continue with partial fractions. Tedious, but it works.
$$\dfrac{2\cos^2x}{1+\tan x}=\dfrac2{(1+\tan x)(1+\tan^2x)} =\dfrac{1+\tan^2x+1-\tan^2x}{(1+\tan x)(1+\tan^2x)}$$
$$=\dfrac1{1+\tan x}+\dfrac{1-\tan x}{1+\tan^2x}$$
$$=\dfrac{\cos x}{\cos x+\sin x}+\cos^2x(1-\tan x)$$
$\cos^2x(1-\tan x)$ can be managed easily.
Now $\dfrac{2\cos x}{\cos x+\sin x}=1+\dfrac{\cos x-\sin x}{\cos x+\sin x}$
$\dfrac{d(\cos x+\sin x)}{dx}=?$
$\displaystyle \int \frac{\cos^2 x}{1+\tan x}dx = \int\frac{\cos^3 x}{\sin x+\cos x}dx = \frac{1}{2}\int\frac{(\cos^3 x+\sin ^3 x)+(\cos^3 x-\sin ^3 x)}{\cos x+\sin x}dx$
$\displaystyle = \frac{1}{4}\int (2-\sin 2x)dx+\frac{1}{4}\int\frac{(2+\sin 2x)(\cos x-\sin x)}{\cos x+\sin x}dx$
put $\cos x+\sin x= t$ and $1+\sin 2x = t^2$ in second integral
HINT:
$$\frac{\cos^2x}{1+\tan x}=\frac{\cos^3x}{\cos x+\sin x}$$
Now $\cos x+\sin x=\sqrt2\cos\left(x-\dfrac\pi4\right)$
Set $x-\dfrac\pi4=u\implies\cos x=\cos\left(u+\dfrac\pi4\right)=\sqrt2(\cos u-\sin u)$