# Evaluating $\int\frac{\cos^{n-1}\frac{x+a}{2}}{\sin^{n+1}\frac{x-a}{2}}\;dx$

Please help me to evaluate the following integral: $$\int\dfrac{\cos^{n-1}\dfrac{x+a}{2}}{\sin^{n+1}\dfrac{x-a}{2}}\;dx$$

-

$$\int\frac{\cos^{n-1}\frac{x+a}{2}}{\sin^{n+1}\frac{x-a}{2}}dx=\int\frac{\cos^{n-1}\frac{x+a}{2}}{\sin^{n-1}\frac{x-a}{2}}\cdot\frac{dx}{\sin^2\frac{x-a}{2}}=\left|\frac{\cos\frac{x+a}{2}}{\sin\frac{x-a}{2}}=t\Rightarrow\frac{dx}{\sin^2\frac{x-a}{2}}=-\frac{2dt}{\cos a}\right|=-\frac{2}{\cos a}\int{t^{n-1}dt}=-\frac{2}{\cos a}\cdot\frac{t^n}{n}=-\frac{2}{n\cos a}\cdot\frac{\cos^n\frac{x+a}{2}}{\sin^n\frac{x-a}{2}}+C.$$