Solution:
Key idea: We turn the difference of cosines into a product with cosC−cosD=−2sin2C+Dsin2C−D, and then the trick 1=sin2x+cos2x in the numerator splits the integrand into standard forms.
Step 1 — Factorise the denominator.
We apply the formula with C=3x and D=x, so 2C+D=2x and 2C−D=x.
cos3x−cosx=−2sin2xsinx
Now we use sin2x=2sinxcosx.
cos3x−cosx=−2(2sinxcosx)sinx
cos3x−cosx=−4sin2xcosx
Step 2 — Write the integral with the new denominator.
We put this product into the integral and take the constant −41 outside.
I=−41∫sin2xcosx1dx
Step 3 — Replace 1 by sin2x+cos2x and split.
Writing the numerator 1 as sin2x+cos2x lets each part cancel with the denominator.
I=−41∫sin2xcosxsin2x+cos2xdx
I=−41∫(cosx1+sin2xcosx)dx
I=−41∫(secx+cosecxcotx)dx
Step 4 — Integrate each term.
We use ∫secxdx=log∣secx+tanx∣ and ∫cosecxcotxdx=−cosecx.
I=−41[log∣secx+tanx∣−cosecx]+C
I=41cosecx−41log∣secx+tanx∣+C
Therefore, ∫cos3x−cosxdx=41[cosecx−log∣secx+tanx∣]+C, wherever sinx=0 and cosx=0.