algebrist, this is how you could calculate it without knowing it by heart:
integral of dx/sin(x)^2
I don't know what else to do here, so:
t=sinx, dt=cosxdx, dx=dt/cosx, dx=dt/sqrt(1-t^2)
= integral of dt/(t^2*sqrt(1-t^2))
This can be simplified by substituting 1/t:
u=1/t, du=-t^(-2)dt, dt=-t^2du
= - integral of du/sqrt(1-1/u^2)
By simple algebraic manipulation we can turn this into:
= - integral of udu/sqrt(u^2-1)
v=u^2-1, dv=2udu, du=dv/2u
= -1/2 integral of dv/sqrt(v)
= -sqrt(v) + C
= -sqrt(u^2-1) + C
= -sqrt(1/t^2 - 1) + C
= -sqrt((1-t^2)/t^2) + C
= -sqrt(cos(x)^2/sin(x)^2) + C
= -ctg(x) + C
The problem with integrals is that there isn't a smart way to directly calculate them. You can only transform them until you get something for what you know what it is a derivative of (up to a constant). :)