Evaluate the improper integral $$\int_0^{\pi/2}(\sec^2x-\sec x \tan x)dx$$
I got $$\int_0^{\pi/2}(\sec^2x-\sec x \tan x)dx=\int_0^{\pi/2} \frac{1-\sin x}{\cos^2x}dx$$
The singularity occurs at the upper bound $\pi/2$. But, I don't know how to deal with it to evaluate the integral.
I would greatly appreciate any help.
$$\lim_{z\to \pi/2^-}\int_0^z(\sec^2x-\sec x \tan x)\,dx=\lim_{z\to \pi/2^-}[\tan z-\sec z+1]=\lim_{z\to \pi/2^-}\frac{\sin x+\cos x-1}{\cos x}=1$$