Solution:
Key idea: When the denominator contains x+a, we write the x in the numerator as (x+a)−a and expand. The fraction then splits into a multiple of cot(x+a) and a constant, and ∫cot(x+a)dx=log∣sin(x+a)∣+C.
Step 1 — Expand the numerator.
We use cos(A−B)=cosAcosB+sinAsinB, with A=x+a and B=a.
cosx=cos[(x+a)−a]
cos[(x+a)−a]=cos(x+a)cosa+sin(x+a)sina
Step 2 — Divide by sin(x+a).
We divide each term by sin(x+a).
sin(x+a)cosx=cosa⋅sin(x+a)cos(x+a)+sina
cosa⋅sin(x+a)cos(x+a)+sina=cosacot(x+a)+sina
Step 3 — Integrate term by term.
Here cosa and sina are constants. The integral of cot(x+a) is log∣sin(x+a)∣, and the integral of the constant sina is xsina.
∫[cosacot(x+a)+sina]dx=cosalog∣sin(x+a)∣+xsina+C
Therefore, ∫sin(x+a)cosxdx=cosalog∣sin(x+a)∣+xsina+C.