Better way to solve integral I have the following integral
$$\int_{0}^{\pi / 2} \mathrm{d} x \,\, \frac{\cos^{3}(x/2) - \cos^{4} (x)}{\sin^{2} (x)}$$
My current solution is to use
$$v = \tan \left(\frac{x}{4}\right)$$
to obtain a rational function of $v$, and integrate this.
Is there a more practical / clever way of doing it?
 A: While the substitution $v=\tan(x/4)$ would work, I don't think it's a good method in this case, which just requires elementary antiderivatives.
First, split the fraction and notice that
$$
\int\frac{\cos^4x}{\sin^2x}\,dx=\int\left(\frac{1}{\sin^2x}-2+\sin^2x\right)\,dx
=-\cot x-2x+\frac{1}{2}(x-\sin x\cos x)
$$
This leaves the other piece:
$$
\int\frac{\cos^3(x/2)}{\sin^2x}\,dx=[t=x/2]=2\int\frac{\cos^3t}{\sin^22t}\,dt
=\frac{1}{2}\int\frac{\cos t}{\sin^2t}\,dt=-\frac{1}{2\sin t}
$$
Thus the integral is
$$
-\frac{1}{2\sin(x/2)}+\cot x+2x-\frac{1}{2}(x-\sin x\cos x)
$$
You can also note that
$$
\cot x-\frac{1}{2\sin(x/2)}=\frac{\cos x}{2\sin(x/2)\cos(x/2)}-\frac{1}{2\sin(x/2)}=
\frac{(\cos(x/2)-1)(2\cos(x/2)+1)}{2\sin(x/2)}
$$
which has limit $0$ for $x\to0$.
A: $$\frac{\cos^3\dfrac x2}{\sin^2x}=\frac{\cos\dfrac x2}{2\sin^2\dfrac x2}$$ is immediately integrable.
And in
$$\frac{\cos^4x}{\sin^2x}=\frac1{\sin^2x}-2+\sin^2x,$$ the first two terms are also immediate, and
$$\sin^2x=\frac{1-\cos2x}2.$$
A: $$J=\int\frac{\cos^3(\frac x2)-\cos^4x}{\sin^2x}\mathrm{d}x$$
$$J=\int\frac{\cos^3(\frac x2)}{\sin^2x}\mathrm{d}x-\int\frac{\cos^4x}{\sin^2x}\mathrm{d}x$$
$$I=J\bigg|_0^{\pi/2}$$

$$I_1=\int\frac{\cos^3(\frac x2)}{\sin^2x}\mathrm{d}x$$
$u=x/2$:
$$I_1=2\int\frac{\cos^3u}{\sin^22u}\mathrm{d}u$$
$$I_1=2\int\frac{\cos^3u}{4\sin^2u\cos^2u}\mathrm{d}u$$
$$I_1=\frac12\int\frac{\cos u}{\sin^2u}\mathrm{d}u$$
$t=\sin u$:
$$I_1=\frac12\int\frac{\mathrm{d}t}{t^2}$$
$$I_1=-\frac1{2t}$$
$$I_1=-\frac1{2\sin(x/2)}$$

$$I_2=\int\frac{\cos^4x}{\sin^2x}\mathrm{d}x$$
$$I_2=\int\frac{\cos^2x(1-\sin^2x)}{\sin^2x}\mathrm{d}x$$
$$I_2=\int\cot^2x\ \mathrm{d}x-\int\cos^2x\ \mathrm{d}x$$
$$I_2=-\bigg(\cot x+\frac12\cos x\,\sin x+\frac32x\bigg)$$

$$I=\bigg(-\frac12\csc(x/2)+\cot x+\frac12\cos x\sin x+\frac32x\bigg)\bigg|_0^{\pi/2}$$
$$I=\frac{3\pi-2\sqrt{2}}4$$
