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 constant and a multiple of cot(x+a), and ∫cot(x+a)dx=log∣sin(x+a)∣+C.
Step 1 — Expand the numerator.
We use sin(A−B)=sinAcosB−cosAsinB, with A=x+a and B=a.
sinx=sin[(x+a)−a]
sin[(x+a)−a]=sin(x+a)cosa−cos(x+a)sina
Step 2 — Divide by sin(x+a).
We divide each term by sin(x+a).
sin(x+a)sinx=cosa−sina⋅sin(x+a)cos(x+a)
cosa−sina⋅sin(x+a)cos(x+a)=cosa−sinacot(x+a)
Step 3 — Integrate term by term.
Here cosa and sina are constants. The integral of the constant cosa is xcosa, and the integral of cot(x+a) is log∣sin(x+a)∣.
∫[cosa−sinacot(x+a)]dx=xcosa−sinalog∣sin(x+a)∣+C
Therefore, ∫sin(x+a)sinxdx=xcosa−sinalog∣sin(x+a)∣+C.