# Primitive of $\sin$ function (Weierstrass)

How do I find the primitive of the following function: $$f(x)=\frac{{\sin x}}{{1+\sin x}}.$$ I solved this with Weierstrass and I found it's: $$2\int(1+t)^{-2}dt$$ where $t=\tan(x/2)$ and if I solve it this would mean the integral is: $$I=\frac{-2}{{1+\tan(x/2)}}+C$$ but the answer is $$I=\frac{-2}{{1+\tan(x/2)}}+x+C.$$ The function's domain is $(-\pi/2,\pi/2)$. Why is there an $x$?

• You can see whether the answer is correct by differentiating it. Anyway, I think the $t$-integral in $\int 2t/(1+t^2)\,dt$. – Lord Shark the Unknown May 20 '17 at 9:11

With Weierstrass substitutions:

$$\begin{cases} \tan\cfrac x2=u\\{}\\ \sin x=\cfrac{2u}{1+u^2}\\{}\\ dx=\cfrac{2\,du}{1+u^2}\end{cases}\;\;\implies \int\frac{\sin x}{1+\sin x}=\int\frac{\frac{2u}{1+u^2}}{1+\frac{2u}{1+u^2}}\cdot\frac{2\,du}{1+u^2}=\int\frac{4u}{(1+u)^2(1+u^2)}du=$$$${}$$

$$=-2\int\frac{du}{(1+u)^2}+2\int\frac{du}{1+u^2}=\frac2{1+u}+2\arctan u+C\mapsto\frac2{1+\tan\frac x2}+2\frac x2+C=$$$${}$$

$$=\frac2{1+\tan\frac x2}+x+C$$

I almost agree with what you call "the answer", yet I can't see where that minus sign in the first factor comes from...Check this

• "Weierstrass" would appear to be a misnomer. James Stewart's calculus textbooks assert that Weierstrass introduced that substitution, and Stewart said elsewhere than in his books that the name was around before he asserted that. I suspect Stewart uncritically assumed that if people called it that then it's a historical fact that Weierstrass introduced it. Prof. Fred Rickey searched through Weierstrass's writings without finding it. History was not Stewart's field of scholarly interest. en.wikipedia.org/wiki/Tangent_half-angle_substitution $\qquad$ – Michael Hardy May 21 '17 at 17:39
• @MichaelHardy Perhaps, though I always knew it that way or, in some few cases, "trigonometric substitutions". Besides this, I finished my undergraduate studies way before Stewart even thought of writing his books, so the name, at least in my case, is not because of it. And besides of besides: there are huge misnomers way bigger than this one, like "l'Hospital's Rule" which more likely is due to J. Bernoulli.\ – DonAntonio May 21 '17 at 18:39

Divide numerator and denominator of the function with
$$1-\sin x$$ giving

$$f(x)=\sin x\frac{1-\sin x}{1-\sin^2x}=\frac{\sin x}{\cos^2x}-\frac{1-\cos^2x}{\cos^2x}$$

Therefore integration of the given function

$$-\sec x-\tan x+x+C.$$

• This is a nice solution but try to improve you writing with MathJaX to make your posts clearer. +1 – DonAntonio May 20 '17 at 10:43
• Thank you. I will try using MathJaX from now. – Babu May 20 '17 at 10:44

$$1+\sin x=1+\cos\left(x-\frac\pi2\right)=2\cos^2\left(\frac x2-\frac\pi4\right),$$ so that

$$\int\frac{\sin x}{\sin x+1}dx=\int\left(1-\frac1{\sin x+1}\right)dx=x-\int \frac{dx}{2\cos^2\left(\dfrac x2-\dfrac\pi4\right)}=x-\tan\left(\dfrac x2-\dfrac\pi4\right)+C.$$

This expression is equivalent to that given by @DonAntonio, because

$$\tan\left(\dfrac x2-\dfrac\pi4\right)=\frac{\tan\dfrac x2-1}{\tan\dfrac x2+1}=1-\frac2{1+\tan\dfrac x2}.$$

• Very nice. And thus the sign of $\;\frac2{1+\tan\frac x2}\;$ indeed is $\;+\;$ and not $\;-\;$ as the OP wrote. – DonAntonio May 20 '17 at 10:38
• Alternatively, $$\frac1{1+\sin x}=\frac{1-\sin x}{\cos^2x}=?$$ – lab bhattacharjee May 20 '17 at 10:38
• @labbhattacharjee Indeed. Babu's answer already did this. – DonAntonio May 20 '17 at 10:43
• @labbhattacharjee: yep, a much better solution ! – Yves Daoust May 20 '17 at 16:21