Solution:
Key idea: We rationalise the denominator using sec2x−tan2x=1. The integrand then splits into secxtanx, sec2x and a constant, which are all standard integrals.
Step 1 — Rationalise the denominator.
We multiply the numerator and the denominator by secx−tanx.
secx+tanxtanx=sec2x−tan2xtanx(secx−tanx)
The denominator is 1 by the identity sec2x−tan2x=1.
sec2x−tan2xtanx(secx−tanx)=tanx(secx−tanx)
Step 2 — Expand and use tan2x=sec2x−1.
We multiply out the bracket.
tanx(secx−tanx)=secxtanx−tan2x
We replace tan2x by sec2x−1, because sec2x has a standard integral.
secxtanx−tan2x=secxtanx−sec2x+1
Step 3 — Integrate term by term.
The integrals of secxtanx, sec2x and 1 are secx, tanx and x.
∫(secxtanx−sec2x+1)dx=secx−tanx+x+C
Therefore, ∫secx+tanxtanxdx=secx−tanx+x+C.