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.

  • 3
    $\begingroup$ Can you explain the final step in your derivation ? Notice that $(1+s)/(1-s)=(1+s)^2/(1-s^2)=(1/c+s/c)^2$. $\endgroup$ – Yves Daoust Mar 19 '17 at 9:42
  • $\begingroup$ Thank you very much! I mistakenly wrote $\sqrt{1-\cos^2 x}=\sin^2 x$. $\endgroup$ – ahra Mar 19 '17 at 9:50
  • $\begingroup$ I think you forgot to change the differentials when you substitute variables.. first one $cos(x)=t$ implies $x=arccos(t)$ and $dx= arccos(t)'dt$, and aslo the second one..Did i miss something? $\endgroup$ – user94719 Mar 19 '17 at 9:52
  • $\begingroup$ $t=\cos x$ and $dt=-\sin x dx\Rightarrow dx=-dt/\sin x$ $\endgroup$ – ahra Mar 19 '17 at 9:54

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).$$


Hint: Use the trick \begin{align} \sec x= \frac{\sec x+\tan x}{\sec x+\tan x} \sec x. \end{align} then $u$-sub.

  • 2
    $\begingroup$ This is very interesting, but I think OP is keener to understand where the error lies in their calculations. $\endgroup$ – rubik Mar 19 '17 at 9:33

Just another approach: $\frac{1}{cosx}=\frac{cosx}{cos^2x}=\frac{cosx}{1-sin^2x}$.And performing a substitution $cosx=t$ in $\int\frac{{\cos}xdx}{1-sin^2x}$ results in a doable integral.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.