Trouble integrating $\sec x$
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.