<s>[INST] Methods for Integrating $\int \frac{\cos(x)}{\sin^2(x) +\sin(x)}dx$ So I've found that there's the Weierstrass Substitution that can be used on this problem but I just want to check I can use a normal substitution method to solve the equation:
$$\int \frac{\cos(x)}{\sin^2(x) +\sin (x)}dx$$
Let $u = \sin(x)$
$du = \cos(x)\, dx$
$dx = \frac {1}{\cos(x)\,} du$
Which becomes:
$$\int \frac{\cos(x)}{u^2 + u} \frac{1}{\cos(x)}du$$
$$\int \frac{1}{u^2 + u}du$$
Factor out u from denominator:
$$\int \frac{1}{u(u + 1)}du$$
Integrate as a partial fraction:
$$\int \frac{1}{u} - \frac{1}{(u + 1)}du$$
Which integrates as:
$$\ln|u| - \ln|(u + 1)| + C$$
Subtitute $u = \sin(x)$ back in and simplifies to:
$$\ln \left|\frac{\sin(x)}{\sin(x)+1} \right| + C$$
Is this correct? From the Weierstrass Substitution, one gets:
$$\ln \left|\tan \left(\frac{x}{2}\right)\right|-2\ln \left|\tan \left(\frac{x}{2}\right)+1\right| +C $$
 [/INST] Manipulating the Weierstrass result, we begin with
$$\ln \left|\tan \left(\frac{x}{2}\right)\right|-2\ln \left|\tan \left(\frac{x}{2}\right)+1\right| +C$$
With $\tan\left(\frac x2\right)={\sin x\over 1+\cos x}$, we then get
$$\ln \left|{\sin x\over 1+\cos x}\right|-2\ln \left|{\sin x\over 1+\cos x}+1\right| +C\\
=\ln \left|(\sin x)(1+\cos x)\right|-2\ln \left|\sin x + \cos x+1\right| +C\\
=\ln \left|\sin x+\sin x\cos x\over(\sin x + \cos x+1)^2\right|+C\\
=\ln \left|\sin x+\sin x\cos x\over \sin^2 x+\cos^2 x +2\sin x\cos x+2\sin x+2\cos x+1\right|+C\\
=\ln \left|\sin x+\sin x\cos x\over 2 +2\sin x\cos x+2\sin x+2\cos x\right|+C_0\\
=\ln \left|\sin x(1+\cos x)\over (1+\sin x)(1+\cos x)\right|+C_1\\
=\ln \left|\sin x\over 1+\sin x\right|+C_1$$
So the two answers differ by a constant $(\ln 2)$.
</s>