Solution:
Key idea: We first factorise cos2x as a difference of squares. After cancelling one factor, the numerator is the derivative of sinx+cosx, and the substitution t=sinx+cosx finishes the question.
Step 1 — Factorise the numerator.
We use the double-angle formula and then the difference of two squares.
cos2x=cos2x−sin2x
cos2x−sin2x=(cosx−sinx)(cosx+sinx)
Step 2 — Cancel the common factor.
One factor cosx+sinx cancels with the squared denominator.
(sinx+cosx)2cos2x=sinx+cosxcosx−sinx
Step 3 — Substitute.
We put the new denominator equal to t.
t=sinx+cosx
Differentiating both sides shows that the numerator with dx is dt.
dt=(cosx−sinx)dx
Step 4 — Integrate and return to x.
The integral is now the standard ∫tdt.
∫sinx+cosxcosx−sinxdx=∫tdt
∫tdt=log∣t∣+C
We put back t=sinx+cosx.
log∣t∣+C=log∣sinx+cosx∣+C
Therefore, ∫(sinx+cosx)2cos2xdx=log∣sinx+cosx∣+C.