Solution:
Concept: If f is differentiable, then ∫ex[f(x)+f′(x)]dx=exf(x)+C. To see why, differentiate exf(x) by the product rule: the result is exf(x)+exf′(x), which is exactly the integrand. So whenever the bracket is a function plus its own derivative, the answer is ex times that function.
Step 1 — Show that the two printed forms are the same.
The integrand needs cosx>0 (so that logcosx and logsecx exist), for example −2π<x<2π. On such an interval we rewrite −logcosx with the rule −loga=loga1.
−logcosx=logcosx1
−logcosx=logsecx
So both integrals equal ∫ex(tanx+logsecx)dx.
Step 2 — Choose f(x).
We take f(x)=logsecx and differentiate it by the chain rule.
f′(x)=secxsecxtanx
f′(x)=tanx
Step 3 — Match the pattern.
The bracket is f′(x)+f(x), so the integral is exf(x).
I=exlogsecx+C
Step 4 — Check by differentiating.
The derivative of exlogsecx is exlogsecx+extanx, which is the integrand.
Therefore, both integrals equal exlogsecx+C (that is, −exlogcosx+C), where cosx>0.