If the integral as written in my comment is accurate, then we have

Expand the polynomial, then complete the square within the square root:


Let
and
:



Recall that
for all
, but for all
in the integration interval we have
. So
:

Recall the double angle identity,




You can determine the more general result in the same way.

Complete the square to get

and let
for brevity. Note that


Make the following substitution,


and the integral reduces like before to

where



(Depending on the interval [p, q] and thus [P, Q], the square root of cosine squared may not always reduce to sine.)
Resolving the integral and replacing c, with

because
, gives

Without knowing p and q explicitly, there's not much more to say.