# 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!

• How did you get$$\frac{\mathrm d}{\mathrm dx}\frac{1+\sin(x)}{\cos(x)}=\frac{1+\sin(x)}{\cos^2(x)}$$? Also you want to take care of the square root. $\frac{1+\sin(x)}{\cos(x)}$ can be negative, but the original square root cannot. Sep 3, 2019 at 13:28
• opps its a mistake its $\frac{\cos ^2\left(x\right)+\sin \left(x\right)\left(1+\sin \left(x\right)\right)}{\cos ^2\left(x\right)}$ Using mathjax is hard for me that is why..Sorry! Sep 3, 2019 at 13:31
• You can simplify your answer a bit using $\sin^2(x)+\cos^2(x)=1$. Regardless, I don't think you've done anything wrong: Your book's answer and yours are equivalent, up to use of the half-angle identities.(Try multiplying both top and bottom of your last expression by $(\cos(x/2)+\sin(x/2))^2$.) Sep 3, 2019 at 13:44
• Dude U gave me the perfect answer Thanks!! :)) Sep 3, 2019 at 13:45

Why make things complicated if there is a easy way? By the half-angle formulae we obtain

$$\sqrt{\frac{1-\sin(x)}{1+\sin(x)}}=\sqrt{\frac{1-\cos\left(x+\frac\pi2\right)}{1+\cos\left(x+\frac\pi2\right)}}=\tan\left(\frac x2-\frac\pi4\right)$$

And I suppose you can differentiate the tangent function ;)

As pointed out by Simply Beautiful Art and mathcounterexamples.net by using the half-angle formula we ran into serious issus concerning the sign.

• How do we differentiate the tanget function..I really suck at trignometry.. Sep 3, 2019 at 13:32
• It would appear the textbook answer cares not for the sign of the square root :/ Sep 3, 2019 at 13:33
• @Utkarsh Do you know the quotient rule and at least how to differentiate $\sin$ and $\cos$? Sep 3, 2019 at 13:33
• @Utkarsh Yes it is $\sec^2(x)$. Yes, rationalizing would also work, as you've done in your post with the update. Take note however that both answers are technically wrong, as they fail to account for the fact that $\sqrt{x^2}=|x|$, not $x$. Sep 3, 2019 at 13:39
• :p as for fixing the answer, it suffices to deduce when to use $\tan\left(\frac x2-\frac\pi4\right)$ or $-\tan\left(\frac x2-\frac\pi4\right)$ and differentiate appropriately. Sep 3, 2019 at 13:41

Logarithmic differentiation makes things easier $$y=\sqrt{\dfrac{1 +\sin (x)}{1 -\sin (x)}}\implies \log(y)=\frac 12 \left(\log(1+\sin(x)) -\log(1-\sin(x))\right)$$ $$\frac {y'}{y}=\frac 12 \left(\frac{\cos(x)}{1+\sin(x) }+\frac{\cos(x)}{1-\sin(x) }\right)$$ Simplify as much as you can and, when finished, use $$y'=y\times \frac {y'}{y}$$

• +1. Indeed, $\frac{y'}{y}=\frac{1}{\cos x}$ and $y'=\frac{y}{\cos x}=\frac{1}{1-\sin x}$ is a lot shorter and simpler than direct calculation. Sep 3, 2019 at 16:48

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?

$$\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).$$

What if $$1\pm\sin x=0?$$

Otherwise $$\sqrt{\dfrac{1+\sin x}{1-\sin x}}=\sqrt{\left(\dfrac{1+\tan\dfrac x2}{1-\tan\dfrac x2}\right)^2}=\left|\tan\left(\dfrac\pi4+\dfrac x2\right)\right|$$ using
https://www.cut-the-knot.org/arithmetic/algebra/WeierstrassSubstitution.shtml

Now $$\tan\left(\dfrac\pi4+\dfrac x2\right)$$ will be $$>0$$ if $$1-\tan^2\dfrac x2>0\iff-1<\tan\dfrac x2<1$$

The textbook answer may not be quite right.
For x in range $$[0, 2\pi],\text{ only } [0, {\pi \over 2}], [{3\pi \over 2},2\pi]$$ work.

This is a revised derivative, to handle the full range.

$$\left(\sqrt{{1+\sin(x) \over 1-\sin(x)}} \right)' = {sign(\cos(x))\over 2} \sec^2({\pi \over 4} + {x \over 2})$$

Of course, chain rule result works too, but a bit messy.
After some simplification, this is what I have.
Note: derivative have the sign of $$\cos(x)$$, as expected. $$\left(\sqrt{{1+\sin(x) \over 1-\sin(x)}} \right)' = {\cos(x) \over (1-\sin(x))^2 \sqrt{{1+sin(x) \over 1-sin(x)}}}$$