As is often with integrals, there are a couple of different ways to solve this. One method involves re-writing csc(x) as:
csc(x) = 1/sin(x) = sin(x)/sin^2(x) = sin(x)/(1-cos^2(x))
Using a u-substitution where u = cos(x) allows us to simplify things via partial fractions:
int 1/(1-u^2)du = -1/2int (1/(1-u) + 1/(1+u))du
Evaluating the integral yields:
-1/2(lnabs(u-1) - lnabs(u+1)) + C = 1/2lnabs((u-1)/(u+1)) + C
Substituting cos(x) for u yields:
1/2lnabs((cos(x)-1)/(cos(x)+1)) + C
We can simplify this by multiplying by 1:
1/2lnabs((cos(x)-1)/(cos(x)+1)((cos(x)-1)/(cos(x)-1))) + C = 1/2lnabs((cos(x) − 1)^2/(1 − cos^2(x)))+ C
And using properties of logarithms and trig identities:
1/2lnabs(((1-cos(x))/sin(x))^2) + C = lnabs((1-cos(x))/sin(x)) + C = lnabs( 1/sin(x)-cos(x)/sin(x)) +C = lnabs(csc(x) - cot(x)) + C
We arrive at our final answer.