Differentiate $\sqrt{\frac{1 +\sin x}{1 -\sin x}}$ I have tried a lot of ways to solve this question but I am unable to get the answer as same as my textbook. 
The text book answer is as follow: $$\frac{1}{2}\sec^2\left(\frac{\pi}{4}+\frac{{x}}{2}\right)$$
The steps which I took is as follows:
$$\sqrt{\frac{1+ \sin x}{1-\sin x}\cdot \frac{1+\sin x}{1+\sin x}}$$
Then Secondly
$$\sqrt{\frac{\left(1+\sin x\right)^2}{1-\sin^2 x}}$$
Then I got 
$$\dfrac{1+\sin x}{\cos x}$$
When I differentiated this I got the following 
$$\frac{\cos ^2\left(x\right)+\sin \left(x\right)\left(1+\sin \left(x\right)\right)}{\cos ^2\left(x\right)}$$
Can Anyone tell me what I am doing wrong?
I also know that $$\sec^2\left(\frac{\pi}{4}+\frac{{x}}{2}\right)=\frac{2}{\left(\cos  \frac{x}{2}-\sin\frac{x}{2}\right)^2}$$
Thank you for the help!

Alternatively, using the product rule:
$$\begin{align}\left(\sqrt{\dfrac{1 +\sin x}{1 -\sin x}}\right)'
&=(\sqrt{1+\sin x})'\cdot (1-\sin x)^{-1/2}+\sqrt{1+\sin x}\cdot ((1-\sin x)^{-1/2})'=\\
&=\frac{\cos x}{2\sqrt{1+\sin x}}\cdot \frac1{\sqrt{1-\sin x}}+\sqrt{1+\sin x}\cdot \frac{\cos x}{2(1-\sin x)\sqrt{1-\sin x}}=\\
&=\frac{\cos x}{2\sqrt{\cos ^2x}}+\frac{\cos x\sqrt{(1+\sin x)^2}}{2(1-\sin x)\sqrt{1-\sin ^2x}}=\\
&=\frac12+\frac{1+\sin x}{2(1-\sin x)}=\\
&=\frac1{1-\sin x}=\cdots =\\
&=\frac{1}{2}\sec^2\left(\frac{\pi}{4}+\frac{{x}}{2}\right)\end{align}$$
Can you show the equality of the last two expressions using what you stated you know?
Answer (see the hidden area):

$$\frac1{1-\sin x}=\frac{1}{\sin^2x+\cos^2x-2\sin \frac{x}{2}\cos \frac{x}{2}}=\frac{1}{(\sin \frac x2-\cos \frac x2)^2}=\\=\frac{1}{2(\frac{1}{\sqrt{2}}\sin \frac x2-\frac{1}{\sqrt{2}}\cos \frac x2)^2}=\frac{1}{2\cos^2(\frac{\pi}{4}+\frac x2)}=\frac12\sec^2(\frac{\pi}{4}+\frac x2).$$

