Solution:
Key idea: We expand sin(x−a) and divide by sinx. The fraction becomes a constant minus a multiple of cotx, and ∫cotxdx=log∣sinx∣+C.
Step 1 — Expand the numerator.
We use sin(A−B)=sinAcosB−cosAsinB.
sin(x−a)=sinxcosa−cosxsina
Step 2 — Divide by sinx.
We divide each term by sinx.
sinxsin(x−a)=cosa−sina⋅sinxcosx
cosa−sina⋅sinxcosx=cosa−sinacotx
Step 3 — Integrate term by term.
We treat cosa and sina as constants. The integral of cosa is xcosa, and the integral of cotx is log∣sinx∣.
∫(cosa−sinacotx)dx=xcosa−sinalog∣sinx∣+C
Therefore, ∫sinxsin(x−a)dx=xcosa−sinalog∣sinx∣+C.