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 [<em>p</em>, <em>q</em>] and thus [<em>P</em>, <em>Q</em>], the square root of cosine squared may not always reduce to sine.)
Resolving the integral and replacing <em>c</em>, with
because , gives
Without knowing <em>p</em> and <em>q</em> explicitly, there's not much more to say.