Ta có: \(I=\int \frac{{\rm d}x}{\cos x.\cos \left(x+\frac{\pi }{4} \right)} =\int \frac{{\rm d}x}{\cos x.\left(\frac{\sqrt{2} }{2} \cos x-\frac{\sqrt{2} }{2} \sin x\right)} =\int \frac{\sqrt{2} \, {\rm d}x}{\cos ^{2} x.\left(1-\tan x\right)}\).
Đặt \(t=1-\tan x\Rightarrow {\rm d}t=-\frac{1}{\cos ^{2} x} {\rm d}x\Rightarrow \frac{1}{\cos ^{2} x} {\rm d}x=-{\rm d}t.\)
Suy ra: \(I=-\sqrt{2} \int \frac{{\rm d}t}{t} =-\sqrt{2} \ln \left|t\right|+C.\)
Vậy \(I=-\sqrt{2} \ln \left|1-\tan x\right|+C.\)