The increasing substitution maps onto , with . Since sine and cosine are nonnegative there, powers combine without a sign ambiguity:
This is the trigonometric form of the beta function. The powers at the endpoints are integrable because .