Solve $ \int_\frac{-π}{3}^{\frac{π}{3}}\frac{\cos^2(x)-\sin^2(x)}{\cos^2(x)}dx$ I came across this question in my textbook and have been trying to solve it for a while but I seem to have made a mistake somewhere.
$$ \int_\frac{-π}{3}^{\frac{π}{3}}\frac{\cos^2(x)-\sin^2(x)}{\cos^2(x)}dx$$ and here is what I did. First I simplified the equation as $$ \int_\frac{-π}{3}^{\frac{π}{3}}(1-\tan^2(x))dx=x|_{\frac{-π}{3}}^{\frac{π}{3}}-\int_\frac{-π}{3}^{\frac{π}{3}}(\tan^2(x))dx$$
Then I simplified $\tan^2(x)\equiv\frac{\sin^2(x)}{\cos^2(x)}, \sin^2(x)\equiv1-\cos^2(x)$ so it becomes,  $\tan^2(x)\equiv\frac{1-\cos^2(x)}{\cos^2(x)}=\frac{1}{\cos^2(x)}-1$ making the overall integral 
$$\int_\frac{-π}{3}^{\frac{π}{3}}(1-\tan^2(x))dx=x|_{\frac{-π}{3}}^{\frac{π}{3}}-\int_\frac{-π}{3}^{\frac{π}{3}}(\frac{1}{\cos^2(x)}-1)dx$$
$$=x|_{\frac{-π}{3}}^{\frac{π}{3}}-\int_\frac{-π}{3}^{\frac{π}{3}}\frac{1}{\cos^2(x)}dx-\int_\frac{-π}{3}^{\frac{π}{3}}1dx=x|_{\frac{-π}{3}}^{\frac{π}{3}}-x|_{\frac{-π}{3}}^{\frac{π}{3}}-\int_\frac{-π}{3}^{\frac{π}{3}}\frac{1}{\cos^2(x)}dx$$
I know that $\int\frac{1}{\cos^2(x)}dx=\tan(x)+c$ but that's off by heart and not because I can work it out. Since $x|_{\frac{-π}{3}}^{\frac{π}{3}}-x|_{\frac{-π}{3}}^{\frac{π}{3}}=0$, the final equation becomes 
$$\int_\frac{-π}{3}^{\frac{π}{3}}\frac{\cos^2(x)-\sin^2(x)}{\cos^2(x)}dx=\tan(x)|_{\frac{-π}{3}}^{\frac{π}{3}}=2 \sqrt3$$
Is what I did correct because I feel like I've made a mistake somewhere but can't find it. Also why does $\int\frac{1}{\cos^2(x)}dx=\tan(x)+c$. 
EDIT - Made an error in $\int\frac{1}{\cos^2(x)}dx=\tan^2(x)+c$, it's actually $\int\frac{1}{\cos^2(x)}dx=\tan(x)+c$.

$\begin{align} J=\int_\frac{-π}{3}^{\frac{π}{3}}\frac{\cos^2(x)-\sin^2(x)}{\cos^2(x)}dx=2\int_0^{\frac{π}{3}}\frac{\cos^2(x)-\sin^2(x)}{\cos^2(x)}dx\end{align}$
Observe that for $x\in [0;\frac{\pi}{3}]$,
$\begin{align} \frac{\cos^2(x)-\sin^2(x)}{\cos^2 x}&=\frac{\cos^2 x(1-\tan^2 x)}{\cos^2 x}\\
&=\frac{1-\tan^2 x}{1+\tan^2 x}\times \frac{1}{\cos^2x}
\end{align}$
Perform the change of variable $y=\tan x$,
$\begin{align}J&=2\int_{0}^{\sqrt{3}}\frac{1-y^2}{1+y^2}\,dy\\
&=2\int_{0}^{\sqrt{3}} \left(\frac{2}{1+y^2}-1\right)\,dy\\
&=2\Big[2\arctan y-y\Big]_{0}^{\sqrt{3}}\\
&=2\Big[2\times \frac{\pi}{3}-\sqrt{3}\Big]\\
&=\boxed{\frac{4\pi}{3}-2\sqrt{3}}
\end{align}$
