I have to evaluate the integral of the $\sec x$ function and I do it as follows $$\int\sec xdx=\int\frac{dx}{\cos x}=\int\frac{\cos^2 x+\sin^2 x}{\cos x}dx=\sin x+\int\frac{\sin^2x}{\cos x}dx$$ Now we make a change of variables $\cos x=t$ so our integral becomes $$\sin x-\int\frac{\sqrt{1-t^2}}{t}dt$$ Now we make another change of variable $\sqrt{1-t^2}=z$ so our integral becomes $$\sin x-\int\frac{z^2-1+1}{z^2-1}dz=\sin x-\int\left(1+\frac{1}{z^2-1}\right)dz=$$ $$=\sin x-\sqrt{1-\cos^2x}+\frac12\ln\left|\frac{1+\sqrt{1-\cos^2x}{}}{1-\sqrt{1-\cos^2x}}\right|+C=\frac12\ln|\tan^2x+\sec^2x|+C$$ The calculator however evaluates this integral as $$\ln|\tan x+\sec x|+C$$ but I can't figure out where I made a mistake in my calculations.
2026-04-07 20:30:47.1775593847
Trouble integrating $\sec x$
219 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
3
The fast way:
$$\int\frac{dx}{\cos x}=\int\frac{\cos x\,dx}{\cos^2x}=\int\frac{\sin'x\,dx}{1-\sin^2x}=\text{artanh}(\sin x).$$