# Revision history [back]

The two integrals differ by a constant,

sage: log(-1)
I*pi


and integration is defined only up to a constant. So there is no problem, seen from this point of view. From the point of view of a Mathematical Olympiad -say - there is some problem, since at that level there is no $\log(-1)$, and such a calculus my get negative points, if things are not explained in full detail. As a rule of thumb for such particular cases, one can replace all terms $\log(\ f(x)\ )$ by the corresponding $\log|\ f(x)\ |$ so tht the computations "remain in the school". In our case, "adding the modulus" changes the sign inside the $\log$ of $\cos x-1$ to get $\log(1-\cos x)$. In our case we can then ask sage for

sage: bool( (cot(x)+csc(x))^2 == (1+cos(x)) / (1-cos(x)) )
True


or even better check it with bare hands by the substitution $t=\tan(x/2)$ s in the post.