Solution:
Concept: A square of a cosine is first lowered with cos2x=21+cos2x. The piece ∫eaxcosbxdx is then found by integrating by parts twice, after which the integral reappears and can be solved for.
Step 1 — Lower the power of the cosine.
We use the double-angle identity so that only first powers of trigonometric functions remain.
e2xcos2x=21e2x+21e2xcos2x
So, writing N=∫e2xcos2xdx,
I=21∫e2xdx+21N
Step 2 — Integrate the simple piece.
The integral of e2x is 21e2x, because the coefficient of x is 2.
21∫e2xdx=41e2x
Step 3 — Integrate N by parts once.
We take cos2x as the first function and e2x as the second, with ∫e2xdx=21e2x.
N=cos2x⋅21e2x−∫(−2sin2x)⋅21e2xdx
N=21e2xcos2x+∫e2xsin2xdx
Step 4 — Integrate by parts again.
Now sin2x is the first function and e2x the second, so that N comes back.
∫e2xsin2xdx=sin2x⋅21e2x−∫2cos2x⋅21e2xdx
∫e2xsin2xdx=21e2xsin2x−N
Step 5 — Solve for N.
We substitute Step 4 into Step 3 and collect the two N terms on the left.
N=21e2xcos2x+21e2xsin2x−N
2N=21e2x(cos2x+sin2x)
N=41e2x(cos2x+sin2x)
Step 6 — Combine the two pieces.
We add the result of Step 2 and half of N, and include the constant of integration.
I=41e2x+21⋅41e2x(cos2x+sin2x)+C
I=41e2x+81e2x(cos2x+sin2x)+C
Step 7 — Check by differentiating.
Differentiating the answer gives 21e2x+21e2xcos2x. By the identity in Step 1 this is e2xcos2x, so the result is correct.
Therefore, ∫e2xcos2xdx=41e2x+81e2x(cos2x+sin2x)+C.