<s>[INST] How does $\int (\cos(x))^{-2}dx$ equal to $\tan(x)$? How does $$\int \frac{1}{\cos^2(x)} dx= \tan(x)+ C$$ ?
 [/INST] $$\int\dfrac{1}{\cos^2{x}}dx =\int \dfrac{\cos^2{x}+\sin^2{x}}{\cos^2{x}}dx  $$
Letting $u = \sin x \implies du = \cos x dx $ and $ v = \cos{x} \implies dv = -\sin{x} dx$
$$\int \dfrac{\cos^2{x}+\sin^2{x}}{\cos^2{x}}dx  = \int \dfrac{vdu-udv}{v^2} = \int d \left(\dfrac{u}{v}\right) = \dfrac{u}{v} + C = \dfrac{\sin x}{\cos x}+C = \tan{x}+C$$
</s>