How to integrate hyperbolic function $\frac{1-\sin(x)}{1+\sin(x)}$ I'm trying to find a primitive of $ \frac{1-\sin(x)}{1+\sin(x)} $. By changing the variable to $t=\tan(\frac{x}{2})$ and letting $\sin(x) = \frac{2t}{1+t^2}$ I get the following integral:
\begin{align}
& \int \frac{1-\sin(x)}{1+\sin(x)} \, dx \\[8pt] = {} & \int \frac{ 1-\frac{2t}{1+t^2} } { 1+ \frac{2t}{1+t^2} } \frac{2}{1+t^2} \, dt \\[8pt]
= {} & 2\int \frac{ t^2 -2t +1 }{ (t^2 +2t+1)(t^2 + 1) } \, dt \\[8pt]
= {} & 2\int \frac{t^2 -2t +1 }{(t+1)^2(t^2+1)} \, dt \end{align}
Now I know that I could do a partial fraction expansion. I would get 3 simpler fraction but I also know that the result contains only two fraction by calculating it in xcas: $$ \int \frac{1-\sin(x)}{1+\sin(x)} \, dx = 2\left(-\frac{2}{\tan(\frac{x}{2}) +1} - \frac{x}{2}\right) $$
Is there an easier way to calculate this primitive ?
 A: $$\begin{align}\int\frac{1-\sin x}{1+\sin x}dx &= \int\left(\frac2{1+\sin x}-1\right)\,dx
\\&= \int\frac2{1+\frac{2t}{1+t^2}}\cdot\frac2{1+t^2}\,dt-x
\\&= \int\frac4{1+2t+t^2}\,dt-x
\\&= \int\frac4{(t+1)^2}\,d(t+1)-x
\\&= -\frac4{t+1}-x
\\&= -\frac4{\tan\frac x2+1}-x
\end{align}$$
A: Hint. Multiply the integrand for $\frac{1-\sin x}{1 - \sin x}$.
A: Hint
$$\frac{\sin(x)-1}{\sin(x)+1}=1-\frac{2}{\sin(x)+1}$$
From this evaluate $\frac{2}{\sin(x)+1}$ using trigonometric/hyperbolic identities
A: Continuing from your work, you could still use partial fraction. The partial fraction expansion would actually only have $2$ simple fractions. Specifically, $$\frac{t^2 -2t +1 }{(t+1)^2(t^2+1)} = \frac{2}{(t+1)^2}-\frac{1}{t^2+1}$$
Can you finish from here?
A: $\displaystyle \frac{1-sinx}{1+sinx}=\frac{2}{1+sinx}-1=\frac{2}{(sin\frac{x}{2}+cos\frac{x}{2})^{2}}-1$
$\displaystyle =\frac{1}{cos^{2}(\frac{x}{2}-\frac{\pi}{4})}-1=tan^{2}(\frac{x}{2}-\frac{\pi}{4})$
$\displaystyle \theta=\frac{x}{2}-\frac{\pi}{4}\Rightarrow 2d\theta=dx$
$\displaystyle z=tan\theta\Rightarrow dz=(1+tan^{2}\theta)d\theta $
$\displaystyle dz-d\theta=tan^{2}\theta d\theta=d(z-\theta)$
$\displaystyle \int\frac{1-sinx}{1+sinx}dx=2\int tan^{2}\theta d\theta=2\int d(z-\theta)=2z-2\theta+c$
$\displaystyle \int\frac{1-sinx}{1+sinx}=2tan(\frac{x}{2}-\frac{\pi}{4})-2(\frac{x}{2}-\frac{\pi}{4})+c=2tan(\frac{x}{2}-\frac{\pi}{4})-x+C$
