How to solve integrals of type $ \int\frac{1}{(a+b\sin x)^4}dx$ and $\int\frac{1}{(a+b\cos x)^4}dx$ $$\displaystyle \int\frac{1}{(a+b\sin x)^4}dx,~~~~\text{and}~~~~\displaystyle \int\frac{1}{(a+b\cos x)^4}dx,$$
although i have tried using Trg. substution. but nothing get
 A: Another method is the following: 
$$
\frac{1}{(a+b\cos x)^4} = -\frac{1}{6}\frac{\partial^3}{\partial a^3}\frac{1}{a+b\cos x} \\
\begin{align}
\int\frac{\text{d}x}{(a+b\cos x)^4} & = -\frac16\int\frac{\partial^3}{\partial a^3}\frac{\text{d}x}{a+b\cos x} \\
& = -\frac16\frac{\partial^3}{\partial a^3}\int\frac{\text{d}x}{a+b\cos x}
\end{align}
$$
The resulting integral can be solved using "trying"'s answer to receive:
$$
\int\frac{\text{d}x}{(a+b\cos x)^4} = \frac 13\frac{\partial^3}{\partial a^3}\frac 1{\sqrt{b^2-a^2}}\text{artanh}\left[\frac{(a-b)}{\sqrt{b^2-a^2}}\tan\left(\frac x2\right)\right] + C
$$
Following a similar process for the other integral yields
$$
\int\frac{\text{d}x}{(a+b\sin x)^4} = -\frac 13\frac{\partial^3}{\partial a^3}\frac1{\sqrt{a^2-b^2}}\arctan\left[\frac{a\tan(x/2)+b}{\sqrt{a^2-b^2}}\right] + C
$$
Also:
If you're interested in how exactly you use the hint "trying" gave, the following gives an outline:
$$
\int\frac{\text{d}x}{a+b\cos x} = \int\frac{\text{d}x}{a+b\left(\frac{1-\tan^2(x/2)}{1+\tan^2(x/2)}\right)} \\
\text{sub } v = \tan(x/2)\text{ and simplify} \\
\int\frac{\text{d}x}{a+b\left(\frac{1-\tan^2(x/2)}{1+\tan^2(x/2)}\right)} = 2\int\frac{\text{d}v}{(a-b)v^2+(a+b)}
$$
The resulting integral can be solved using $\arctan(x) = \int\frac{\text{d}x}{x^2+1}$.
A: Use  $\sin(x)=  \frac{2\tan\frac{x}{2}}{1 +\tan^2 \frac {x}{2}}$ and $\cos(x)=  \frac{1-\tan ^{2}\frac{x}{2}}{1 +\tan^{2}\frac {x}{2}}$ 
