Integrating $\int \frac{-\sin x}{1+\cos x}\, dx$, I get $\ln(1 + \cos x)$. WolframAlpha gives $2 \ln(\cos \frac x 2)$. Is WA wrong? So, I'm watching a tutorial on differential equations, where I encountered this little trick:
$$\int \frac{y'}{y}\, dx = \ln(y)$$
It seems perfectly logical and easy to justify, but something fishy happens to this integral:
$$\int \frac{-\sin x}{1+\cos x}\, dx$$
The trick gives $\int \frac{-\sin x}{1+\cos x}\, dx = \ln(1 + \cos x)$
while WolframAlpha gives $\int \frac{-\sin x}{1+\cos x}\, dx = 2 \ln(\cos \frac x 2)$.
You guys who know this stuff - does WolframAlpha mess up here or is it something I've missed? Taking the derivative of $2 \ln(\cos \frac x 2)$ gives me $-\tan \frac x 2$, so I don't see how WA may be right.
 A: $$1+\cos x = 2\cos^2\frac{x}{2}$$
$$\ln (1+\cos x )=\ln( 2\cos^2\frac{x}{2})=\ln2+2\ln\cos\frac{x}{2}$$
And this $\ln2$ adds together with the arbitrary constant $c$ in indefinite integral and gets cancelled in definite integral.
A: As Ben suggested in comments, it's always good to check an integral by taking the derivative:
$$\dfrac d {dx} \ln(1+\cos x)=\dfrac{-\sin x}{1+\cos x}=\dfrac{-2\sin\dfrac x2 \cos \dfrac x2}{2\cos^2\dfrac x2}=\dfrac{-\sin\dfrac x2}{\cos \dfrac x2}=\dfrac d {dx} 2 \ln \cos \dfrac x2$$
A: $$2\ln\cos\frac x2=\ln\cos^2\frac x2=\ln\frac{1+\cos x}2=\ln(1+\cos x)-\ln2$$
by the half-angle formula, so your answer and WA's are the same up to the integration constant.
A: $1+\cos \, x=2\cos^{2}(\frac x 2)$ so $\ln (1+\cos \, x)=2 \ln (\cos (\frac x 2))+\ln 2$ . Also, $-\tan (\frac x 2)$  is same as $-\frac {\sin \, x} {1+\cos \, x}$ because $\sin \,x =2 \sin (\frac x 2)\cos (\frac x 2)$ and $1+\cos \, x=2\cos^{2}(\frac x 2)$. 
A: When you do the one integral $I(x)$ by different methods you get different expressions $I_1(x),I_2(x),I_3(x),.....$, however the difference between any two of these is a constant independent of $x$. For instance $$I(x)=\int \sin \cos x dx =\frac{1}{2}\int \sin 2x~ dx =-\frac{1}{4} \cos 2x +C_1 =I_1(x).$$
Next if you do integration by parts you get $$ I=\sin ^2x -\int \sin x \cos  \Rightarrow I=\frac{1}{2} \sin^2 x +C_2=I_2(x).$$
Further I you use a substitution $\cos x =-t$, then
$$I(x)=-\frac{1}{2}\cos^2 x +C_3=I_3(x).$$
Now check  that the difference between any two of $I_1,I_2,I_3$ is just a constant.
As pointed in other solutions the  thing  stated above is happening in your case as well.
