Solution:
Key idea: The derivative of a+bcosx is −bsinx, so the numerator is a constant multiple of the derivative of the denominator. The substitution t=a+bcosx gives a multiple of ∫tdt.
Step 1 — Substitute.
We put the denominator equal to t (with b=0).
t=a+bcosx
Differentiating both sides gives the new differential.
dt=−bsinxdx
We divide by −b to get the numerator times dx.
sinxdx=−bdt
Step 2 — Integrate in terms of t.
We replace the numerator and the denominator, and take the constant −b1 outside.
∫a+bcosxsinxdx=−b1∫tdt
−b1∫tdt=−b1log∣t∣+C
Step 3 — Return to x.
We put back t=a+bcosx.
−b1log∣t∣+C=−b1log∣a+bcosx∣+C
Therefore, ∫a+bcosxsinxdx=−b1log∣a+bcosx∣+C (for b=0, wherever a+bcosx=0).